nt

package
v0.0.0-...-48a15a0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2022 License: 0BSD Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertICMPError

func ConvertICMPError(msg *icmp.Message, ip *net.IPAddr, ver int,
) (message.UDPErrorType, netip.Addr, []byte)

func Drain

func Drain(c io.Reader) error

func GuessDefaultIPv4

func GuessDefaultIPv4() net.IP

func GuessDefaultIPv6

func GuessDefaultIPv6() net.IP

func OnReadError

func OnReadError(c io.Reader, f func(error))

func ParseSrcDstAddrFromIPHeader

func ParseSrcDstAddrFromIPHeader(header []byte, version int) (src, dst netip.AddrPort, proto int, e error)

func Relay

func Relay(ctx context.Context, c, r net.Conn, timeout time.Duration) error

func SetConnOption

func SetConnOption(conn net.Conn, opt message.StackOptionInfo) message.StackOptionInfo

func UDPPortAvaliable

func UDPPortAvaliable(a netip.AddrPort) bool

Types

type BufferPrefixedConn

type BufferPrefixedConn struct {
	BufferPrefixedReader
	// contains filtered or unexported fields
}

BufferPrefixedConn is a net.Conn with BufferPrefixedReader.

func NewBufferPrefixedConn

func NewBufferPrefixedConn(c net.Conn, b []byte) *BufferPrefixedConn

func (*BufferPrefixedConn) Read

func (bc *BufferPrefixedConn) Read(b []byte) (int, error)

type BufferPrefixedReader

type BufferPrefixedReader struct {
	Reader io.Reader
	Buffer []byte
	// contains filtered or unexported fields
}

BufferPrefixedReader is an io.Reader which first read from Buffer, then from another io.Reader.

func NewBufferPrefixedReader

func NewBufferPrefixedReader(r io.Reader, b []byte) *BufferPrefixedReader

func (*BufferPrefixedReader) Read

func (br *BufferPrefixedReader) Read(b []byte) (int, error)

Read implements io.Reader.

type Datagram

type Datagram interface {
	Data() []byte
	Reply(b []byte) error
	// contains filtered or unexported methods
}

func ReadPacketDatagram

func ReadPacketDatagram(pc net.PacketConn) (Datagram, error)

type DualModeMultiplexedConn

type DualModeMultiplexedConn interface {
	MultiplexedConn
	SeqPacket
}

func WrapQUICConn

func WrapQUICConn(conn quic.Connection) DualModeMultiplexedConn

type InternetOutbound

type InternetOutbound struct{}

InternetOutbound implements ServerOutbound, create a internet connection/listener.

func (InternetOutbound) Dial

func (InternetOutbound) Listen

func (InternetOutbound) ListenPacket

func (InternetOutbound) SetConnOption

func (InternetOutbound) SetPacketConnOption

type MultiplexedConn

type MultiplexedConn interface {
	Accept() (net.Conn, error)
	Dial() (net.Conn, error)
	// contains filtered or unexported methods
}

type NetBufferOnlyReader

type NetBufferOnlyReader struct {
	Conn net.Conn
}

NetBufferOnlyReader is a wrapper over net.Conn which try to only read data which already in OS buffer by setting read timeout to 1us.

func (*NetBufferOnlyReader) Read

func (n *NetBufferOnlyReader) Read(b []byte) (int, error)

type Outbound

Outbound is a group of function called by ServerWorker when a connection or listener is needed to fulfill client request.

type SeqPacket

type SeqPacket interface {
	NextDatagram() (Datagram, error)
	Reply(b []byte) error
	// contains filtered or unexported methods
}

func WrapConnSeqPacket

func WrapConnSeqPacket(conn net.Conn) SeqPacket

Jump to

Keyboard shortcuts

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