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 CloseRead(reader any) error
- func CloseWrite(writer any) error
- 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 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 ReportHandshakeFailure(conn any, err error) error
- func ReportHandshakeSuccess(conn any) error
- 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 HandshakeFailure
- type HandshakeSuccess
- 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 ReadCloser
- type ReadCounter
- type ReadWaitCreator
- type ReadWaitOptions
- type ReadWaitable
- type ReadWaiter
- type ReaderWithMTU
- type ReaderWithUpstream
- type RearHeadroom
- type TCPConnectionHandler
- type ThreadSafePacketReaderdeprecated
- type ThreadSafeReaderdeprecated
- type ThreadUnsafeWriter
- type TimeoutPacketReader
- type UDPConnectionHandler
- type UDPHandler
- type VectorisedPacketWriter
- type VectorisedWriter
- type WithUpstreamReader
- type WithUpstreamWriter
- type WriteCloser
- 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 ¶ added in v0.2.5
func CastPacketReader[T PacketReader](reader PacketReader) (T, bool)
func CastPacketWriter ¶ added in v0.2.5
func CastPacketWriter[T PacketWriter](writer PacketWriter) (T, bool)
func CloseWrite ¶ added in v0.5.0
func DialParallel ¶
func DialSerial ¶
func IsPublicAddr ¶
func IsUnsafeWriter ¶
func ListenSerial ¶
func LocalAddrs ¶
func LocalPublicAddrs ¶
func NetworkName ¶
func ReportHandshakeFailure ¶ added in v0.2.11
func ReportHandshakeSuccess ¶ added in v0.2.11
func UnwrapCountPacketReader ¶ added in v0.2.5
func UnwrapCountPacketReader(reader PacketReader, countFunc []CountFunc) (PacketReader, []CountFunc)
func UnwrapCountPacketWriter ¶ added in v0.2.5
func UnwrapCountPacketWriter(writer PacketWriter, countFunc []CountFunc) (PacketWriter, []CountFunc)
Types ¶
type AbstractConn ¶ added in v0.2.5
type BindPacketConn ¶
type BindPacketConn interface { NetPacketConn net.Conn }
type CachedPacketReader ¶
type CachedPacketReader interface {
ReadCachedPacket() *PacketBuffer
}
type CachedReader ¶
type CountFunc ¶ added in v0.2.5
type CountFunc func(n int64)
func UnwrapCountReader ¶ added in v0.2.5
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 HandshakeFailure ¶
type HandshakeSuccess ¶ added in v0.2.11
type HandshakeSuccess interface {
HandshakeSuccess() error
}
type LazyHeadroom ¶
type LazyHeadroom interface {
LazyHeadroom() bool
}
type NetPacketConn ¶
type NetPacketConn interface { PacketConn NetPacketReader NetPacketWriter }
type NetPacketReader ¶
type NetPacketWriter ¶
type PacketBuffer ¶ added in v0.2.5
type PacketConn ¶
type PacketReadCounter ¶ added in v0.2.5
type PacketReadCounter interface { PacketReader UnwrapPacketReader() (PacketReader, []CountFunc) }
type PacketReadWaitCreator ¶ added in v0.2.5
type PacketReadWaitCreator interface {
CreateReadWaiter() (PacketReadWaiter, bool)
}
type PacketReadWaiter ¶ added in v0.2.5
type PacketReader ¶
func UnwrapPacketReader ¶
func UnwrapPacketReader(reader PacketReader) PacketReader
type PacketWriteCounter ¶ added in v0.2.5
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 ReadCloser ¶ added in v0.5.0
type ReadCloser interface {
CloseRead() error
}
type ReadCounter ¶ added in v0.2.5
type ReadWaitCreator ¶ added in v0.2.5
type ReadWaitCreator interface {
CreateReadWaiter() (ReadWaiter, bool)
}
type ReadWaitOptions ¶ added in v0.3.0
func (ReadWaitOptions) NeedHeadroom ¶ added in v0.3.0
func (o ReadWaitOptions) NeedHeadroom() bool
func (ReadWaitOptions) NewBuffer ¶ added in v0.3.0
func (o ReadWaitOptions) NewBuffer() *buf.Buffer
func (ReadWaitOptions) NewPacketBuffer ¶ added in v0.3.0
func (o ReadWaitOptions) NewPacketBuffer() *buf.Buffer
func (ReadWaitOptions) PostReturn ¶ added in v0.3.0
func (o ReadWaitOptions) PostReturn(buffer *buf.Buffer)
type ReadWaitable ¶ added in v0.3.0
type ReadWaitable interface {
InitializeReadWaiter(options ReadWaitOptions) (needCopy bool)
}
type ReadWaiter ¶ added in v0.2.5
type ReadWaiter interface { ReadWaitable WaitReadBuffer() (buffer *buf.Buffer, err error) }
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
deprecated
type ThreadSafePacketReader interface { // Deprecated: Use ReadWaiter interface instead. ReadPacketThreadSafe() (buffer *buf.Buffer, addr M.Socksaddr, err error) }
Deprecated: Use ReadWaiter interface instead.
func IsSafePacketReader
deprecated
func IsSafePacketReader(reader any) ThreadSafePacketReader
Deprecated: Use ReadWaiter interface instead.
type ThreadSafeReader
deprecated
type ThreadSafeReader interface { // Deprecated: Use ReadWaiter interface instead. ReadBufferThreadSafe() (buffer *buf.Buffer, err error) }
Deprecated: Use ReadWaiter interface instead.
func IsSafeReader
deprecated
func IsSafeReader(reader any) ThreadSafeReader
Deprecated: Use ReadWaiter interface instead.
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 WriteCloser ¶ added in v0.5.0
type WriteCloser interface {
CloseWrite() error
}
type WriteCounter ¶ added in v0.2.5
type WriterWithMTU ¶
type WriterWithMTU interface {
WriterMTU() int
}
type WriterWithUpstream ¶
type WriterWithUpstream interface {
WriterReplaceable() bool
}
Click to show internal directories.
Click to hide internal directories.