connect

package
v0.0.0-...-2628dbf Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSOCKS5ServerHandler

func NewSOCKS5ServerHandler(log *zerolog.Logger, socksTCPConn Connector, socksUDPConn Connector, transporter Transporter) server.Handler

Types

type AddressMapper

type AddressMapper interface {
	MapAddress(network, address string) (mappedAddress string, exists bool)
	AddAddressMapping(network, fromAddress, toAddress string) error
}

func NewAddressMapper

func NewAddressMapper() AddressMapper

type Connector

type Connector interface {
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

Connector is responsible for connecting to the destination address.

func NewDirectConnector

func NewDirectConnector() Connector

func NewLocalForwardingConnector

func NewLocalForwardingConnector(directConnector Connector, socksConnector Connector, nat AddressMapper) Connector

func NewRotationConnector

func NewRotationConnector(connectors []Connector) Connector

func NewSOCKS5Connector

func NewSOCKS5Connector(connector Connector, socksAddr *SocksAddr) Connector

func NewSOCKS5UDPConnector

func NewSOCKS5UDPConnector(log *zerolog.Logger, tcpConnector Connector, udpConnector Connector, socksAddr *SocksAddr) Connector

type NetworkStack

type NetworkStack struct {
	*stack.Stack

	TcpIOTimeout   time.Duration
	UdpIOTimeout   time.Duration
	ConnectTimeout time.Duration
	// contains filtered or unexported fields
}

func NewNetworkStack

func NewNetworkStack(log *zerolog.Logger, fd int, mtu uint32, tunNetworkAddr string,
	socksTCPConn Connector, socksUDPConn Connector, transporter Transporter) (*NetworkStack, error)

func (*NetworkStack) SetupRouting

func (s *NetworkStack) SetupRouting(nic tcpip.NICID, assignNet string) error

type SocksAddr

type SocksAddr struct {
	Address string
	Auth    *url.Userinfo
}

type TimeoutConn

type TimeoutConn struct {
	net.Conn
	// specifies max amount of time to wait for Read/Write calls to complete
	IOTimeout time.Duration
}

func NewTimeoutConn

func NewTimeoutConn(conn net.Conn, ioTimeout time.Duration) *TimeoutConn

func (*TimeoutConn) Read

func (c *TimeoutConn) Read(b []byte) (n int, err error)

func (*TimeoutConn) Write

func (c *TimeoutConn) Write(b []byte) (n int, err error)

type Transporter

type Transporter interface {
	Transport(rw1, rw2 io.ReadWriter) error
}

func NewTransporter

func NewTransporter(log *zerolog.Logger) Transporter

Jump to

Keyboard shortcuts

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