dialer

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: LGPL-2.1 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var System = NewDefault()

Functions

func DialParallel

func DialParallel(ctx context.Context, dialer Dialer, network meta.Network, addresses []netip.Addr, port uint16, conf HappyEyeballConf) (net.Conn, error)

func DialSerial

func DialSerial(ctx context.Context, this Dialer, network meta.Network, address []netip.Addr, port uint16) (net.Conn, error)

Types

type Config

type Config struct {
	Keepalive    net.KeepAliveConfig
	Timeout      time.Duration
	Interface    string
	BindAddress4 netip.Addr
	BindAddress6 netip.Addr
	FwMark       uint32
	ReuseAddr    bool
	ReusePort    bool

	// tcp
	MPTCP bool
	TFO   bool

	// udp
	UDPFragment bool
}

type DefaultDialer

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

DefaultDialer Only support dial tcp and udp Protocol. only can use to dial ip address ,not support resolve fqdn to ip address.

func NewDefault

func NewDefault() *DefaultDialer

func NewDefaultConfig

func NewDefaultConfig(config Config) *DefaultDialer

func (*DefaultDialer) DialContext

func (d *DefaultDialer) DialContext(ctx context.Context, network meta.Network, address addrs.Socksaddr) (net.Conn, error)

func (*DefaultDialer) DialParallel

func (d *DefaultDialer) DialParallel(ctx context.Context, network meta.Network, address []netip.Addr, port uint16) (net.Conn, error)

func (*DefaultDialer) ListenPacket

func (d *DefaultDialer) ListenPacket(ctx context.Context, address addrs.Socksaddr) (net.PacketConn, error)

type DefaultParallelDialer added in v0.0.3

type DefaultParallelDialer struct {
	Dialer

	Conf HappyEyeballConf
}

func (*DefaultParallelDialer) DialParallel added in v0.0.3

func (pd *DefaultParallelDialer) DialParallel(ctx context.Context, network meta.Network, address []netip.Addr, port uint16) (net.Conn, error)

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, network meta.Network, address addrs.Socksaddr) (net.Conn, error)
	ListenPacket(ctx context.Context, address addrs.Socksaddr) (net.PacketConn, error)
}

type HappyEyeballConf added in v0.0.3

type HappyEyeballConf struct {
	FallbackDelay time.Duration
	Strategy      meta.Strategy
}
var DefaultHappyEyeballConf HappyEyeballConf = HappyEyeballConf{
	FallbackDelay: netvars.DefaultDialerFallbackDelay,
	Strategy:      meta.StrategyDefault,
}

type ParallelDialer

type ParallelDialer interface {
	Dialer
	DialParallel(ctx context.Context, network meta.Network, address []netip.Addr, port uint16) (net.Conn, error)
}

type TFOConn

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

func (*TFOConn) Close

func (c *TFOConn) Close() error

func (*TFOConn) Handshake

func (c *TFOConn) Handshake(bs []byte) (int, error)

func (*TFOConn) LocalAddr

func (c *TFOConn) LocalAddr() net.Addr

func (*TFOConn) NeedHandshake

func (c *TFOConn) NeedHandshake() bool

func (*TFOConn) Read

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

func (*TFOConn) RemoteAddr

func (c *TFOConn) RemoteAddr() net.Addr

func (*TFOConn) SetDeadline

func (c *TFOConn) SetDeadline(t time.Time) error

func (*TFOConn) SetReadDeadline

func (c *TFOConn) SetReadDeadline(t time.Time) error

func (*TFOConn) SetWriteDeadline

func (c *TFOConn) SetWriteDeadline(t time.Time) error

func (*TFOConn) UnderlayConn

func (c *TFOConn) UnderlayConn() net.Conn

func (*TFOConn) Write

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

Jump to

Keyboard shortcuts

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