Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateFrontHeadroom(writer any) int
- func CalculateMTU(reader any, writer any) int
- func CalculateRearHeadroom(writer any) int
- func CastPacketReader[T PacketReader](reader PacketReader) (T, bool)
- func CastPacketWriter[T PacketWriter](writer PacketWriter) (T, bool)
- func CastReader[T io.Reader](reader io.Reader) (T, bool)
- func CastWriter[T io.Writer](writer io.Writer) (T, bool)
- func DialParallel(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, ...) (net.Conn, error)
- func DialSerial(ctx context.Context, dialer Dialer, network string, destination M.Socksaddr, ...) (net.Conn, error)
- func HandshakeFailure(conn any, err error) error
- func IsPublicAddr(addr netip.Addr) bool
- func IsUnsafeWriter(writer any) bool
- func IsVirtual(addr netip.Addr) bool
- func ListenSerial(ctx context.Context, dialer Dialer, destination M.Socksaddr, ...) (net.PacketConn, netip.Addr, error)
- func LocalAddrs() ([]netip.Addr, error)
- func LocalPublicAddrs() ([]netip.Addr, error)
- func NetworkName(network string) string
- func UnwrapCountPacketReader(reader PacketReader, countFunc []CountFunc) (PacketReader, []CountFunc)
- func UnwrapCountPacketWriter(writer PacketWriter, countFunc []CountFunc) (PacketWriter, []CountFunc)
- func UnwrapReader(reader io.Reader) io.Reader
- func UnwrapWriter(writer io.Writer) io.Writer
- type AbstractConn
- type BindPacketConn
- type CachedPacketReader
- type CachedReader
- type CountFunc
- type DefaultDialer
- func (d *DefaultDialer) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error)
- func (d *DefaultDialer) DialParallel(ctx context.Context, network string, destination M.Socksaddr, ...) (net.Conn, error)
- func (d *DefaultDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
- type Dialer
- type EarlyConn
- type ExtendedConn
- type ExtendedReader
- type ExtendedWriter
- type FrontHeadroom
- type HandshakeConn
- type LazyHeadroom
- type NetPacketConn
- type NetPacketReader
- type NetPacketWriter
- type PacketBuffer
- type PacketConn
- type PacketReadCounter
- type PacketReadWaitCreator
- type PacketReadWaiter
- type PacketReader
- type PacketWriteCounter
- type PacketWriter
- type ParallelDialer
- type PayloadDialer
- type ReadCounter
- type ReadWaitCreator
- type ReadWaiter
- type ReaderWithMTU
- type ReaderWithUpstream
- type RearHeadroom
- type TCPConnectionHandler
- type ThreadSafePacketReader
- type ThreadSafeReader
- type ThreadUnsafeWriter
- type TimeoutPacketReader
- type UDPConnectionHandler
- type UDPHandler
- type VectorisedPacketWriter
- type VectorisedWriter
- type WithUpstreamReader
- type WithUpstreamWriter
- type WriteCounter
- type WriterWithMTU
- type WriterWithUpstream
Constants ¶
View Source
const ( NetworkIP = "ip" NetworkTCP = "tcp" NetworkUDP = "udp" NetworkICMPv4 = "icmpv4" NetworkICMPv6 = "icmpv6" )
View Source
const DefaultFallbackDelay = 300 * time.Millisecond
View Source
const DefaultHeadroom = 1024
Variables ¶
View Source
var ErrUnknownNetwork = E.New("unknown network")
Functions ¶
func CalculateFrontHeadroom ¶
func CalculateMTU ¶
func CalculateRearHeadroom ¶
func CastPacketReader ¶
func CastPacketReader[T PacketReader](reader PacketReader) (T, bool)
func CastPacketWriter ¶
func CastPacketWriter[T PacketWriter](writer PacketWriter) (T, bool)
func DialParallel ¶
func DialSerial ¶
func HandshakeFailure ¶
func IsPublicAddr ¶
func IsUnsafeWriter ¶
func ListenSerial ¶
func LocalAddrs ¶
func LocalPublicAddrs ¶
func NetworkName ¶
func UnwrapCountPacketReader ¶
func UnwrapCountPacketReader(reader PacketReader, countFunc []CountFunc) (PacketReader, []CountFunc)
func UnwrapCountPacketWriter ¶
func UnwrapCountPacketWriter(writer PacketWriter, countFunc []CountFunc) (PacketWriter, []CountFunc)
Types ¶
type AbstractConn ¶
type BindPacketConn ¶
type BindPacketConn interface { NetPacketConn net.Conn }
type CachedPacketReader ¶
type CachedPacketReader interface {
ReadCachedPacket() *PacketBuffer
}
type CachedReader ¶
type DefaultDialer ¶
type DefaultDialer struct { net.Dialer net.ListenConfig }
func (*DefaultDialer) DialContext ¶
func (*DefaultDialer) DialParallel ¶
func (*DefaultDialer) ListenPacket ¶
func (d *DefaultDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error)
type ExtendedConn ¶
type ExtendedConn interface { ExtendedReader ExtendedWriter net.Conn }
type ExtendedReader ¶
type ExtendedWriter ¶
type FrontHeadroom ¶
type FrontHeadroom interface {
FrontHeadroom() int
}
type HandshakeConn ¶
type LazyHeadroom ¶
type LazyHeadroom interface {
LazyHeadroom() bool
}
type NetPacketConn ¶
type NetPacketConn interface { PacketConn NetPacketReader NetPacketWriter }
type NetPacketReader ¶
type NetPacketWriter ¶
type PacketConn ¶
type PacketReadCounter ¶
type PacketReadCounter interface { PacketReader UnwrapPacketReader() (PacketReader, []CountFunc) }
type PacketReadWaitCreator ¶
type PacketReadWaitCreator interface {
CreateReadWaiter() (PacketReadWaiter, bool)
}
type PacketReadWaiter ¶
type PacketReader ¶
func UnwrapPacketReader ¶
func UnwrapPacketReader(reader PacketReader) PacketReader
type PacketWriteCounter ¶
type PacketWriteCounter interface { PacketWriter UnwrapPacketWriter() (PacketWriter, []CountFunc) }
type PacketWriter ¶
func UnwrapPacketWriter ¶
func UnwrapPacketWriter(writer PacketWriter) PacketWriter
type ParallelDialer ¶
type ParallelDialer interface { Dialer DialParallel(ctx context.Context, network string, destination M.Socksaddr, destinationAddresses []netip.Addr) (net.Conn, error) }
var SystemDialer ParallelDialer = &DefaultDialer{}
type PayloadDialer ¶
type ReadWaitCreator ¶
type ReadWaitCreator interface {
CreateReadWaiter() (ReadWaiter, bool)
}
type ReadWaiter ¶
type ReaderWithMTU ¶
type ReaderWithMTU interface {
ReaderMTU() int
}
type ReaderWithUpstream ¶
type ReaderWithUpstream interface {
ReaderReplaceable() bool
}
type RearHeadroom ¶
type RearHeadroom interface {
RearHeadroom() int
}
type TCPConnectionHandler ¶
type ThreadSafePacketReader ¶
type ThreadSafePacketReader interface {
ReadPacketThreadSafe() (buffer *buf.Buffer, addr M.Socksaddr, err error)
}
func IsSafePacketReader ¶
func IsSafePacketReader(reader any) ThreadSafePacketReader
type ThreadSafeReader ¶
func IsSafeReader ¶
func IsSafeReader(reader any) ThreadSafeReader
type ThreadUnsafeWriter ¶
type ThreadUnsafeWriter interface {
WriteIsThreadUnsafe()
}
type TimeoutPacketReader ¶
type TimeoutPacketReader interface { PacketReader SetReadDeadline(t time.Time) error }
type UDPConnectionHandler ¶
type UDPHandler ¶
type VectorisedPacketWriter ¶
type VectorisedWriter ¶
type WithUpstreamReader ¶
type WithUpstreamReader interface {
UpstreamReader() any
}
type WithUpstreamWriter ¶
type WithUpstreamWriter interface {
UpstreamWriter() any
}
type WriteCounter ¶
type WriterWithMTU ¶
type WriterWithMTU interface {
WriterMTU() int
}
type WriterWithUpstream ¶
type WriterWithUpstream interface {
WriterReplaceable() bool
}
Click to show internal directories.
Click to hide internal directories.