tcpee

package module
v0.0.0-...-aae838a Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2022 License: MIT Imports: 10 Imported by: 0

README

A simple multi-threaded TCP proxy in Go with support for setting server / client keepalives and timeouts. Supports multiple configurations and multiple blocks of configurations, e.g. different settings per service you are proxying to.

See example.conf for an example configuration file.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProxyClosed = errors.New("tcpee: proxy closed")

ErrProxyClosed will be returned upon proxy close.

Functions

This section is empty.

Types

type TCPProxy

type TCPProxy struct {
	// Name is the name of this proxy server, used when
	// logging via the supplied logger
	Name string

	// ProxyProto determines whether to write proxy protocol headers
	// for each proxied TCP connection. The header is proxy protocol
	// v1 compatible, and more information can be found here:
	// https://www.haproxy.org/download/2.6/doc/proxy-protocol.txt
	ProxyProto bool

	// DialTimeout is the maximum time a dial will wait for a
	// connection to complete
	DialTimeout time.Duration

	// ClientTimeout is the maximum time a client conn may idle before
	// being forcibly closed. Note that longer timeout periods
	// will be more efficient as they require less-frequent checks
	ClientTimeout time.Duration

	// ServerTimeout is the maximum time a server conn may idle before
	// being forcibly closed. Note that longer timeout periods
	// will be more efficient as they require less-frequent checks
	ServerTimeout time.Duration

	// ClientKeepAlive specifies the keep-alive period for conns from
	// the client. If zero, keep-alives are enabled with a default
	// value.If negative, keep-alives are disabled.
	ClientKeepAlive time.Duration

	// ServerKeepAlive specifies the keep-alive period for conns to
	// the server. If zero, keep-alives are enabled with a default
	// value.If negative, keep-alives are disabled.
	ServerKeepAlive time.Duration
	// contains filtered or unexported fields
}

func (*TCPProxy) Close

func (proxy *TCPProxy) Close()

Close closes the TCPProxy, waiting for all serve routines to finish

func (*TCPProxy) Proxy

func (proxy *TCPProxy) Proxy(src string, dst string) error

Proxy starts a proxy handler listening on the supplied src address, and proxying it to the supplied dst address

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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