nt

package
v0.0.0-...-89ec37b Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2022 License: 0BSD Imports: 13 Imported by: 0

Documentation

Overview

nt contains some network related type and helper function

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GuessDefaultIPv4

func GuessDefaultIPv4() net.IP

func GuessDefaultIPv6

func GuessDefaultIPv6() net.IP

func ParseSrcDstAddrFromIPHeader

func ParseSrcDstAddrFromIPHeader(header []byte, version int) (*message.SocksAddr, *message.SocksAddr, int, error)

func UdpPortAvaliable

func UdpPortAvaliable(a net.Addr) 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 ReadUDPDatagram

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

type DualModeMultiplexedConn

type DualModeMultiplexedConn interface {
	MultiplexedConn
	SeqPacket
}

func WrapQUICConn

func WrapQUICConn(conn quic.Connection) DualModeMultiplexedConn

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 SeqPacket

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

func WrapNetConnUDP

func WrapNetConnUDP(conn net.Conn) SeqPacket

Jump to

Keyboard shortcuts

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