Documentation ¶
Index ¶
- Variables
- func EnableDebug()
- func ErrorReply(r *socks5.Request, c *net.TCPConn, e error) error
- func GetAddressFromURL(s string) (string, error)
- func Link(server, password, username string) string
- func NextNonce(b []byte)
- func QR(server, password, username string)
- func WaitReadErr(conn net.Conn)
- type Client
- type DNS
- type HijackHTTPS
- func (s *HijackHTTPS) DNSHandle(network string) dns.Handler
- func (s *HijackHTTPS) HTTPSHandle(c net.Conn) error
- func (s *HijackHTTPS) Has(host string) bool
- func (s *HijackHTTPS) ListenAndServe() error
- func (s *HijackHTTPS) RunHTTPSServer() error
- func (s *HijackHTTPS) RunTCPDNSServer() error
- func (s *HijackHTTPS) RunUDPDNSServer() error
- func (s *HijackHTTPS) Shutdown() error
- type Map
- type PAC
- type PacketClient
- func (c *PacketClient) Clean()
- func (c *PacketClient) LocalToServer(dst, d []byte, server net.Conn, timeout int) error
- func (c *PacketClient) RunServerToLocal(server net.Conn, timeout int, tolocal func(dst, d []byte) (int, error)) error
- func (c *PacketClient) ServerToLocal(server net.Conn, timeout int, tolocal func(dst, d []byte) (int, error)) error
- type PacketServer
- type PacketStream
- func (c *PacketStream) Close() error
- func (c *PacketStream) LocalAddr() net.Addr
- func (c *PacketStream) Read(b []byte) (int, error)
- func (c *PacketStream) RemoteAddr() net.Addr
- func (c *PacketStream) SetDeadline(t time.Time) error
- func (c *PacketStream) SetReadDeadline(t time.Time) error
- func (c *PacketStream) SetWriteDeadline(t time.Time) error
- func (c *PacketStream) Write(b []byte) (int, error)
- type Relay
- type Server
- type Socks5Server
- type Socks5ToHTTP
- type StreamClient
- type StreamServer
- 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 UDPExchange
- type WSClient
- func (x *WSClient) DialWebsocket(src string) (net.Conn, error)
- func (x *WSClient) ListenAndServe() error
- 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 WSServer
- type WriteFunc
- type WriterFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ClientPacket func([]byte, []byte) ([]byte, []byte, error) = func(dst, d []byte) ([]byte, []byte, error) { if 12+4+len(dst)+len(d)+16 > 65507 { return nil, nil, errors.New("packet too big") } return dst, d, nil }
View Source
var Debug bool = false
View Source
var Dial x.Dialer = x.DefaultDial
View Source
var ServerPacket func([]byte, []byte) ([]byte, []byte, WriterFunc, error) = func(dst, b []byte) ([]byte, []byte, WriterFunc, error) { f := func(f func([]byte) (int, error)) io.Writer { return WriteFunc(f) } return dst, b, f, nil }
View Source
var StreamClientInit func(*StreamClient) (*StreamClient, error) = func(c *StreamClient) (*StreamClient, error) { if c.Timeout != 0 { if err := c.Server.SetDeadline(time.Now().Add(time.Duration(c.Timeout) * time.Second)); err != nil { c.Clean() return nil, err } } return c, nil }
View Source
var StreamServerInit func(*StreamServer, int) (*StreamServer, []byte, error) = func(s *StreamServer, l int) (*StreamServer, []byte, error) { if s.Timeout != 0 { if err := s.Client.SetDeadline(time.Now().Add(time.Duration(s.Timeout) * time.Second)); err != nil { s.Clean() return nil, nil, err } } s.ConnFunc = func(conn net.Conn) net.Conn { if s.Timeout != 0 { conn.SetDeadline(time.Now().Add(time.Duration(s.Timeout) * time.Second)) } return conn } return s, s.RB[2+16+4 : 2+16+l], nil }
Functions ¶
func GetAddressFromURL ¶
func WaitReadErr ¶
Types ¶
type Client ¶
type Client struct { Server *socks5.Server ServerAddress string Password []byte TCPTimeout int UDPTimeout int }
Client.
func (*Client) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
type DNS ¶
type DNS struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr ServerTCPAddr *net.TCPAddr ServerUDPAddr *net.UDPAddr Password []byte BypassDomains map[string]byte DNSServer string DNSServerForBypass string TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup UDPSrc *cache.Cache }
DNS.
type HijackHTTPS ¶
type HijackHTTPS struct { Dial proxy.Dialer ListenIP string DNSServerForBypass string BypassDomains map[string]byte UDPDNSServer *dns.Server TCPDNSServer *dns.Server HTTPSServer net.Listener TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup }
HijackHTTPS.
func NewHijackHTTPS ¶
func NewHijackHTTPS(socks5addr, socks5username, socks5password, listenIP, dnsForBypass, bypassList string, tcpTimeout, udpTimeout int) (*HijackHTTPS, error)
NewHijackHTTPS.
func (*HijackHTTPS) HTTPSHandle ¶
func (s *HijackHTTPS) HTTPSHandle(c net.Conn) error
func (*HijackHTTPS) Has ¶
func (s *HijackHTTPS) Has(host string) bool
func (*HijackHTTPS) RunHTTPSServer ¶
func (s *HijackHTTPS) RunHTTPSServer() error
func (*HijackHTTPS) RunTCPDNSServer ¶
func (s *HijackHTTPS) RunTCPDNSServer() error
func (*HijackHTTPS) RunUDPDNSServer ¶
func (s *HijackHTTPS) RunUDPDNSServer() error
func (*HijackHTTPS) Shutdown ¶
func (s *HijackHTTPS) Shutdown() error
type Map ¶
type Map struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr RemoteAddress string ServerTCPAddr *net.TCPAddr ServerUDPAddr *net.UDPAddr Password []byte TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup UDPSrc *cache.Cache }
Map.
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 PacketClient ¶
type PacketClient struct { Server net.Conn Password []byte RB []byte WB []byte Dst []byte Timeout int RemoteAddress net.Addr }
func NewPacketClient ¶
func NewPacketClient(password []byte) *PacketClient
func (*PacketClient) Clean ¶
func (c *PacketClient) Clean()
func (*PacketClient) LocalToServer ¶
func (*PacketClient) RunServerToLocal ¶
func (*PacketClient) ServerToLocal ¶
type PacketServer ¶
type PacketServer struct {
// contains filtered or unexported fields
}
func NewPacketServer ¶
func NewPacketServer(password []byte) *PacketServer
func (*PacketServer) Clean ¶
func (s *PacketServer) Clean()
func (*PacketServer) RemoteToClient ¶
type PacketStream ¶
type PacketStream struct {
// contains filtered or unexported fields
}
func NewPacketStream ¶
func (*PacketStream) Close ¶
func (c *PacketStream) Close() error
func (*PacketStream) LocalAddr ¶
func (c *PacketStream) LocalAddr() net.Addr
func (*PacketStream) RemoteAddr ¶
func (c *PacketStream) RemoteAddr() net.Addr
func (*PacketStream) SetDeadline ¶
func (c *PacketStream) SetDeadline(t time.Time) error
func (*PacketStream) SetReadDeadline ¶
func (c *PacketStream) SetReadDeadline(t time.Time) error
func (*PacketStream) SetWriteDeadline ¶
func (c *PacketStream) SetWriteDeadline(t time.Time) error
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 TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup UDPSrc *cache.Cache }
Relay is relay server.
type Server ¶
type Server struct { Password []byte TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup UDPSrc *cache.Cache }
Server.
type Socks5Server ¶
Socks5Server is raw socks5 server.
func NewSocks5Server ¶
func NewSocks5Server(addr, ip, userName, password string, tcpTimeout, udpTimeout int) (*Socks5Server, error)
NewSocks5Server returns a new Socks5Server.
func (*Socks5Server) ListenAndServe ¶
func (x *Socks5Server) ListenAndServe() error
ListenAndServe will let client start to listen and serve.
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 TCPTimeout int Listen *net.TCPListener }
func NewSocks5ToHTTP ¶
func NewSocks5ToHTTP(addr, socks5addr, socks5username, socks5password string, tcpTimeout int) (*Socks5ToHTTP, error)
func (*Socks5ToHTTP) ListenAndServe ¶
func (s *Socks5ToHTTP) ListenAndServe() error
func (*Socks5ToHTTP) Shutdown ¶
func (s *Socks5ToHTTP) Shutdown() error
type StreamClient ¶
type StreamClient struct { Server net.Conn RB []byte WB []byte Timeout int Network string RemoteAddress net.Addr Cache []byte // contains filtered or unexported fields }
func NewStreamClient ¶
func (*StreamClient) Clean ¶
func (c *StreamClient) Clean()
func (*StreamClient) ReadL ¶
func (c *StreamClient) ReadL() (int, error)
func (*StreamClient) WriteL ¶
func (c *StreamClient) WriteL(l int) error
type StreamServer ¶
type StreamServer struct { Client net.Conn RB []byte WB []byte Timeout int Network string ConnFunc func(net.Conn) net.Conn // contains filtered or unexported fields }
func NewStreamServer ¶
func (*StreamServer) Clean ¶
func (s *StreamServer) Clean()
func (*StreamServer) Read ¶
func (s *StreamServer) Read() (int, error)
func (*StreamServer) Write ¶
func (s *StreamServer) Write(l int) error
type Tproxy ¶
type Tproxy struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr ServerTCPAddr *net.TCPAddr ServerUDPAddr *net.UDPAddr Password []byte TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache UDPSrc *cache.Cache TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup }
Tproxy.
func (*Tproxy) ClearAutoScripts ¶
func (*Tproxy) RunAutoScripts ¶
type UDPExchange ¶
type WSClient ¶
type WSClient struct { Server *socks5.Server ServerHost string ServerAddress string TLSConfig *tls.Config Password []byte TCPTimeout int UDPTimeout int TCPListen *net.TCPListener Path string UDPExchanges *cache.Cache }
WSClient.
func NewWSClient ¶
NewWSClient.
func (*WSClient) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
type WSServer ¶
type WSServer struct { Password []byte Domain string TCPAddr *net.TCPAddr HTTPServer *http.Server HTTPSServer *http.Server TCPTimeout int UDPTimeout int Path string UDPSrc *cache.Cache }
WSServer.
func NewWSServer ¶
func NewWSServer(addr, password, domain, path string, tcpTimeout, udpTimeout int) (*WSServer, error)
NewWSServer.
type WriterFunc ¶
func PacketClientToRemote ¶
func PacketClientToRemote(p, b []byte) ([]byte, []byte, WriterFunc, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.