transport

package
v0.0.0-...-3cdde17 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDialerOutboundOption = &defaultDialerOutboundOption{}
View Source
var DefaultGrpcOptions = &GrpcOptions{
	TlsOptions: TlsOptions{Mode: None},
}
View Source
var DefaultKcpOptions = &KcpOptions{
	Crypt:       "none",
	Key:         "",
	Mode:        "normal",
	Mtu:         1350,
	SndWnd:      2048,
	RevWnd:      2048,
	DataShard:   10,
	ParityShard: 3,
	Dscp:        46,
	Resend:      2,
	NoCompress:  true,
	AckNoDelay:  false,
	Interval:    40,
	Nc:          1,
	SockBuf:     16777217,
	SmuxVer:     1,
	SmuxBuf:     16777217,
	StreamBuf:   2097152,
	KeepAlive:   10,
	Conns:       3,
}
View Source
var DefaultObfsOptions = &ObfsOptions{
	Host: "www.baidu.com",
}
View Source
var DefaultOptions = &defaultDialerOption{}
View Source
var DefaultQuicOptions = &QuicOptions{
	HandshakeIdleTimeout: 5 * time.Second,
	KeepAlivePeriod:      30 * time.Second,
	MaxIdleTimeout:       30 * time.Second,
	Conns:                3,
}
View Source
var DefaultWsOptions = &WsOptions{
	Host:       "www.baidu.com",
	Path:       "/ws",
	SndBuffer:  4096,
	RevBuffer:  4096,
	Compress:   false,
	TlsOptions: TlsOptions{Mode: None},
	UserAgent:  "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36",
}
View Source
var WsProxyFuncForTesting func(req *http.Request) (*url.URL, error)

WsProxyFuncForTesting this global function used for testing

Functions

func DialTCP

func DialTCP(addr string) (net.Conn, error)

func DialUDP

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

DialUDP create a connected udp connection

func ListenLocalUDP

func ListenLocalUDP() (net.PacketConn, error)

ListenLocalUDP create an unconnected udp connection

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(addr string) (net.Conn, error)
}

func NewDialer

func NewDialer(tr Type, opt Options) Dialer

type GrpcOptions

type GrpcOptions struct {
	TlsOptions
	SndBuffer int
	RevBuffer int
}

func (*GrpcOptions) Update

func (opts *GrpcOptions) Update()

type KcpOptions

type KcpOptions struct {
	Key         string
	Crypt       string
	Mode        string
	Mtu         int
	SndWnd      int
	RevWnd      int
	DataShard   int
	ParityShard int
	Dscp        int
	NoCompress  bool
	AckNoDelay  bool
	NoDelay     int
	Interval    int
	Resend      int
	Nc          int
	SockBuf     int
	SmuxVer     int
	SmuxBuf     int
	StreamBuf   int
	KeepAlive   int
	Conns       int

	BC kcp.BlockCrypt
}

func (*KcpOptions) Update

func (opts *KcpOptions) Update()

type ObfsOptions

type ObfsOptions struct {
	Host string
}

func (*ObfsOptions) Update

func (opts *ObfsOptions) Update()

type Options

type Options interface{ Update() }

type QuicOptions

type QuicOptions struct {
	HandshakeIdleTimeout time.Duration
	KeepAlivePeriod      time.Duration
	MaxIdleTimeout       time.Duration
	Conns                int
}

func (*QuicOptions) Update

func (opts *QuicOptions) Update()

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 TlsMode

type TlsMode byte
const (
	None TlsMode = iota
	TLS
	MTLS
)

type TlsOptions

type TlsOptions struct {
	Mode     TlsMode
	CAFile   string
	KeyFile  string // server or client key file
	CertFile string // server or client cert file
	Hostname string
}

func (*TlsOptions) GetClientTlsConfig

func (o *TlsOptions) GetClientTlsConfig() (*tls.Config, error)

func (*TlsOptions) GetServerTlsConfig

func (o *TlsOptions) GetServerTlsConfig() (*tls.Config, error)

type Type

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

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

type WsOptions

type WsOptions struct {
	TlsOptions
	Host      string
	Path      string
	SndBuffer int
	RevBuffer int
	Compress  bool
	UserAgent string
}

func (*WsOptions) Update

func (opts *WsOptions) Update()

Jump to

Keyboard shortcuts

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