Documentation ¶
Index ¶
- Variables
- func Decrypt(p, b []byte, token plugin.TokenChecker) (a byte, addr, port, data []byte, err error)
- func EnableDebug()
- func Encrypt(p, b []byte) ([]byte, error)
- func ErrorReply(r *socks5.Request, c *net.TCPConn, e error) error
- func GetKey(p, n []byte) ([]byte, error)
- func IncrementNonce(n []byte) []byte
- func MakeSSKey(password string) []byte
- func PrepareKey(p []byte) ([]byte, []byte, error)
- func QR(stream bool, server, password string)
- func ReadFrom(c *net.TCPConn, k, n []byte, hasTime bool) ([]byte, []byte, error)
- func RunClient(address, ip, server, password string, ...) error
- func RunClientAsHTTP(address, ip, server, password string, ...) error
- func RunRelay(address, remote string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunSSClient(address, ip, server, password string, ...) error
- func RunSSClientAsHTTP(address, ip, server, password string, ...) error
- func RunSSServer(address, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunServer(address, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunSocks5Server(address, ip, username, password string, ...) error
- func RunSocks5ToHTTP(address, socks5 string, timeout, deadline int) error
- func RunStreamClient(address, ip, server, password string, ...) error
- func RunStreamClientAsHTTP(address, ip, server, password string, ...) error
- func RunStreamServer(address, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunSystemProxy(remove bool, pac string) error
- func RunTproxy(address, server, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunTunnel(address, to, server, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
- func RunVPN(address, server, password string, ...) error
- func WriteTo(c *net.TCPConn, d, k, n []byte, needTime bool) ([]byte, error)
- 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 Client
- func (x *Client) HTTPHandle(c *net.TCPConn) error
- func (x *Client) ListenAndServe() error
- func (x *Client) ListenAndServeHTTP() error
- func (x *Client) SetHTTPMiddleman(m plugin.HTTPMiddleman)
- func (x *Client) SetSocks5Middleman(m plugin.Socks5Middleman)
- func (x *Client) SetTokenGetter(token plugin.TokenGetter)
- func (x *Client) Shutdown() error
- func (x *Client) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) error
- func (x *Client) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- type Relay
- type SSClient
- func (x *SSClient) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
- func (x *SSClient) Encrypt(rawdata []byte) ([]byte, error)
- func (x *SSClient) HTTPHandle(c *net.TCPConn) error
- func (x *SSClient) ListenAndServe() error
- func (x *SSClient) ListenAndServeHTTP() error
- func (x *SSClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
- func (x *SSClient) SetSocks5Middleman(m plugin.Socks5Middleman)
- func (x *SSClient) Shutdown() error
- func (x *SSClient) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) error
- func (x *SSClient) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- func (x *SSClient) WrapCipherConn(conn *net.TCPConn) (*CipherConn, error)
- type SSServer
- func (s *SSServer) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
- func (s *SSServer) Encrypt(a byte, h, p, d []byte) ([]byte, error)
- func (s *SSServer) ListenAndServe() error
- func (s *SSServer) RunTCPServer() error
- func (s *SSServer) RunUDPServer() error
- func (s *SSServer) Shutdown() error
- func (s *SSServer) TCPHandle(c *net.TCPConn) error
- func (s *SSServer) UDPHandle(addr *net.UDPAddr, b []byte) error
- func (s *SSServer) WrapCipherConn(conn net.Conn) (*CipherConn, error)
- type Server
- func (s *Server) ListenAndServe() error
- func (s *Server) RunTCPServer() error
- func (s *Server) RunUDPServer() error
- func (s *Server) SetTokenChecker(token plugin.TokenChecker)
- func (s *Server) Shutdown() error
- func (s *Server) TCPHandle(c *net.TCPConn) error
- func (s *Server) UDPHandle(addr *net.UDPAddr, b []byte) error
- type Socks5Server
- func (x *Socks5Server) ListenAndForward(addr, username, password string) error
- func (x *Socks5Server) ListenAndServe() error
- func (x *Socks5Server) SetSocks5Middleman(m plugin.Socks5Middleman)
- func (x *Socks5Server) Shutdown() error
- func (x *Socks5Server) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) error
- func (x *Socks5Server) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- type Socks5ToHTTP
- type StreamClient
- func (x *StreamClient) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
- func (x *StreamClient) Encrypt(rawdata []byte) ([]byte, error)
- func (x *StreamClient) HTTPHandle(c *net.TCPConn) error
- func (x *StreamClient) ListenAndServe() error
- func (x *StreamClient) ListenAndServeHTTP() error
- func (x *StreamClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
- func (x *StreamClient) SetSocks5Middleman(m plugin.Socks5Middleman)
- func (x *StreamClient) Shutdown() error
- func (x *StreamClient) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) error
- func (x *StreamClient) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- func (x *StreamClient) WrapCipherConn(conn *net.TCPConn) (*CipherConn, error)
- type StreamServer
- func (s *StreamServer) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
- func (s *StreamServer) Encrypt(a byte, h, p, d []byte) ([]byte, error)
- func (s *StreamServer) ListenAndServe() error
- func (s *StreamServer) RunTCPServer() error
- func (s *StreamServer) RunUDPServer() error
- func (s *StreamServer) Shutdown() error
- func (s *StreamServer) TCPHandle(c *net.TCPConn) error
- func (s *StreamServer) UDPHandle(addr *net.UDPAddr, b []byte) error
- func (s *StreamServer) WrapCipherConn(conn net.Conn) (*CipherConn, error)
- type Tproxy
- func (s *Tproxy) ListenAndServe() error
- func (s *Tproxy) RunTCPServer() error
- func (s *Tproxy) RunUDPServer() error
- func (s *Tproxy) SetTokenGetter(token plugin.TokenGetter)
- func (s *Tproxy) Shutdown() error
- func (s *Tproxy) TCPHandle(c *net.TCPConn) error
- func (s *Tproxy) UDPHandle(addr, daddr *net.UDPAddr, b []byte) error
- type Tunnel
- func (s *Tunnel) ListenAndServe() error
- func (s *Tunnel) RunTCPServer() error
- func (s *Tunnel) RunUDPServer() error
- func (s *Tunnel) SetTokenGetter(token plugin.TokenGetter)
- func (s *Tunnel) Shutdown() error
- func (s *Tunnel) TCPHandle(c *net.TCPConn) error
- func (s *Tunnel) UDPHandle(addr *net.UDPAddr, b []byte) error
- type UDPExchange
- type VPN
Constants ¶
This section is empty.
Variables ¶
var Dial ant.Dialer = ant.DefaultDial
Functions ¶
func IncrementNonce ¶
IncrementNonce loves your compute to use Litter Endian
func RunClient ¶
func RunClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunClient used to make a new Client and start a socks5 proxy to listen
func RunClientAsHTTP ¶
func RunClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunClientAsHTTP used to make a new Client and start a http proxy to listen
func RunSSClient ¶
func RunSSClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunSSClient used to make a new Client and start a socks5 proxy to listen
func RunSSClientAsHTTP ¶
func RunSSClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunSSClientAsHTTP used to make a new Client and start a http proxy to listen
func RunSSServer ¶
RunSSServer used to make a new Server and start to listen
func RunSocks5Server ¶
func RunSocks5Server(address, ip, username, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
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
func RunStreamClient ¶
func RunStreamClient(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunStreamClient used to make a new StreamClient and start a socks5 proxy to listen
func RunStreamClientAsHTTP ¶
func RunStreamClientAsHTTP(address, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) error
RunClientAsHTTP used to make a new StreamClient and start a http proxy to listen
func RunStreamServer ¶
RunStreamServer used to make a new StreamServer and start to listen
func RunSystemProxy ¶
RunSystemProxy used to set/remove system proxy
func RunTunnel ¶
func RunTunnel(address, to, server, password string, tcpTimeout, tcpDeadline, udpDeadline int) error
RunTunnel used to start a tunnel
Types ¶
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 Client ¶
type Client struct { Server *socks5.Server RemoteAddr string Password []byte TCPTimeout int TCPDeadline int UDPDeadline int TCPListen *net.TCPListener Socks5Middleman plugin.Socks5Middleman HTTPMiddleman plugin.HTTPMiddleman TokenGetter plugin.TokenGetter }
Client
func NewClient ¶
func NewClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Client, error)
NewClient returns a new Client
func (*Client) HTTPHandle ¶
HTTPHandle handle http request
func (*Client) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy sm can be nil
func (*Client) ListenAndServeHTTP ¶
ListenAndServeHTTP will let client start a http proxy
func (*Client) SetHTTPMiddleman ¶
func (x *Client) SetHTTPMiddleman(m plugin.HTTPMiddleman)
SetHTTPMiddleman sets httpmiddleman plugin
func (*Client) SetSocks5Middleman ¶
func (x *Client) SetSocks5Middleman(m plugin.Socks5Middleman)
SetSocks5Middleman sets socks5middleman plugin
func (*Client) SetTokenGetter ¶
func (x *Client) SetTokenGetter(token plugin.TokenGetter)
SetToken sets token plugin
type Relay ¶
type Relay struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int // Not refreshed TCPTimeout int UDPDeadline int }
Relay is stream relay server
type SSClient ¶
type SSClient struct { Server *socks5.Server RemoteAddr string Password []byte TCPTimeout int TCPDeadline int // Not refreshed UDPDeadline int TCPListen *net.TCPListener Socks5Middleman plugin.Socks5Middleman HTTPMiddleman plugin.HTTPMiddleman }
SSClient
func NewSSClient ¶
func NewSSClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*SSClient, error)
NewSSClient returns a new SSClient
func (*SSClient) HTTPHandle ¶
HTTPHandle handle http request
func (*SSClient) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy sm can be nil
func (*SSClient) ListenAndServeHTTP ¶
ListenAndServeHTTP will let client start a http proxy m can be nil
func (*SSClient) SetHTTPMiddleman ¶
func (x *SSClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
SetHTTPMiddleman sets httpmiddleman plugin
func (*SSClient) SetSocks5Middleman ¶
func (x *SSClient) SetSocks5Middleman(m plugin.Socks5Middleman)
SetSocks5Middleman sets socks5middleman plugin
func (*SSClient) WrapCipherConn ¶
func (x *SSClient) WrapCipherConn(conn *net.TCPConn) (*CipherConn, error)
WrapChiperConn make a chiper conn
type SSServer ¶
type SSServer struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int // Not refreshed TCPTimeout int UDPDeadline int }
SSServer
func NewSSServer ¶
func NewSSServer(addr, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*SSServer, error)
NewSSServer
func (*SSServer) RunTCPServer ¶
RunTCPServer starts tcp server
func (*SSServer) RunUDPServer ¶
RunUDPServer starts udp server
func (*SSServer) WrapCipherConn ¶
func (s *SSServer) WrapCipherConn(conn net.Conn) (*CipherConn, error)
WrapChiperConn make a chiper conn
type Server ¶
type Server struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int TokenChecker plugin.TokenChecker }
Server
func (*Server) SetTokenChecker ¶
func (s *Server) SetTokenChecker(token plugin.TokenChecker)
SetToken set token plugin
type Socks5Server ¶
type Socks5Server struct { Server *socks5.Server Socks5Middleman plugin.Socks5Middleman TCPTimeout int TCPDeadline int // not refreshed UDPDeadline int UDPSessionTime int ForwardAddress string ForwardUserName string ForwardPassword string Cache *cache.Cache }
Socks5Server is the client of raw socks5 protocol
func NewSocks5Server ¶
func NewSocks5Server(addr, ip, userName, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*Socks5Server, error)
NewSocks5Server returns a new Socks5Server
func (*Socks5Server) ListenAndForward ¶
func (x *Socks5Server) ListenAndForward(addr, username, password string) error
ListenAndForward will let client start a proxy to listen and forward to another socks5, sm can be nil
func (*Socks5Server) ListenAndServe ¶
func (x *Socks5Server) ListenAndServe() error
ListenAndServe will let client start to listen and serve, sm can be nil
func (*Socks5Server) SetSocks5Middleman ¶
func (x *Socks5Server) SetSocks5Middleman(m plugin.Socks5Middleman)
SetSocks5Middleman sets socks5middleman plugin
func (*Socks5Server) Shutdown ¶
func (x *Socks5Server) Shutdown() error
Shutdown used to stop the client
type Socks5ToHTTP ¶
type Socks5ToHTTP struct { Addr *net.TCPAddr Socks5Address string Dial proxy.Dialer Timeout int Deadline int // Not refreshed Listen *net.TCPListener HTTPMiddleman plugin.HTTPMiddleman }
func NewSocks5ToHTTP ¶
func NewSocks5ToHTTP(addr, socks5addr string, timeout, deadline int) (*Socks5ToHTTP, error)
func (*Socks5ToHTTP) ListenAndServe ¶
func (s *Socks5ToHTTP) ListenAndServe() error
func (*Socks5ToHTTP) SetHTTPMiddleman ¶
func (s *Socks5ToHTTP) SetHTTPMiddleman(m plugin.HTTPMiddleman)
SetHTTPMiddleman sets httpmiddleman plugin
func (*Socks5ToHTTP) Shutdown ¶
func (s *Socks5ToHTTP) Shutdown() error
type StreamClient ¶
type StreamClient struct { Server *socks5.Server RemoteAddr string Password []byte TCPTimeout int TCPDeadline int // Not refreshed UDPDeadline int Socks5Middleman plugin.Socks5Middleman HTTPMiddleman plugin.HTTPMiddleman TCPListen *net.TCPListener }
StreamClient
func NewStreamClient ¶
func NewStreamClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*StreamClient, error)
NewStreamClient returns a new StreamClient
func (*StreamClient) Decrypt ¶
func (x *StreamClient) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
Decrypt data
func (*StreamClient) Encrypt ¶
func (x *StreamClient) Encrypt(rawdata []byte) ([]byte, error)
Encrypt data
func (*StreamClient) HTTPHandle ¶
func (x *StreamClient) HTTPHandle(c *net.TCPConn) error
HTTPHandle handle http request
func (*StreamClient) ListenAndServe ¶
func (x *StreamClient) ListenAndServe() error
ListenAndServe will let client start a socks5 proxy sm can be nil
func (*StreamClient) ListenAndServeHTTP ¶
func (x *StreamClient) ListenAndServeHTTP() error
ListenAndServeHTTP will let client start a http proxy m can be nil
func (*StreamClient) SetHTTPMiddleman ¶
func (x *StreamClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
SetHTTPMiddleman sets httpmiddleman plugin
func (*StreamClient) SetSocks5Middleman ¶
func (x *StreamClient) SetSocks5Middleman(m plugin.Socks5Middleman)
SetSocks5Middleman sets socks5middleman plugin
func (*StreamClient) Shutdown ¶
func (x *StreamClient) Shutdown() error
Shutdown used to stop the client
func (*StreamClient) WrapCipherConn ¶
func (x *StreamClient) WrapCipherConn(conn *net.TCPConn) (*CipherConn, error)
WrapChiperConn make a chiper conn
type StreamServer ¶
type StreamServer struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int // Not refreshed TCPTimeout int UDPDeadline int }
StreamServer
func NewStreamServer ¶
func NewStreamServer(addr, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*StreamServer, error)
NewStreamServer
func (*StreamServer) Decrypt ¶
func (s *StreamServer) Decrypt(cd []byte) (a byte, addr, port, data []byte, err error)
Decrypt data
func (*StreamServer) Encrypt ¶
func (s *StreamServer) Encrypt(a byte, h, p, d []byte) ([]byte, error)
Encrypt data
func (*StreamServer) RunTCPServer ¶
func (s *StreamServer) RunTCPServer() error
RunTCPServer starts tcp server
func (*StreamServer) RunUDPServer ¶
func (s *StreamServer) RunUDPServer() error
RunUDPServer starts udp server
func (*StreamServer) TCPHandle ¶
func (s *StreamServer) TCPHandle(c *net.TCPConn) error
TCPHandle handle request
func (*StreamServer) UDPHandle ¶
func (s *StreamServer) UDPHandle(addr *net.UDPAddr, b []byte) error
UDPHandle handle packet
func (*StreamServer) WrapCipherConn ¶
func (s *StreamServer) WrapCipherConn(conn net.Conn) (*CipherConn, error)
WrapChiperConn make a chiper conn
type Tproxy ¶
type Tproxy struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr Password []byte TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int TokenGetter plugin.TokenGetter }
Tproxy
func NewTproxy ¶
func NewTproxy(addr, remote, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*Tproxy, error)
NewTproxy
func (*Tproxy) SetTokenGetter ¶
func (s *Tproxy) SetTokenGetter(token plugin.TokenGetter)
SetToken set token plugin
type Tunnel ¶
type Tunnel struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr ToAddr string RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr Password []byte TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int TokenGetter plugin.TokenGetter }
Tunnel
func NewTunnel ¶
func NewTunnel(addr, to, remote, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*Tunnel, error)
NewTunnel
func (*Tunnel) SetTokenGetter ¶
func (s *Tunnel) SetTokenGetter(token plugin.TokenGetter)
SetToken set token plugin
type VPN ¶
type VPN struct { Client *Client Tunnel *Tunnel Tun *gotun2socks.Tun2Socks ServerIP string TunGateway string DefaultGateway string }
VPN