connpool

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 9 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dialer

type Dialer interface {
	Dial(ctx context.Context, network, address string) (net.Conn, error)
}

func NewCreateSOCKS5Dialer added in v0.6.1

func NewCreateSOCKS5Dialer(socks5ProxyURLStr string) (Dialer, error)

NewCreateSOCKS5Dialer creates a Dialer that routes connections via a SOCKS5 proxy. socks5ProxyURLStr should be of the form: socks5://user:pass@host:port

type InFlightConns

type InFlightConns struct {
	// contains filtered or unexported fields
}

func NewInFlightConns

func NewInFlightConns() (*InFlightConns, error)

func (*InFlightConns) Add

func (i *InFlightConns) Add(conn net.Conn)

func (*InFlightConns) Close

func (i *InFlightConns) Close() error

func (*InFlightConns) Remove

func (i *InFlightConns) Remove(conn net.Conn)

type OneTimePool

type OneTimePool struct {
	InFlightConns *InFlightConns

	Dialer Dialer
	// contains filtered or unexported fields
}

OneTimePool is a pool designed to create continous bare connections that are for one time only usage

func NewOneTimePool

func NewOneTimePool(ctx context.Context, address string, poolSize int, opts ...Option) (*OneTimePool, error)

func (*OneTimePool) Acquire

func (p *OneTimePool) Acquire(c context.Context) (net.Conn, error)

Acquire acquires an idle connection from the pool

func (*OneTimePool) Close

func (p *OneTimePool) Close() error

func (*OneTimePool) Run

func (p *OneTimePool) Run() error

type Option added in v0.6.1

type Option func(*OneTimePool) error

Option configures OneTimePool at construction time.

func WithDialer added in v0.6.1

func WithDialer(d Dialer) Option

WithDialer sets a custom Dialer used by the pool to establish connections.

func WithProxy added in v0.6.1

func WithProxy(proxyURL string) Option

WithProxy configures a SOCKS5 proxy using the provided URL string Example: socks5://user:pass@127.0.0.1:1080

Jump to

Keyboard shortcuts

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