net

package
v1.18.8 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KeepAliveInterval = 15 * time.Second
View Source
var NewDeadlineEnhancePacketConn = deadline.NewEnhancePacketConn
View Source
var NewDeadlineEnhanceSingPacketConn = deadline.NewEnhanceSingPacketConn
View Source
var NewDeadlineNetPacketConn = deadline.NewNetPacketConn
View Source
var NewDeadlineSingPacketConn = deadline.NewSingPacketConn
View Source
var NewEnhancePacketConn = packet.NewEnhancePacketConn
View Source
var NewExtendedConn = bufio.NewExtendedConn
View Source
var NewExtendedReader = bufio.NewExtendedReader
View Source
var NewExtendedWriter = bufio.NewExtendedWriter
View Source
var NewRefPacketConn = packet.NewRefPacketConn
View Source
var NewThreadSafePacketConn = packet.NewThreadSafePacketConn
View Source
var WriteBuffer = bufio.WriteBuffer

Functions

func MaskWebSocket

func MaskWebSocket(key uint32, b []byte) uint32

MaskWebSocket applies the WebSocket masking algorithm to p with the given key. See https://tools.ietf.org/html/rfc6455#section-5.3

The returned value is the correctly rotated key to to continue to mask/unmask the message.

It is optimized for LittleEndian and expects the key to be in little endian.

See https://github.com/golang/go/issues/31586

func NeedHandshake

func NeedHandshake(conn any) bool

func NewBindPacketConn

func NewBindPacketConn(pc net.PacketConn, rAddr net.Addr) net.Conn

func NewEarlyConn

func NewEarlyConn(c net.Conn, f func() error) net.Conn

func NewRefConn

func NewRefConn(conn net.Conn, ref any) net.Conn

func ParseCert

func ParseCert(certificate, privateKey string, path Path) (tls.Certificate, error)

func Relay

func Relay(leftConn, rightConn net.Conn)

Relay copies between left and right bidirectionally.

func SetupContextForConn

func SetupContextForConn(ctx context.Context, conn net.Conn) (done func(*error))

SetupContextForConn is a helper function that starts connection I/O interrupter goroutine.

func SplitHostPort

func SplitHostPort(s string) (host, port string, hasPort bool, err error)

func SplitNetworkType

func SplitNetworkType(s string) (string, string, error)

func TCPKeepAlive

func TCPKeepAlive(c net.Conn)

func WarpConnWithBioReader

func WarpConnWithBioReader(c net.Conn, br *bufio.Reader) net.Conn

Types

type BufferedConn

type BufferedConn struct {
	ExtendedConn
	// contains filtered or unexported fields
}

func NewBufferedConn

func NewBufferedConn(c net.Conn) *BufferedConn

func (*BufferedConn) AppendData

func (c *BufferedConn) AppendData(buf []byte) (ok bool)

func (*BufferedConn) Buffered

func (c *BufferedConn) Buffered() int

func (*BufferedConn) Discard

func (c *BufferedConn) Discard(n int) (discarded int, err error)

func (*BufferedConn) Peek

func (c *BufferedConn) Peek(n int) ([]byte, error)

Peek returns the next n bytes without advancing the reader.

func (*BufferedConn) Peeked

func (c *BufferedConn) Peeked() bool

func (*BufferedConn) Read

func (c *BufferedConn) Read(p []byte) (int, error)

func (*BufferedConn) ReadBuffer

func (c *BufferedConn) ReadBuffer(buffer *buf.Buffer) (err error)

func (*BufferedConn) ReadByte

func (c *BufferedConn) ReadByte() (byte, error)

func (*BufferedConn) ReadCached

func (c *BufferedConn) ReadCached() *buf.Buffer

func (*BufferedConn) Reader

func (c *BufferedConn) Reader() *bufio.Reader

Reader returns the internal bufio.Reader.

func (*BufferedConn) ReaderReplaceable

func (c *BufferedConn) ReaderReplaceable() bool

func (*BufferedConn) ResetPeeked

func (c *BufferedConn) ResetPeeked()

func (*BufferedConn) UnreadByte

func (c *BufferedConn) UnreadByte() error

func (*BufferedConn) Upstream

func (c *BufferedConn) Upstream() any

func (*BufferedConn) WriterReplaceable

func (c *BufferedConn) WriterReplaceable() bool

type CachedConn

type CachedConn struct {
	ExtendedConn
	// contains filtered or unexported fields
}

func NewCachedConn

func NewCachedConn(c net.Conn, data []byte) *CachedConn

func (*CachedConn) Read

func (c *CachedConn) Read(b []byte) (n int, err error)

func (*CachedConn) ReadCached

func (c *CachedConn) ReadCached() *buf.Buffer

func (*CachedConn) ReaderReplaceable

func (c *CachedConn) ReaderReplaceable() bool

func (*CachedConn) Upstream

func (c *CachedConn) Upstream() any

func (*CachedConn) WriterReplaceable

func (c *CachedConn) WriterReplaceable() bool

type CountFunc

type CountFunc = network.CountFunc

type CustomAddr

type CustomAddr interface {
	net.Addr
	RawAddr() net.Addr
}

func NewCustomAddr

func NewCustomAddr(networkStr string, addrStr string, rawAddr net.Addr) CustomAddr

type EnhancePacketConn

type EnhancePacketConn = packet.EnhancePacketConn

type ExtendedConn

type ExtendedConn = network.ExtendedConn

func NewDeadlineConn

func NewDeadlineConn(conn net.Conn) ExtendedConn

type ExtendedReader

type ExtendedReader = network.ExtendedReader

type ExtendedWriter

type ExtendedWriter = network.ExtendedWriter

type Path

type Path interface {
	Resolve(path string) string
}

type ReadOnlyReader

type ReadOnlyReader struct {
	io.Reader
}

type WaitReadFrom

type WaitReadFrom = packet.WaitReadFrom

type WriteOnlyWriter

type WriteOnlyWriter struct {
	io.Writer
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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