Documentation ¶
Index ¶
- Constants
- Variables
- func GvisorTCPListener(addr string) (net.Listener, error)
- func GvisorUDPListener(addr string) (net.Listener, error)
- func NewStack(ctx context.Context, tun stack.LinkEndpoint) *stack.Stack
- func NewTunEndpoint(ctx context.Context, tun net.Conn, mtu uint32, engine config.Engine, ...) stack.LinkEndpoint
- func ParseProxyInfo(conn net.Conn) (id stack.TransportEndpointID, err error)
- func TCPForwarder(s *stack.Stack) func(stack.TransportEndpointID, *stack.PacketBuffer) bool
- func TCPListener(addr string) (net.Listener, error)
- func UDPForwarder(s *stack.Stack) func(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool
- func WriteProxyInfo(conn net.Conn, id stack.TransportEndpointID) error
- type Chain
- type Client
- type ClientDevice
- type Connector
- type DataElem
- type Device
- type Handler
- type NAT
- type Node
- type Peer
- type Route
- type Server
- type TCPUDPacket
- type Transporter
Constants ¶
View Source
const ( MaxSize = 1000 MaxThread = 10 MaxConn = 1 )
Variables ¶
View Source
var ( // RouteNAT Globe route table for inner ip RouteNAT = NewNAT() // RouteConnNAT map[srcIP]net.Conn RouteConnNAT = &sync.Map{} // Chan tcp connects Chan = make(chan *datagramPacket, MaxSize) )
View Source
var ( // ErrorEmptyChain is an error that implies the chain is empty. ErrorEmptyChain = errors.New("empty chain") )
View Source
var (
ErrorInvalidNode = errors.New("invalid node")
)
View Source
var GvisorTCPForwardAddr string
View Source
var GvisorUDPForwardAddr string
Functions ¶
func NewTunEndpoint ¶
func ParseProxyInfo ¶
func ParseProxyInfo(conn net.Conn) (id stack.TransportEndpointID, err error)
ParseProxyInfo parse proxy info [20]byte
func TCPForwarder ¶
func TCPForwarder(s *stack.Stack) func(stack.TransportEndpointID, *stack.PacketBuffer) bool
func UDPForwarder ¶
func UDPForwarder(s *stack.Stack) func(id stack.TransportEndpointID, pkt *stack.PacketBuffer) bool
func WriteProxyInfo ¶
func WriteProxyInfo(conn net.Conn, id stack.TransportEndpointID) error
Types ¶
type Chain ¶
type Chain struct { Retries int // contains filtered or unexported fields }
func (*Chain) DialContext ¶
type Client ¶
type Client struct { Connector Transporter }
type ClientDevice ¶
type ClientDevice struct {
// contains filtered or unexported fields
}
func (*ClientDevice) SetTunInboundHandler ¶
func (d *ClientDevice) SetTunInboundHandler(handler func(tunInbound <-chan *DataElem, tunOutbound chan<- *DataElem))
func (*ClientDevice) Start ¶
func (d *ClientDevice) Start(ctx context.Context)
type Connector ¶
func GvisorTCPTunnelConnector ¶
func GvisorTCPTunnelConnector() Connector
func GvisorUDPOverTCPTunnelConnector ¶
func GvisorUDPOverTCPTunnelConnector(endpointID stack.TransportEndpointID) Connector
func UDPOverTCPTunnelConnector ¶
func UDPOverTCPTunnelConnector() Connector
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
func (*Device) SetTunInboundHandler ¶
type Handler ¶
func GvisorTCPHandler ¶
func GvisorTCPHandler() Handler
func GvisorUDPHandler ¶
func GvisorUDPHandler() Handler
func TCPHandler ¶
func TCPHandler() Handler
func TunHandler ¶
TunHandler creates a handler for tun tunnel.
type Node ¶
type Node struct { Addr string Protocol string Remote string // remote address, used by tcp/udp port forwarding Values url.Values Client *Client }
type Route ¶
Route example: -L "tcp://:10800" -L "tun://:8422?net=223.254.0.100/16" -L "tun:/10.233.24.133:8422?net=223.254.0.102/16&route=223.254.0.0/16" -L "tun:/127.0.0.1:8422?net=223.254.0.102/16&route=223.254.0.0/16,10.233.0.0/16" -F "tcp://127.0.0.1:10800"
func (*Route) GenerateServers ¶
type TCPUDPacket ¶
type TCPUDPacket struct {
// contains filtered or unexported fields
}
type Transporter ¶
func TCPTransporter ¶
func TCPTransporter() Transporter
Click to show internal directories.
Click to hide internal directories.