Documentation ¶
Index ¶
- func EnableDebug()
- func GetAddressFromURL(s string) (string, error)
- func HasPort(host string) bool
- func MakeSSKey(password string) []byte
- func QR(server, password, music string)
- func RunBKClient(address, server, password string, timeout, deadline int, m string) error
- func RunBKHTTPClient(address, server, password string, timeout, deadline int, m string) error
- func RunBKServer(address, password string, timeout, deadline int, m string) error
- func RunRelay(address, server string, timeout, deadline int) error
- func RunS5Client(address, server, password string, timeout, deadline int) error
- func RunS5Server(address, password string, timeout, deadline int) error
- func RunSSClient(address, server, password string, timeout, deadline int) error
- func RunSSHTTPClient(address, server, password string, timeout, deadline int) error
- func RunSSServer(address, password string, timeout, deadline int) error
- func RunSocks5Server(address, username, password string, timeout, deadline int) error
- func RunSocks5ToHTTP(address, socks5 string, timeout, deadline int) error
- type BKClient
- type BKServer
- type CipherConn
- func (c *CipherConn) Close() error
- func (c *CipherConn) LocalAddr() net.Addr
- func (c *CipherConn) Read(b []byte) (n int, err error)
- func (c *CipherConn) RemoteAddr() net.Addr
- func (c *CipherConn) SetDeadline(t time.Time) error
- func (c *CipherConn) SetReadDeadline(t time.Time) error
- func (c *CipherConn) SetWriteDeadline(t time.Time) error
- func (c *CipherConn) Write(b []byte) (n int, err error)
- type DefaultDial
- type Dialer
- type HTTPMiddleman
- type Relay
- type S5Client
- type S5Server
- type SSClient
- type SSServer
- type Socks5Middleman
- type Socks5Server
- type Socks5ToHTTP
- type WhiteHTTPMiddleman
- type WhiteSocks5Middleman
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAddressFromURL ¶
func RunBKClient ¶
RunBKClient used to make a new BKClient and start a socks5 proxy to listen
func RunBKHTTPClient ¶
RunBKHTTPClient used to make a new BKClient and start a http proxy to listen
func RunBKServer ¶
RunBKServer used to make a new BKServer and start to listen
func RunS5Client ¶
RunS5Client used to make a new S5Client and start a socks5 proxy to listen
func RunS5Server ¶
RunS5Server used to make a new S5Server and start to listen
func RunSSClient ¶
RunSSClient used to make a new SSClient and start a socks5 proxy to listen
func RunSSHTTPClient ¶
RunSSHTTPClient used to make a new SSClient and start a http proxy to listen
func RunSSServer ¶
RunSSServer used to make a new SSServer and start to listen
func RunSocks5Server ¶
RunSocks5Server used to make a new Socks5Server and start a raw socks5 proxy to listen
func RunSocks5ToHTTP ¶
RunSocks5ToHTTP used to make a new Socks5ToHTTP and start a http proxy to listen
Types ¶
type BKClient ¶
type BKClient struct { Address string Password string Server string Timeout int Deadline int Music music.Music Dial Dialer Listen net.Listener HTTPMiddleman HTTPMiddleman Socks5Middleman Socks5Middleman }
BKClient is the client of brook protocol
func NewBKClient ¶
func NewBKClient(address, server, password string, timeout, deadline int, m string, dial Dialer) (*BKClient, error)
NewBKClient returns a new BKClient, dial can be set to nil
func (*BKClient) ListenAndServe ¶
func (c *BKClient) ListenAndServe(sm Socks5Middleman) error
ListenAndServe will let client start to listen and serve, sm can be nil
func (*BKClient) ListenAndServeHTTP ¶
func (c *BKClient) ListenAndServeHTTP(h HTTPMiddleman) error
ListenAndServeHTTP will let client start a http(s) proxy to listen and serve. For just a http proxy server, so httpmiddleman can be nil
type BKServer ¶
type BKServer struct { Address string Password string Timeout int Deadline int Music music.Music Listen net.Listener }
BKServer is the server of brook protocol
func NewBKServer ¶
NewBKServer returns a new BKServer
func (*BKServer) ListenAndServe ¶
ListenAndServe will let server start to listen and serve
type CipherConn ¶
type CipherConn struct {
// contains filtered or unexported fields
}
CipherConn is the encrypted connection
func NewCipherConn ¶
NewCipherConn returns a new CipherConn, iv length must be equal aes.BlockSize
func (*CipherConn) LocalAddr ¶
func (c *CipherConn) LocalAddr() net.Addr
LocalAddr is just like net.Conn interface
func (*CipherConn) Read ¶
func (c *CipherConn) Read(b []byte) (n int, err error)
Read is just like net.Conn interface
func (*CipherConn) RemoteAddr ¶
func (c *CipherConn) RemoteAddr() net.Addr
RemoteAddr is just like net.Conn interface
func (*CipherConn) SetDeadline ¶
func (c *CipherConn) SetDeadline(t time.Time) error
SetDeadline is just like net.Conn interface
func (*CipherConn) SetReadDeadline ¶
func (c *CipherConn) SetReadDeadline(t time.Time) error
SetReadDeadline is just like net.Conn interface
func (*CipherConn) SetWriteDeadline ¶
func (c *CipherConn) SetWriteDeadline(t time.Time) error
SetWriteDeadline is just like net.Conn interface
type DefaultDial ¶
type DefaultDial struct { }
DefaultDial is the default dialer which dial with tcp network
type HTTPMiddleman ¶
type HTTPMiddleman interface { // HandleHTTPProxy does not need to close conn, // Addr is the absoluteURI, RFC 2396 // if handled is true or err is not nil that means the request has been handled HandleHTTPProxy(method, addr string, request []byte, conn *net.TCPConn) (handled bool, err error) }
HTTPMiddleman is a middleman who can intercept and handle request
type Relay ¶
Relay is a relay for two network
func (*Relay) ListenAndServe ¶
ListenAndServe will let relay start to listen and serve
type S5Client ¶
type S5Client struct { Address string Password string Server string Timeout int Deadline int Dial Dialer Listen net.Listener }
S5Client is the client of socks5 encrypt protocol
func NewS5Client ¶
NewS5Client returns a new S5Client
func (*S5Client) ListenAndServe ¶
ListenAndServe will let client start to listen and serve
type S5Server ¶
type S5Server struct { Address string Password string Timeout int Deadline int Listen net.Listener }
S5Server is the server of socks5 encrypt protocol
func NewS5Server ¶
NewS5Server returns a new S5Server
func (*S5Server) ListenAndServe ¶
ListenAndServe will let server start to listen and serve
type SSClient ¶
type SSClient struct { Address string Password string Server string Timeout int Deadline int Dial Dialer Listen net.Listener HTTPMiddleman HTTPMiddleman Socks5Middleman Socks5Middleman }
SSClient is the client of shadowsocks protocol
func NewSSClient ¶
NewSSClient returns a new SSClient
func (*SSClient) ListenAndServe ¶
func (c *SSClient) ListenAndServe(sm Socks5Middleman) error
ListenAndServe will let client start to listen and serve
func (*SSClient) ListenAndServeHTTP ¶
func (c *SSClient) ListenAndServeHTTP(h HTTPMiddleman) error
ListenAndServeHTTP will let client start a http(s) proxy to listen and serve. For just a http proxy server, so httpmiddleman can be nil
type SSServer ¶
type SSServer struct { Address string Password string Timeout int Deadline int Listen net.Listener }
SSServer is the server of shadowsocks protocol
func NewSSServer ¶
NewSSServer returns a new SSServer
func (*SSServer) ListenAndServe ¶
ListenAndServe will let server start to listen and serve
type Socks5Middleman ¶
type Socks5Middleman interface { // HandleSocks5Proxy does not need to close conn, // if handled is true or err is not nil that means the request has been handled HandleSocks5Proxy(request *socks5.Request, conn *net.TCPConn) (handled bool, err error) }
Socks5Middleman is a middleman who can intercept and handle request
type Socks5Server ¶
type Socks5Server struct { Address string UserName string Password string Timeout int Deadline int Dial Dialer Listen net.Listener Socks5Middleman Socks5Middleman }
Socks5Server is the client of raw socks5 protocol
func NewSocks5Server ¶
func NewSocks5Server(address, userName, password string, timeout, deadline int, dial Dialer) *Socks5Server
NewSocks5Server returns a new Socks5Server, dial can be set to nil
func (*Socks5Server) ListenAndForward ¶
func (c *Socks5Server) ListenAndForward(sm Socks5Middleman, addr string) error
ListenAndForward will let client start a no auth socks5 proxy to listen and forward to another socks5, c.UserName, c.Password will effect the forwarded socks5, sm can be nil
func (*Socks5Server) ListenAndServe ¶
func (c *Socks5Server) ListenAndServe(sm Socks5Middleman) error
ListenAndServe will let client start to listen and serve, sm can be nil
func (*Socks5Server) Shutdown ¶
func (c *Socks5Server) Shutdown() error
Shutdown used to stop the client
type Socks5ToHTTP ¶
type Socks5ToHTTP struct { Address string Socks5Address string Dial proxy.Dialer Timeout int Deadline int Listen net.Listener HTTPMiddleman HTTPMiddleman }
func NewSocks5ToHTTP ¶
func NewSocks5ToHTTP(addr, socks5addr string, timeout, deadline int) (*Socks5ToHTTP, error)
func (*Socks5ToHTTP) ListenAndServe ¶
func (s *Socks5ToHTTP) ListenAndServe(h HTTPMiddleman) error
func (*Socks5ToHTTP) Shutdown ¶
func (s *Socks5ToHTTP) Shutdown() error
type WhiteHTTPMiddleman ¶
WhiteHTTPMiddleman is a HTTPMiddleman who only handle domain in white list
func NewWhiteHTTPMiddleman ¶
func NewWhiteHTTPMiddleman(timeout, deadline int) *WhiteHTTPMiddleman
NewWhiteHTTPMiddleman returns a WhiteHTTPMiddleman which can used to handle http proxy request
func (*WhiteHTTPMiddleman) HandleHTTPProxy ¶
func (w *WhiteHTTPMiddleman) HandleHTTPProxy(method, addr string, request []byte, conn *net.TCPConn) (handled bool, err error)
HandleHTTPProxy handle http proxy request, if the domain is in the white list
type WhiteSocks5Middleman ¶
WhiteSocks5Middleman is a Socks5Middleman who only handle domain in white list
func NewWhiteSocks5Middleman ¶
func NewWhiteSocks5Middleman(timeout, deadline int, dial Dialer) *WhiteSocks5Middleman
NewWhiteSocks5Middleman returns a WhiteSocks5Middleman which can used to handle http proxy request
func (*WhiteSocks5Middleman) HandleSocks5Proxy ¶
func (w *WhiteSocks5Middleman) HandleSocks5Proxy(request *socks5.Request, c *net.TCPConn) (handled bool, err error)
HandleSocks5Proxy handle http proxy request, if the domain is in the white list