Documentation ¶
Index ¶
- Variables
- func Decrypt(p, b []byte) (a byte, addr, port, data []byte, err error)
- func DecryptLength(p, b []byte) (int, error)
- func EnableDebug()
- func Encrypt(p, b []byte) ([]byte, error)
- func EncryptLength(p, b []byte) ([]byte, error)
- func ErrorReply(r *socks5.Request, c *net.TCPConn, e error) error
- func GetAddressFromURL(s string) (string, error)
- func GetKey(p, n []byte) ([]byte, error)
- func IncrementNonce(n []byte) []byte
- func Link(server, password string) string
- func MakeSSKey(password string) []byte
- func PrepareKey(p []byte) ([]byte, []byte, error)
- func QR(server, password string)
- func ReadFrom(c net.Conn, k, n []byte, hasTime bool) ([]byte, []byte, error)
- func WriteTo(c net.Conn, d, k, n []byte, needTime bool) ([]byte, int, 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) SetClientAuthman(m plugin.ClientAuthman)
- func (x *Client) SetHTTPMiddleman(m plugin.HTTPMiddleman)
- func (x *Client) SetSocks5Middleman(m plugin.Socks5Middleman)
- 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 DNS
- type PAC
- 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) SetServerAuthman(m plugin.ServerAuthman)
- func (s *Server) Shutdown() error
- func (s *Server) TCPHandle(c *net.TCPConn) error
- func (s *Server) UDPHandle(addr *net.UDPAddr, b []byte) error
- type ServerUDPExchange
- 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 Tproxy
- func (s *Tproxy) ClearAutoScripts() error
- func (s *Tproxy) ListenAndServe() error
- func (s *Tproxy) RunAutoScripts() error
- func (s *Tproxy) RunTCPServer() error
- func (s *Tproxy) RunUDPServer() error
- 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 TproxyUDPExchange
- type Tun
- type Tunnel
- type WSClient
- func (x *WSClient) DialWebsocket() (net.Conn, error)
- func (x *WSClient) HTTPHandle(c *net.TCPConn) error
- func (x *WSClient) ListenAndServe() error
- func (x *WSClient) ListenAndServeHTTP() error
- func (x *WSClient) SetClientAuthman(m plugin.ClientAuthman)
- func (x *WSClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
- func (x *WSClient) SetSocks5Middleman(m plugin.Socks5Middleman)
- func (x *WSClient) Shutdown() error
- func (x *WSClient) TCPHandle(s *socks5.Server, c *net.TCPConn, r *socks5.Request) error
- func (x *WSClient) UDPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- type WSClientUDPExchange
- type WSServer
- func (s *WSServer) ListenAndServe() error
- func (s *WSServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *WSServer) SetServerAuthman(m plugin.ServerAuthman)
- func (s *WSServer) Shutdown() error
- func (s *WSServer) TCPHandle(c net.Conn) error
- func (s *WSServer) UDPHandle(c net.Conn) error
Constants ¶
This section is empty.
Variables ¶
var Debug bool = false
var Dial x.Dialer = x.DefaultDial
Functions ¶
func GetAddressFromURL ¶
func IncrementNonce ¶
IncrementNonce loves your compute to use Little Endian.
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) Close ¶
func (c *CipherConn) Close() error
Close is just like net.Conn interface.
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 ClientAuthman plugin.ClientAuthman Cache *cache.Cache }
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 handles http request.
func (*Client) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
func (*Client) ListenAndServeHTTP ¶
ListenAndServeHTTP will let client start a http proxy.
func (*Client) SetClientAuthman ¶
func (x *Client) SetClientAuthman(m plugin.ClientAuthman)
SetClientAuthman sets authman plugin.
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.
type DNS ¶
type DNS struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr Password []byte Domains map[string]byte DefaultDNSServer string ListDNSServer string TCPListen *net.TCPListener UDPConn *net.UDPConn Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int RunnerGroup *runnergroup.RunnerGroup }
DNS.
type PAC ¶
type PAC struct { Addr string File string // global/white/black Proxy string Mode string DomainURL string CidrURL string DomainData []byte CidrData []byte HTTPServer *http.Server Body []byte }
func (*PAC) ListenAndServe ¶
func (*PAC) WriteToFile ¶
func (*PAC) WriteToStdout ¶
type Relay ¶
type Relay struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int RunnerGroup *runnergroup.RunnerGroup }
Relay is relay server.
type SSClient ¶
type SSClient struct { Server *socks5.Server RemoteAddr string Password []byte TCPTimeout int TCPDeadline int UDPDeadline int TCPListen *net.TCPListener Socks5Middleman plugin.Socks5Middleman HTTPMiddleman plugin.HTTPMiddleman Cache *cache.Cache }
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 handles http request.
func (*SSClient) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
func (*SSClient) ListenAndServeHTTP ¶
ListenAndServeHTTP will let client start a http proxy.
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 makes a chiper conn.
type SSServer ¶
type SSServer struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int RunnerGroup *runnergroup.RunnerGroup }
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 makes a chiper conn.
type Server ¶
type Server struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int ServerAuthman plugin.ServerAuthman RunnerGroup *runnergroup.RunnerGroup }
Server.
func (*Server) SetServerAuthman ¶
func (s *Server) SetServerAuthman(m plugin.ServerAuthman)
SetServerAuthman sets authman plugin.
type ServerUDPExchange ¶
type Socks5Server ¶
type Socks5Server struct { Server *socks5.Server Socks5Middleman plugin.Socks5Middleman TCPTimeout int TCPDeadline int UDPDeadline int UDPSessionTime int ForwardAddress string ForwardUserName string ForwardPassword string Cache *cache.Cache }
Socks5Server is raw socks5 server.
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.
func (*Socks5Server) ListenAndServe ¶
func (x *Socks5Server) ListenAndServe() error
ListenAndServe will let client start to listen and serve.
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 Socks5Username string Socks5Password string Dial proxy.Dialer Timeout int Deadline int Listen *net.TCPListener HTTPMiddleman plugin.HTTPMiddleman }
func NewSocks5ToHTTP ¶
func NewSocks5ToHTTP(addr, socks5addr, socks5username, socks5password 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 Tproxy ¶
type Tproxy struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteTCPAddr *net.TCPAddr RemoteUDPAddr *net.UDPAddr Password []byte TCPListen *net.TCPListener UDPConn *net.UDPConn Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int RunnerGroup *runnergroup.RunnerGroup }
Tproxy.
func NewTproxy ¶
func NewTproxy(addr, remote, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*Tproxy, error)
NewTproxy.
func (*Tproxy) ClearAutoScripts ¶
func (*Tproxy) RunAutoScripts ¶
type TproxyUDPExchange ¶
type Tun ¶
type Tun struct { Client *Client Tunnel *Tunnel Tun *gotun2socks.Tun2Socks ServerIP string TunGateway string OriginalDNSServers []string RunnerGroup *runnergroup.RunnerGroup }
Tun.
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 Cache *cache.Cache TCPDeadline int TCPTimeout int UDPDeadline int RunnerGroup *runnergroup.RunnerGroup }
Tunnel.
func NewTunnel ¶
func NewTunnel(addr, to, remote, password string, tcpTimeout, tcpDeadline, udpDeadline int) (*Tunnel, error)
NewTunnel.
type WSClient ¶
type WSClient struct { Server *socks5.Server RemoteAddr string RemoteAddress string TLSConfig *tls.Config Password []byte TCPTimeout int TCPDeadline int UDPDeadline int TCPListen *net.TCPListener Socks5Middleman plugin.Socks5Middleman HTTPMiddleman plugin.HTTPMiddleman TLSConnCapacity chan struct{} Cache *cache.Cache ClientAuthman plugin.ClientAuthman }
WSClient.
func NewWSClient ¶
func NewWSClient(addr, ip, server, password string, tcpTimeout, tcpDeadline, udpDeadline, udpSessionTime int) (*WSClient, error)
NewWSClient.
func (*WSClient) HTTPHandle ¶
HTTPHandle handles http request.
func (*WSClient) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
func (*WSClient) ListenAndServeHTTP ¶
ListenAndServeHTTP will let client start a http proxy.
func (*WSClient) SetClientAuthman ¶
func (x *WSClient) SetClientAuthman(m plugin.ClientAuthman)
SetClientAuthman sets authman plugin.
func (*WSClient) SetHTTPMiddleman ¶
func (x *WSClient) SetHTTPMiddleman(m plugin.HTTPMiddleman)
SetHTTPMiddleman sets httpmiddleman plugin.
func (*WSClient) SetSocks5Middleman ¶
func (x *WSClient) SetSocks5Middleman(m plugin.Socks5Middleman)
SetSocks5Middleman sets socks5middleman plugin.
type WSClientUDPExchange ¶
type WSServer ¶
type WSServer struct { Password []byte Domain string TCPAddr *net.TCPAddr HTTPServer *http.Server HTTPSServer *http.Server TCPDeadline int TCPTimeout int UDPDeadline int ServerAuthman plugin.ServerAuthman }
WSServer.
func NewWSServer ¶
func NewWSServer(addr, password, domain string, tcpTimeout, tcpDeadline, udpDeadline int) (*WSServer, error)
NewWSServer.
func (*WSServer) SetServerAuthman ¶
func (s *WSServer) SetServerAuthman(m plugin.ServerAuthman)
SetServerAuthman sets authman plugin.