transport

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDialTimeout = 10 * time.Second

Variables

View Source
var WsProxyFuncForTesting func(req *http.Request) (*url.URL, error)

WsProxyFuncForTesting this global function used for testing

Functions

func DialTCP

func DialTCP(ctx context.Context, addr string) (net.Conn, error)

func DialUDP

func DialUDP(address string) (*net.UDPConn, error)

DialUDP create a connected udp connection

func ListenLocalUDP

func ListenLocalUDP(ctx context.Context) (net.PacketConn, error)

ListenLocalUDP create an unconnected udp connection with random local addr

func ListenUDP

func ListenUDP(ctx context.Context, addr string) (net.PacketConn, error)

ListenUDP create an unconnected udp connection with the specified local addr

func TlsConfigQuicALPN

func TlsConfigQuicALPN(config *tls.Config) *tls.Config

Types

type Conn

type Conn interface {
	net.Conn
	TCP() *net.TCPConn
	UDP() *net.UDPConn
}

type Dialer

type Dialer interface {
	Dial(context.Context, string) (net.Conn, error)
}

func NewDialer

func NewDialer(tr Type, opt options.Options) Dialer

type TcpConnBound

type TcpConnBound interface {
	TcpConn(net.Conn) net.Conn
}

type TcpConnBoundHandler

type TcpConnBoundHandler func(net.Conn) net.Conn

func (TcpConnBoundHandler) TcpConn

func (f TcpConnBoundHandler) TcpConn(c net.Conn) net.Conn

type Type

type Type uint8
const (
	Tcp Type = iota // default
	Quic
	Websocket
	Obfs
	Grpc
	Ssh
)

func (Type) String

func (t Type) String() string

type UdpConnBound

type UdpConnBound interface {
	UdpConn(net.PacketConn) net.PacketConn
}

type UdpConnBoundHandler

type UdpConnBoundHandler func(net.PacketConn) net.PacketConn

func (UdpConnBoundHandler) UdpConn

Jump to

Keyboard shortcuts

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