proxy

package
v0.26.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 1, 2020 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const SO_ORIGINAL_DST = 80
View Source
const (
	UserPassAuth = uint8(2)
)

Variables

This section is empty.

Functions

func GetServerNameFromClientHello added in v0.21.0

func GetServerNameFromClientHello(c net.Conn) (string, []byte)

get server name from connection by read client hello bytes

func HandleTrans added in v0.23.1

func HandleTrans(c *conn.Conn, s *TunnelModeServer) error

func NewHttp

func NewHttp(bridge *bridge.Bridge, c *file.Tunnel, httpPort, httpsPort int, useCache bool, cacheLen int) *httpServer

func ProcessHttp

func ProcessHttp(c *conn.Conn, s *TunnelModeServer) error

http proxy

func ProcessTunnel

func ProcessTunnel(c *conn.Conn, s *TunnelModeServer) error

tcp proxy

Types

type BaseServer added in v0.0.16

type BaseServer struct {
	sync.Mutex
	// contains filtered or unexported fields
}

BaseServer struct

func NewBaseServer added in v0.0.16

func NewBaseServer(bridge *bridge.Bridge, task *file.Tunnel) *BaseServer

func (*BaseServer) CheckFlowAndConnNum added in v0.19.0

func (s *BaseServer) CheckFlowAndConnNum(client *file.Client) error

check flow limit of the client ,and decrease the allow num of client

func (*BaseServer) DealClient added in v0.0.16

func (s *BaseServer) DealClient(c *conn.Conn, client *file.Client, addr string, rb []byte, tp string, f func(), flow *file.Flow, localProxy bool) error

create a new connection and start bytes copying

func (*BaseServer) FlowAdd added in v0.0.16

func (s *BaseServer) FlowAdd(in, out int64)

add the flow

func (*BaseServer) FlowAddHost added in v0.0.16

func (s *BaseServer) FlowAddHost(host *file.Host, in, out int64)

change the flow

type HttpsListener added in v0.21.0

type HttpsListener struct {
	// contains filtered or unexported fields
}

func NewHttpsListener added in v0.21.0

func NewHttpsListener(l net.Listener) *HttpsListener

https listener

func (*HttpsListener) Accept added in v0.21.0

func (httpsListener *HttpsListener) Accept() (net.Conn, error)

accept

func (*HttpsListener) Addr added in v0.21.0

func (httpsListener *HttpsListener) Addr() net.Addr

addr

func (*HttpsListener) Close added in v0.21.0

func (httpsListener *HttpsListener) Close() error

close

type HttpsServer added in v0.21.0

type HttpsServer struct {
	// contains filtered or unexported fields
}

func NewHttpsServer added in v0.21.0

func NewHttpsServer(l net.Listener, bridge NetBridge, useCache bool, cacheLen int) *HttpsServer

func (*HttpsServer) Close added in v0.21.0

func (https *HttpsServer) Close() error

close

func (*HttpsServer) NewHttps added in v0.21.0

func (https *HttpsServer) NewHttps(l net.Listener, certFile string, keyFile string)

new https server by cert and key file

func (*HttpsServer) NewServer added in v0.21.0

func (s *HttpsServer) NewServer(port int, scheme string) *http.Server

func (*HttpsServer) Start added in v0.21.0

func (https *HttpsServer) Start() error

start https server

type NetBridge added in v0.23.0

type NetBridge interface {
	SendLinkInfo(clientId int, link *conn.Link, t *file.Tunnel) (target net.Conn, err error)
}

type P2PServer added in v0.18.0

type P2PServer struct {
	BaseServer
	// contains filtered or unexported fields
}

func NewP2PServer added in v0.18.0

func NewP2PServer(p2pPort int) *P2PServer

func (*P2PServer) Start added in v0.18.0

func (s *P2PServer) Start() error

type Service added in v0.0.16

type Service interface {
	Start() error
	Close() error
}

type Sock5ModeServer

type Sock5ModeServer struct {
	BaseServer
	// contains filtered or unexported fields
}

func NewSock5ModeServer

func NewSock5ModeServer(bridge NetBridge, task *file.Tunnel) *Sock5ModeServer

new

func (*Sock5ModeServer) Auth

func (s *Sock5ModeServer) Auth(c net.Conn) error

socks5 auth

func (*Sock5ModeServer) Close

func (s *Sock5ModeServer) Close() error

close

func (*Sock5ModeServer) Start

func (s *Sock5ModeServer) Start() error

start

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

func (*TunnelModeServer) Close

func (s *TunnelModeServer) Close() error

close

func (*TunnelModeServer) Start

func (s *TunnelModeServer) Start() error

开始

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

func (*UdpModeServer) Start

func (s *UdpModeServer) Start() error

开始

type WebServer

type WebServer struct {
	BaseServer
}

web管理方式

func NewWebServer

func NewWebServer(bridge *bridge.Bridge) *WebServer

new

func (*WebServer) Close added in v0.0.16

func (s *WebServer) Close() error

func (*WebServer) Start

func (s *WebServer) Start() error

开始

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL