proxy

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsConnectionClosedError added in v0.21.0

func IsConnectionClosedError(err error) bool

IsConnectionClosedError reports whether err indicates that a connection was closed or aborted by either peer. Callers can use it to ignore routine connection shutdown or broken pipe errors reported to Proxy.OnError.

Types

type Proxy

type Proxy struct {
	Listener    net.Listener
	RemoteAddr  string
	DialContext func(ctx context.Context, network, address string) (net.Conn, error)
	// OnError is called for errors that occur during proxying individual connections. It may be called concurrently
	// for different connections.
	OnError func(error)
	// contains filtered or unexported fields
}

Proxy proxies local connections to a remote TCP address optionally using a custom dialer.

func (*Proxy) Run

func (p *Proxy) Run(ctx context.Context) error

Run starts the proxy and runs until the context is canceled or the listener fails. It returns nil when the context is canceled. Errors handling individual connections are reported to OnError and do not stop the proxy.

Jump to

Keyboard shortcuts

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