proxy

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

客户端本地代理处理逻辑

Index

Constants

View Source
const (
	UdpReadBufferSize  = 32 * 1024
	UdpWriteBufferSize = 32 * 1024
	TcpReadBufferSize  = 32 * 1024
	TcpWriteBufferSize = 32 * 1024

	PacketBufSize   = 1024 * 16
	MemPoolNodeSize = 1600
)
View Source
const (
	ProxyHttpName = "surpass"
)

Variables

This section is empty.

Functions

func CloseHttpProxy

func CloseHttpProxy()

func CreateNtcpTcp

func CreateNtcpTcp(dstAddr string, area uint8) (net.Conn, error)

创建ntcp tcp代理客户端

func CreateNtcpTdpBind

func CreateNtcpTdpBind(area uint8) (ntcp.BindConn, error)

创建ntcp udp bind模式代理客户端 在tcp基础上代理数据

func CreateNtcpUdp

func CreateNtcpUdp(dstAddr string, area uint8) (net.Conn, error)

创建ntcp udp代理客户端

func CreateNtcpUdpBind

func CreateNtcpUdpBind(area uint8) (ntcp.BindConn, error)

创建ntcp udp bind模式代理客户端

func CreateNtcpUdpOverTdp

func CreateNtcpUdpOverTdp(dstAddr string, area uint8) (net.Conn, error)

创建ntcp udp代理客户端

func ListenHttpProxy

func ListenHttpProxy(addr string) error

func NtcpAutoReconnecCallBack

func NtcpAutoReconnecCallBack(session *ntcp.NtcpSession)

ntcp session 异常中断回调

func RunNtcpServer

func RunNtcpServer() error

启动ntcp服务 函数会阻塞

func RunNtcpSession

func RunNtcpSession(servAddr, user, password string,
	cryptoMethod crypto.CryptoType,
	sessionDeadCB ntcp.NtcpSessionDead) error

创建ntcp session,客户端或者ntcp中间代理服务需要使用

Types

type BindConn

type BindConn interface {
	Read(b []byte) (n int, err error)
	ReadFromBind(b []byte) (n int, addr net.Addr, err error)
	WriteToFromBind(b []byte, from net.Addr) (n int, err error)
	Close() error
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

type DriverProxyHeader

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

type NtcpMemer

type NtcpMemer struct {
}

func (*NtcpMemer) Create

func (nm *NtcpMemer) Create(ctx context.Context) ntcp.MemAllocation

type NtcpMempool

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

func NewMemer

func NewMemer() *NtcpMempool

func (*NtcpMempool) Alloc

func (m *NtcpMempool) Alloc(ctx context.Context, size int) []byte

func (*NtcpMempool) Free

func (m *NtcpMempool) Free(ctx context.Context, bs []byte)

type ProxyLocal

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

func ProxyLocalInstance

func ProxyLocalInstance() *ProxyLocal

func (*ProxyLocal) AcceptIcmp

func (pl *ProxyLocal) AcceptIcmp(src net.Conn, from net.Addr, to net.Addr) bool

func (*ProxyLocal) AcceptIp

func (pl *ProxyLocal) AcceptIp(src net.Conn, from net.Addr, to net.Addr) bool

func (*ProxyLocal) AcceptTcp

func (pl *ProxyLocal) AcceptTcp(src net.Conn, from net.Addr, to net.Addr) bool

func (*ProxyLocal) AcceptUdp

func (pl *ProxyLocal) AcceptUdp(src net.Conn, from net.Addr, to net.Addr) bool

func (*ProxyLocal) DnsPair

func (pl *ProxyLocal) DnsPair(domain, ip string)

func (*ProxyLocal) IsStunIp

func (pl *ProxyLocal) IsStunIp(ip string) bool

func (*ProxyLocal) ParseStunHost

func (pl *ProxyLocal) ParseStunHost()

func (*ProxyLocal) SetStunHost

func (pl *ProxyLocal) SetStunHost(host string)

func (*ProxyLocal) SetUdpOverTcp

func (pl *ProxyLocal) SetUdpOverTcp(value bool)

Jump to

Keyboard shortcuts

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