Documentation ¶
Index ¶
- Constants
- func GetServerNameFromClientHello(c net.Conn) (string, []byte)
- func HandleTrans(c *conn.Conn, s *TunnelModeServer) error
- func IsGlobalBlackIp(ipPort string) bool
- func IsWebsocketRequest(req *http.Request) bool
- func Join(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser, host *file.Host) (inCount int64, outCount int64)
- func NewHTTPError(code int, errmsg string) error
- func NewHttp(bridge *bridge.Bridge, c *file.Tunnel, httpPort, httpsPort int, useCache bool, ...) *httpServer
- func ProcessHttp(c *conn.Conn, s *TunnelModeServer) error
- func ProcessTunnel(c *conn.Conn, s *TunnelModeServer) error
- type BaseServer
- type HTTPError
- type HttpReverseProxy
- type HttpsListener
- type HttpsServer
- func (https *HttpsServer) Close() error
- func (https *HttpsServer) NewHttps(l net.Listener, certFile string, keyFile string)
- func (s *HttpsServer) NewServer(port int, scheme string) *http.Server
- func (s *HttpsServer) NewServerWithTls(port int, scheme string, l net.Listener, certFile string, keyFile string) error
- func (https *HttpsServer) Start() error
- type NetBridge
- type P2PServer
- type ReverseProxy
- type Service
- type Sock5ModeServer
- type TunnelModeServer
- type UdpModeServer
- type WebServer
Constants ¶
View Source
const SO_ORIGINAL_DST = 80
View Source
const (
UserPassAuth = uint8(2)
)
Variables ¶
This section is empty.
Functions ¶
func GetServerNameFromClientHello ¶
get server name from connection by read client hello bytes
func HandleTrans ¶
func HandleTrans(c *conn.Conn, s *TunnelModeServer) error
func IsWebsocketRequest ¶
func Join ¶
func Join(c1 io.ReadWriteCloser, c2 io.ReadWriteCloser, host *file.Host) (inCount int64, outCount int64)
func NewHTTPError ¶
Types ¶
type BaseServer ¶
BaseServer struct
func NewBaseServer ¶
func NewBaseServer(bridge *bridge.Bridge, task *file.Tunnel) *BaseServer
func (*BaseServer) CheckFlowAndConnNum ¶
func (s *BaseServer) CheckFlowAndConnNum(client *file.Client) error
check flow limit of the client ,and decrease the allow num of client
func (*BaseServer) DealClient ¶
func (s *BaseServer) DealClient(c *conn.Conn, client *file.Client, addr string, rb []byte, tp string, f func(), flow *file.Flow, localProxy bool, task *file.Tunnel) error
create a new connection and start bytes copying
func (*BaseServer) FlowAddHost ¶
func (s *BaseServer) FlowAddHost(host *file.Host, in, out int64)
change the flow
type HttpReverseProxy ¶
type HttpReverseProxy struct {
// contains filtered or unexported fields
}
func NewHttpReverseProxy ¶
func NewHttpReverseProxy(s *httpServer) *HttpReverseProxy
func (*HttpReverseProxy) ServeHTTP ¶
func (rp *HttpReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request)
type HttpsListener ¶
type HttpsListener struct {
// contains filtered or unexported fields
}
type HttpsServer ¶
type HttpsServer struct {
// contains filtered or unexported fields
}
func NewHttpsServer ¶
func (*HttpsServer) NewHttps ¶
func (https *HttpsServer) NewHttps(l net.Listener, certFile string, keyFile string)
new https server by cert and key file
func (*HttpsServer) NewServerWithTls ¶
type P2PServer ¶
type P2PServer struct { BaseServer // contains filtered or unexported fields }
func NewP2PServer ¶
type ReverseProxy ¶
type ReverseProxy struct { *httputil.ReverseProxy WebSocketDialContext func(ctx context.Context, network, addr string) (net.Conn, error) }
func NewReverseProxy ¶
func NewReverseProxy(orp *httputil.ReverseProxy) *ReverseProxy
func (*ReverseProxy) ServeHTTP ¶
func (p *ReverseProxy) ServeHTTP(rw http.ResponseWriter, req *http.Request, host *file.Host)
type Sock5ModeServer ¶
type Sock5ModeServer struct { BaseServer // contains filtered or unexported fields }
func NewSock5ModeServer ¶
func NewSock5ModeServer(bridge NetBridge, task *file.Tunnel) *Sock5ModeServer
new
type TunnelModeServer ¶
type TunnelModeServer struct { BaseServer // contains filtered or unexported fields }
func NewTunnelModeServer ¶
func NewTunnelModeServer(process process, bridge NetBridge, task *file.Tunnel) *TunnelModeServer
tcp|http|host
type UdpModeServer ¶
type UdpModeServer struct { BaseServer // contains filtered or unexported fields }
func NewUdpModeServer ¶
func NewUdpModeServer(bridge *bridge.Bridge, task *file.Tunnel) *UdpModeServer
func (*UdpModeServer) Close ¶
func (s *UdpModeServer) Close() error
Click to show internal directories.
Click to hide internal directories.