Documentation
¶
Index ¶
- Variables
- func BlockAddress(address string, ds map[string]byte, c4, c6 []*net.IPNet, c *cache.Cache, ...) bool
- func EnableDebug()
- func ErrorReply(r *socks5.Request, c *net.TCPConn, e error) error
- func GetAddressFromURL(s string) (string, error)
- func Link(kind, s, username, password string) string
- func LinkExtra(kind, s, username, password string, v url.Values) string
- func ListHasDomain(ds map[string]byte, domain string, c *cache.Cache) bool
- func ListHasIP(c4, c6 []*net.IPNet, i net.IP, c *cache.Cache, geo []string) bool
- func NextNonce(b []byte)
- func ParseLink(link string) (kind, s, username, password string, err error)
- func ParseLinkExtra(link string) (kind, s, username, password string, v url.Values, err error)
- func QR(kind, s, username, password string)
- func ReadCIDRList(url string) ([]*net.IPNet, error)
- func ReadData(url string) ([]byte, error)
- func ReadDomainList(url string) (map[string]byte, error)
- func ReadList(url string) ([]string, error)
- func Resolve4(host string) (string, error)
- func Resolve6(host string) (string, error)
- func Socks5Test(s, u, p, domain, a, ds string) error
- func WaitReadErr(conn net.Conn)
- type Client
- func (x *Client) ListenAndServe() error
- 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
- func (x *Client) UDPOverTCPHandle(s *socks5.Server, addr *net.UDPAddr, d *socks5.Datagram) error
- type CreekManager
- func (cm *CreekManager) AddRelay(w http.ResponseWriter, r *http.Request)
- func (cm *CreekManager) AddWSServer(w http.ResponseWriter, r *http.Request)
- func (cm *CreekManager) NewCreekManager(port int) (*CreekManager, error)
- func (cm *CreekManager) NewMap(rj *RelayJSON) (*Map, error)
- func (cm *CreekManager) NewWSServer(wsj *WSServerJSON) (*WSServer, error)
- type DNS
- type DNSServer
- type Exchanger
- type Firewall
- func (f *Firewall) Block(ip ...IP)
- func (f *Firewall) BlockIPList(w http.ResponseWriter, r *http.Request)
- func (f *Firewall) ChangeConfig(w http.ResponseWriter, r *http.Request)
- func (f *Firewall) IsBlocked(ip string) bool
- func (f *Firewall) IsConnected(ip string) bool
- func (f *Firewall) ServeBlockedIPs(w http.ResponseWriter, r *http.Request)
- func (f *Firewall) ServeConfig(w http.ResponseWriter, r *http.Request)
- func (f *Firewall) ServeConnectedIPs(w http.ResponseWriter, r *http.Request)
- func (f *Firewall) Unblock(ip string)
- func (f *Firewall) Verify(ip string) bool
- type IP
- type IPList
- type Job
- 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 RelayJSON
- type Server
- func (s *Server) ListenAndServe() error
- func (s *Server) RunTCPServer() error
- func (s *Server) RunUDPServer() error
- func (s *Server) Shutdown() error
- func (s *Server) TCPHandle(ss Exchanger, dst []byte) error
- func (s *Server) UDPHandle(addr *net.UDPAddr, b []byte) error
- func (s *Server) UDPOverTCPHandle(ss Exchanger, src string, dstb []byte) error
- type SimpleStreamClient
- type SimpleStreamServer
- type Socks5Dial1
- 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 WSServerJSON
- type WriteFunc
- type WriterFunc
Constants ¶
This section is empty.
Variables ¶
var Debug bool = false
var Dial x.Dialer = x.DefaultDial
var Dial1 x.Dialer1
Functions ¶
func BlockAddress ¶
func GetAddressFromURL ¶
func ParseLinkExtra ¶
func Socks5Test ¶
func WaitReadErr ¶
Types ¶
type Client ¶
type Client struct { Server *socks5.Server ServerAddress string Password []byte TCPTimeout int UDPTimeout int UDPOverTCP bool }
Client.
func (*Client) ListenAndServe ¶
ListenAndServe will let client start a socks5 proxy.
type CreekManager ¶
type CreekManager struct { WSServers []WSServerJSON Relays []RelayJSON Port int }
func (*CreekManager) AddRelay ¶
func (cm *CreekManager) AddRelay(w http.ResponseWriter, r *http.Request)
func (*CreekManager) AddWSServer ¶
func (cm *CreekManager) AddWSServer(w http.ResponseWriter, r *http.Request)
func (*CreekManager) NewCreekManager ¶
func (cm *CreekManager) NewCreekManager(port int) (*CreekManager, error)
func (*CreekManager) NewWSServer ¶
func (cm *CreekManager) NewWSServer(wsj *WSServerJSON) (*WSServer, error)
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 WSClient *WSClient BlockDomain map[string]byte BypassCache *cache.Cache BlockCache *cache.Cache UDPOverTCP bool }
DNS.
type DNSServer ¶
type DNSServer struct { TCPAddr *net.TCPAddr UDPAddr *net.UDPAddr DNS string DisableIPv4Domain map[string]byte DisableIPv6Domain map[string]byte BlockDomain map[string]byte BlockGeo []string DisableIPv4Cache *cache.Cache DisableIPv6Cache *cache.Cache BlockCache *cache.Cache TCPListen *net.TCPListener UDPConn *net.UDPConn UDPExchanges *cache.Cache UDPSrc *cache.Cache TCPTimeout int UDPTimeout int RunnerGroup *runnergroup.RunnerGroup }
func NewDNSServer ¶
func NewDNSServer(addr, dns, disableIPv4DomainList, disableIPv6DomainList, blockDomainList string, blockGeo []string, tcpTimeout, udpTimeout int) (*DNSServer, error)
NewDNS.
func (*DNSServer) RunTCPServer ¶
RunTCPServer starts tcp server.
func (*DNSServer) RunUDPServer ¶
RunUDPServer starts udp server.
type Exchanger ¶
type Firewall ¶
type Firewall struct { MaxConnections int BlockPeriod int64 ConnectionCooldown int64 // contains filtered or unexported fields }
func NewFirewall ¶
func (*Firewall) BlockIPList ¶
func (f *Firewall) BlockIPList(w http.ResponseWriter, r *http.Request)
func (*Firewall) ChangeConfig ¶
func (f *Firewall) ChangeConfig(w http.ResponseWriter, r *http.Request)
func (*Firewall) IsConnected ¶
func (*Firewall) ServeBlockedIPs ¶
func (f *Firewall) ServeBlockedIPs(w http.ResponseWriter, r *http.Request)
func (*Firewall) ServeConfig ¶
func (f *Firewall) ServeConfig(w http.ResponseWriter, r *http.Request)
func (*Firewall) ServeConnectedIPs ¶
func (f *Firewall) ServeConnectedIPs(w http.ResponseWriter, r *http.Request)
type IP ¶
type Job ¶
type Job struct { JobChan chan func() PingChan chan string Quit chan struct{} Started bool // contains filtered or unexported fields }
func NewJobWithArgument ¶
func (*Job) Start ¶
Uses a string channel to get pinged and executes the job function given in the constructor
func (*Job) StartWithArgument ¶
Uses a string channel to get strings and executes the job function given in the constructor with the string value in the channel
func (*Job) StartWithChannel ¶
Uses a func channel as the job channel and does not use the job function given in the constructor
func (*Job) StartWithTicker ¶
Uses a ticker as the job channel based on the interval
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 WSClient *WSClient UDPOverTCP bool }
Map.
type PAC ¶
type PAC struct { Addr string File string Proxy string DomainURL string DomainData []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 Remote string 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 BlockDomain map[string]byte BlockCIDR4 []*net.IPNet BlockCIDR6 []*net.IPNet BlockGeoIP []string BlockCache *cache.Cache BlockLock *sync.RWMutex Done chan byte Dial func(network, laddr, raddr string) (net.Conn, error) }
Server.
func NewServer ¶
func NewServer(addr, password string, tcpTimeout, udpTimeout int, blockDomainList, blockCIDR4List, blockCIDR6List string, updateListInterval int64, blockGeoIP []string) (*Server, error)
NewServer.
type SimpleStreamClient ¶
func NewSimpleStreamClient ¶
func (*SimpleStreamClient) Clean ¶
func (s *SimpleStreamClient) Clean()
func (*SimpleStreamClient) NetworkName ¶
func (s *SimpleStreamClient) NetworkName() string
func (*SimpleStreamClient) SetTimeout ¶
func (s *SimpleStreamClient) SetTimeout(i int)
type SimpleStreamServer ¶
func NewSimpleStreamServer ¶
func (*SimpleStreamServer) Clean ¶
func (s *SimpleStreamServer) Clean()
func (*SimpleStreamServer) NetworkName ¶
func (s *SimpleStreamServer) NetworkName() string
func (*SimpleStreamServer) SetTimeout ¶
func (s *SimpleStreamServer) SetTimeout(i int)
type Socks5Dial1 ¶
func NewSocks5Dial1 ¶
func NewSocks5Dial1(server, username, password string, tcpTimeout, udpTimeout int) (*Socks5Dial1, error)
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) NetworkName ¶
func (s *StreamClient) NetworkName() string
func (*StreamClient) ReadL ¶
func (c *StreamClient) ReadL() (int, error)
func (*StreamClient) SetTimeout ¶
func (s *StreamClient) SetTimeout(i int)
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 // contains filtered or unexported fields }
func NewStreamServer ¶
func (*StreamServer) Clean ¶
func (s *StreamServer) Clean()
func (*StreamServer) NetworkName ¶
func (s *StreamServer) NetworkName() string
func (*StreamServer) Read ¶
func (s *StreamServer) Read() (int, error)
func (*StreamServer) SetTimeout ¶
func (s *StreamServer) SetTimeout(i int)
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 EnableIPv6 bool Cidr4 []*net.IPNet Cidr6 []*net.IPNet BypassCache *cache.Cache WSClient *WSClient UDPOverTCP bool }
Tproxy.
func NewTproxy ¶
func NewTproxy(addr, s, password string, enableIPv6 bool, cidr4url, cidr6url string, tcpTimeout, udpTimeout int, address string, insecure, withoutbrook bool, roots *x509.CertPool, udpovertcp bool) (*Tproxy, error)
NewTproxy.
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 WithoutBrook bool PasswordSha256 []byte }
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 Firewall *Firewall TCPTimeout int UDPTimeout int Path string UDPSrc *cache.Cache BlockDomain map[string]byte BlockCIDR4 []*net.IPNet BlockCIDR6 []*net.IPNet BlockGeoIP []string BlockCache *cache.Cache BlockLock *sync.RWMutex Done chan byte WSSServerPort int64 Cert []byte CertKey []byte WithoutBrook bool PasswordSha256 []byte Dial func(network, laddr, raddr string) (net.Conn, error) }
WSServer.
func NewWSServer ¶
func NewWSServer(addr, password, domain, path string, tcpTimeout, udpTimeout int, blockDomainList, blockCIDR4List, blockCIDR6List string, updateListInterval int64, blockGeoIP []string, maxClients int, connectionCooldown int, blockTimeout int) (*WSServer, error)
NewWSServer.
type WSServerJSON ¶
type WSServerJSON struct { Addr string `json:"addr"` Password string `json:"password"` Domain string `json:"domain"` Path string `json:"path"` TCPTimeout int `json:"tcp_timeout"` UDPTimeout int `json:"udp_timeout"` BlockDomainList string `json:"block_domain_list"` BlockCIDR4List string `json:"block_cidr4_list"` BlockCIDR6List string `json:"block_cidr6_list"` UpdateListInterval int64 `json:"update_list_interval"` BlockGeoIP []string `json:"block_geoip"` MaxClients int `json:"max_clients"` ConnectionCooldown int `json:"connection_cooldown"` BlockTimeout int `json:"block_timeout"` Object *WSServer }
type WriterFunc ¶
func PacketClientToRemote ¶
func PacketClientToRemote(p, b []byte) ([]byte, []byte, WriterFunc, error)
Source Files
¶
- client.go
- creekmanager.go
- dns.go
- dnsserver.go
- exchanger.go
- firewall.go
- firewallserver.go
- init.go
- job.go
- link.go
- list.go
- map.go
- nonce.go
- pac.go
- packetclient.go
- packetserver.go
- packetstream.go
- relay.go
- resolve.go
- server.go
- simplestreamclient.go
- simplestreamserver.go
- socks5.go
- socks5dial1.go
- socks5test.go
- socks5tohttp.go
- streamclient.go
- streamserver.go
- tproxy_linux.go
- util.go
- waitreaderr.go
- wsclient.go
- wsserver.go