Documentation ¶
Index ¶
- Variables
- func AddUsage(name, usage string)
- func Copy(dst io.Writer, src io.Reader) (written int64, err error)
- func CopyBuffer(dst io.Writer, src io.Reader) (written int64, err error)
- func CopyN(dst io.Writer, src io.Reader, n int64) (written int64, err error)
- func CopyUDP(dst net.PacketConn, writeTo net.Addr, src net.PacketConn, ...) error
- func DialerSchemes() string
- func RegisterDialer(name string, c DialerCreator)
- func RegisterServer(name string, c ServerCreator)
- func Relay(left, right net.Conn) error
- func ServerSchemes() string
- func Usage(name string) string
- type Conn
- type Dialer
- type DialerCreator
- type Direct
- type PacketServer
- type Proxy
- type Server
- type ServerCreator
- type TCPDialer
- type UDPDialer
Constants ¶
This section is empty.
Variables ¶
var ( // TCPBufSize is the size of tcp buffer. TCPBufSize = 32 << 10 // UDPBufSize is the size of udp buffer. UDPBufSize = 2 << 10 )
var ( // ErrNotSupported indicates that the operation is not supported ErrNotSupported = errors.New("not supported") )
Functions ¶
func AddUsage ¶ added in v0.16.0
func AddUsage(name, usage string)
AddUsage adds help message for the named proxy.
func CopyBuffer ¶ added in v0.11.0
CopyBuffer copies from src to dst with a userspace buffer.
func CopyUDP ¶ added in v0.16.0
func CopyUDP(dst net.PacketConn, writeTo net.Addr, src net.PacketConn, timeout time.Duration, step time.Duration) error
CopyUDP copys from src to dst at target with read timeout. if step sets to non-zero value, the read timeout will be increased from 0 to timeout by step in every read operation.
func DialerSchemes ¶ added in v0.16.0
func DialerSchemes() string
DialerSchemes returns the registered dialer schemes.
func RegisterDialer ¶
func RegisterDialer(name string, c DialerCreator)
RegisterDialer is used to register a dialer.
func RegisterServer ¶
func RegisterServer(name string, c ServerCreator)
RegisterServer is used to register a proxy server.
func ServerSchemes ¶ added in v0.16.0
func ServerSchemes() string
ServerSchemes returns the registered server schemes.
Types ¶
type Conn ¶ added in v0.11.0
Conn is a connection with buffered reader.
type Dialer ¶
Dialer is used to create connection.
func DialerFromURL ¶
DialerFromURL calls the registered creator to create dialers. dialer is the default upstream dialer so cannot be nil, we can use Default when calling this function.
type DialerCreator ¶
DialerCreator is a function to create dialers.
type Direct ¶
type Direct struct {
// contains filtered or unexported fields
}
Direct proxy.
type PacketServer ¶ added in v0.16.0
type PacketServer interface {
ServePacket(pc net.PacketConn)
}
PacketServer interface.
type Proxy ¶ added in v0.8.1
type Proxy interface { // Dial connects to the given address via the proxy. Dial(network, addr string) (c net.Conn, dialer Dialer, err error) // DialUDP connects to the given address via the proxy. DialUDP(network, addr string) (pc net.PacketConn, dialer UDPDialer, err error) // Get the dialer by dstAddr. NextDialer(dstAddr string) Dialer // Record records result while using the dialer from proxy. Record(dialer Dialer, success bool) }
Proxy is a dialer manager.
type Server ¶
type Server interface { // ListenAndServe sets up a listener and serve on it ListenAndServe() // Serve serves a connection Serve(c net.Conn) }
Server interface.
type ServerCreator ¶
ServerCreator is a function to create proxy servers.
Directories ¶
Path | Synopsis |
---|---|
Package http implements a http proxy.
|
Package http implements a http proxy. |
Package obfs implements simple-obfs of ss
|
Package obfs implements simple-obfs of ss |
Package reject implements a virtual proxy which always reject requests.
|
Package reject implements a virtual proxy which always reject requests. |
Package socks5 implements a socks5 proxy.
|
Package socks5 implements a socks5 proxy. |