gsniff

package
v0.0.0-...-bad6181 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	UsageNone = MustMakeUsage("@nonono\n")
)

Functions

func Dial

func Dial(network, addr string, dialer gnet.Dialer, usage Usage) (net.Conn, error)

func MatcherHTTP1

func MatcherHTTP1(r io.Reader, info *Info) (int, error)

tested except websocket

func MatcherHTTP2

func MatcherHTTP2(r io.Reader, info *Info) (int, error)

尚未测试

func MatcherSocks5

func MatcherSocks5(r io.Reader, info *Info) (int, error)

tested

func MatcherUsage

func MatcherUsage(r io.Reader, info *Info) (int, error)

func NewClient

func NewClient(conn net.Conn, usage Usage) (net.Conn, error)

NewClient wraps net.Conn to UMUxConn before any Read/Write.

Types

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

Conn is server-side connection which could sniff info.

func (*Conn) Read

func (c *Conn) Read(p []byte) (n int, err error)

WARNING: data read by NormalReader can't be read from RewindReader again.

func (*Conn) SniffedInfo

func (c *Conn) SniffedInfo() *Info

SniffedInfo returns sniffed info.

type Err

type Err struct {
	// contains filtered or unexported fields
}

func (*Err) Error

func (se *Err) Error() string

type Info

type Info struct {
	Network     string // listening network
	Addr        string // listen address
	Usage       Usage
	UsageExt    string
	Protocols   []string // "http1", "socks5", TODO "SMux", "http2", "websocket", "grpc"...
	HTTP1Req    *http.Request
	HTTP2Fields [][2]string
	Reasons     map[string]string
}

Info is sniffed info.

type Listener

type Listener struct {
	// contains filtered or unexported fields
}

Listener is a multiple networks / ports / protocols listener.

func NewListener

func NewListener() *Listener

NewListener creates new Listener.

func (*Listener) Accept

func (ml *Listener) Accept() (net.Conn, error)

Accept waits for and returns the next connection to the listener.

func (*Listener) AddListen

func (ml *Listener) AddListen(network, addr string, matchers ...Matcher) error

AddListen add new listen address.

func (*Listener) AddListener

func (ml *Listener) AddListener(rawLn net.Listener, matchers ...Matcher) error

AddListener add new listener.

func (*Listener) Addr

func (ml *Listener) Addr() []string

Addr returns all the listener's network address.

func (*Listener) Close

func (ml *Listener) Close() error

Close closes all the listeners. Any blocked 'Accept' operations will be unblocked and return errors.

func (*Listener) CloseOne

func (ml *Listener) CloseOne(network, addr string) error

CloseOne closes one listener.

type Matcher

type Matcher = func(r io.Reader, out *Info) (toDelBytes int, err error)

Matcher is match method implement.

type Usage

type Usage [8]byte

func MakeUsage

func MakeUsage(s string) (Usage, error)

func MustMakeUsage

func MustMakeUsage(s string) Usage

func (Usage) Bytes

func (u Usage) Bytes() []byte

func (Usage) String

func (u Usage) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL