Documentation ¶
Index ¶
- Variables
- 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 RegisterDialer(name string, c DialerCreator)
- func RegisterServer(name string, c ServerCreator)
- func Relay(left, right net.Conn) error
- func RelayUDP(dst net.PacketConn, target net.Addr, src net.PacketConn, timeout time.Duration) error
- type Conn
- type Dialer
- type DialerCreator
- type Direct
- type Proxy
- type Server
- type ServerCreator
- type TCPDialer
- type UDPDialer
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // TCPBufSize is the size of tcp buffer. TCPBufSize = 32 << 10 // UDPBufSize is the size of udp buffer. UDPBufSize = 2 << 10 )
View Source
var ( // ErrNotSupported indicates that the operation is not supported ErrNotSupported = errors.New("not supported") )
Functions ¶
func CopyBuffer ¶ added in v0.11.0
CopyBuffer copies from src to dst with a userspace buffer.
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.
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 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, writeTo net.Addr, 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 |
protocol
|
|
smux
Package smux is a multiplexing library for Golang.
|
Package smux is a multiplexing library for Golang. |
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. |
Click to show internal directories.
Click to hide internal directories.