tun2socks

package
v0.0.0-...-f3e0d18 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// simplified server-side tcp states
	CLOSED      tcpState = 0x0
	SYN_RCVD    tcpState = 0x1
	ESTABLISHED tcpState = 0x2
	FIN_WAIT_1  tcpState = 0x3
	FIN_WAIT_2  tcpState = 0x4
	CLOSING     tcpState = 0x5
	LAST_ACK    tcpState = 0x6
	TIME_WAIT   tcpState = 0x7

	MAX_RECV_WINDOW int = 65535
	MAX_SEND_WINDOW int = 65535

	CONNECT_NOT_SENT    = -1
	CONNECT_SENT        = 0
	CONNECT_ESTABLISHED = 1

	TIMEOUT    = 10 * time.Second
	ACTTIMEOUT = 10 * time.Millisecond
)
View Source
const (
	MTU = 10240

	PROXY_TYPE_NONE        = 0
	PROXY_TYPE_SOCKS       = 1
	PROXY_TYPE_HTTP        = 2
	PROXY_TYPE_TRANSPARENT = 3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ProxyServer

type ProxyServer struct {
	ProxyType  int
	IpAddress  string
	AuthHeader string
	Login      string
	Password   string
}

type Tun2Socks

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

func New

func New(dev io.ReadWriteCloser, dnsServerIp4, dnsServerIp6 net.IP, dnsServerPort uint16) *Tun2Socks

func (*Tun2Socks) FindAppUid

func (t2s *Tun2Socks) FindAppUid(sourceIp string, sourcePort uint16, destIp string, destPort uint16) int

func (*Tun2Socks) Run

func (t2s *Tun2Socks) Run()

func (*Tun2Socks) SetDefaultProxy

func (t2s *Tun2Socks) SetDefaultProxy(proxy *ProxyServer)

func (*Tun2Socks) SetProxyServers

func (t2s *Tun2Socks) SetProxyServers(proxyServerMap map[int]*ProxyServer)

func (*Tun2Socks) SetUidCallback

func (t2s *Tun2Socks) SetUidCallback(uidCallback UidCallback)

func (*Tun2Socks) Stop

func (t2s *Tun2Socks) Stop()

func (*Tun2Socks) Stopped

func (t2s *Tun2Socks) Stopped() bool

type UidCallback

type UidCallback interface {
	GetUid(sourceIp string, sourcePort uint16, destIp string, destPort uint16) int
}

Jump to

Keyboard shortcuts

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