netx

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package netx provides high-performance networking primitives.

Index

Constants

View Source
const (
	// TCPBufferSize is the socket buffer size for high throughput (512KB).
	TCPBufferSize = 512 * 1024

	// KeepAliveInterval for TCP keepalive probes.
	KeepAliveInterval = 30 * time.Second

	// LingerTimeout for graceful close.
	LingerTimeout = 3
)
View Source
const DialTimeout = 10 * time.Second

DialTimeout is the default timeout for establishing connections.

Variables

This section is empty.

Functions

func TuneConn

func TuneConn(conn *net.TCPConn) error

TuneConn applies high-performance socket options to a TCP connection.

Types

type Conn

type Conn interface {
	net.Conn
	CloseRead() error
	CloseWrite() error
	SyscallConn() (syscall.RawConn, error)
}

Conn wraps net.TCPConn with half-close support.

type Dialer

type Dialer struct {
	Timeout   time.Duration
	KeepAlive time.Duration
}

Dialer provides high-performance TCP dialing with proper socket tuning.

func NewDialer

func NewDialer() *Dialer

NewDialer creates a new high-performance dialer.

func (*Dialer) Dial

func (d *Dialer) Dial(network, address string) (Conn, error)

Dial connects to the address on the named network.

func (*Dialer) DialContext

func (d *Dialer) DialContext(ctx context.Context, network, address string) (Conn, error)

DialContext connects to the address with context support.

type Socks5Dialer added in v0.1.3

type Socks5Dialer struct {
	ProxyAddr string
	// contains filtered or unexported fields
}

Socks5Dialer wraps a SOCKS5 proxy dialer with socket tuning.

func NewSocks5Dialer added in v0.1.3

func NewSocks5Dialer(proxyAddr string) (*Socks5Dialer, error)

NewSocks5Dialer creates a new SOCKS5 dialer.

func (*Socks5Dialer) Dial added in v0.1.3

func (d *Socks5Dialer) Dial(network, address string) (Conn, error)

Dial connects to the address via SOCKS5 proxy.

func (*Socks5Dialer) DialContext added in v0.1.3

func (d *Socks5Dialer) DialContext(ctx context.Context, network, address string) (Conn, error)

DialContext connects to the address via SOCKS5 proxy with context support.

Jump to

Keyboard shortcuts

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