network

package
v0.0.0-...-d3bc976 Latest Latest
Warning

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

Go to latest
Published: May 12, 2023 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultFallbackDelay = 300 * time.Millisecond

Variables

This section is empty.

Functions

func DialParallel

func DialParallel(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, destinationAddresses []netip.Addr, preferIPv6 bool, fallbackDelay time.Duration) (net.Conn, error)

func DialSerial

func DialSerial(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, destinationAddresses []netip.Addr) (net.Conn, error)

func IsPublicAddr

func IsPublicAddr(addr netip.Addr) bool

func ListenSerial

func ListenSerial(ctx context.Context, dialer Dialer, destination M.Socksaddr, destinationAddresses []netip.Addr) (net.PacketConn, error)

func LocalAddrs

func LocalAddrs() ([]netip.Addr, error)

func LocalPublicAddrs

func LocalPublicAddrs() ([]netip.Addr, error)

func UnwrapReader

func UnwrapReader(reader io.Reader) io.Reader

func UnwrapWriter

func UnwrapWriter(writer io.Writer) io.Writer

Types

type BindPacketConn

type BindPacketConn interface {
	NetPacketConn
	net.Conn
}

type CachedReader

type CachedReader interface {
	ReadCached() *buf.Buffer
}

type DefaultDialer

type DefaultDialer struct {
	net.Dialer
	net.ListenConfig
}

func (*DefaultDialer) DialContext

func (d *DefaultDialer) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)

func (*DefaultDialer) ListenPacket

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

type Dialer

type Dialer interface {
	DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)
	ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
}
var SystemDialer Dialer = &DefaultDialer{}

type ExtendedConn

type ExtendedConn interface {
	ExtendedReader
	ExtendedWriter
	net.Conn
}

type ExtendedReader

type ExtendedReader interface {
	io.Reader
	ReadBuffer(buffer *buf.Buffer) error
}

type ExtendedWriter

type ExtendedWriter interface {
	io.Writer
	WriteBuffer(buffer *buf.Buffer) error
}

type NetPacketConn

type NetPacketConn interface {
	net.PacketConn
	PacketConn
}

type PacketConn

type PacketConn interface {
	PacketReader
	PacketWriter

	Close() error
	LocalAddr() net.Addr
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

type PacketReader

type PacketReader interface {
	ReadPacket(buffer *buf.Buffer) (destination M.Socksaddr, err error)
}

type PacketWriter

type PacketWriter interface {
	WritePacket(buffer *buf.Buffer, destination M.Socksaddr) error
}

type ReaderWithUpstream

type ReaderWithUpstream interface {
	common.WithUpstream
	ReaderReplaceable() bool
}

type TCPConnectionHandler

type TCPConnectionHandler interface {
	NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error
}

type ThreadSafePacketReader

type ThreadSafePacketReader interface {
	ReadPacketThreadSafe() (buffer *buf.Buffer, addr M.Socksaddr, err error)
}

type ThreadSafeReader

type ThreadSafeReader interface {
	ReadBufferThreadSafe() (buffer *buf.Buffer, err error)
}

type ThreadUnsafeWriter

type ThreadUnsafeWriter interface {
	WriteIsThreadUnsafe()
}

type TimeoutPacketReader

type TimeoutPacketReader interface {
	PacketReader
	SetReadDeadline(t time.Time) error
}

type UDPConnectionHandler

type UDPConnectionHandler interface {
	NewPacketConnection(ctx context.Context, conn PacketConn, metadata M.Metadata) error
}

type UDPHandler

type UDPHandler interface {
	NewPacket(ctx context.Context, conn PacketConn, buffer *buf.Buffer, metadata M.Metadata) error
}

type WriterWithUpstream

type WriterWithUpstream interface {
	common.WithUpstream
	WriterReplaceable() bool
}

Jump to

Keyboard shortcuts

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