proxy

package
v0.26.39 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2025 License: GPL-3.0 Imports: 31 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func HandleTrans

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

func IsGlobalBlackIp

func IsGlobalBlackIp(ipPort string) bool

判断访问地址是否在全局黑名单内

func NewHttp

func NewHttp(bridge *bridge.Bridge, task *file.Tunnel, httpPort, httpsPort int, httpOnlyPass string, addOrigin bool) *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

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

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, proxyProtocol int, localProxy bool, task *file.Tunnel) error

处理客户端连接

func (*BaseServer) FlowAdd

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

add the flow

func (*BaseServer) FlowAddHost

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

change the flow

type HttpsEntry

type HttpsEntry struct {
	Listener    *HttpsListener
	CertContent string
	KeyContent  string
}

type HttpsListener

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

HttpsListener wraps a parent listener.

func NewHttpsListener

func NewHttpsListener(l net.Listener) *HttpsListener

func (*HttpsListener) Accept

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

func (*HttpsListener) Addr

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

func (*HttpsListener) Close

func (httpsListener *HttpsListener) Close() error

type HttpsServer

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

func NewHttpsServer

func NewHttpsServer(l net.Listener, bridge NetBridge, task *file.Tunnel) *HttpsServer

func (*HttpsServer) Close

func (https *HttpsServer) Close() error

func (*HttpsServer) NewHttps

func (https *HttpsServer) NewHttps(l net.Listener, certText string, keyText string)

func (*HttpsServer) NewServer

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

func (*HttpsServer) Start

func (https *HttpsServer) Start() error

type NetBridge

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

type P2PServer

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

func NewP2PServer

func NewP2PServer(p2pPort int) *P2PServer

func (*P2PServer) Start

func (s *P2PServer) Start() error

type Service

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

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