pollon

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

README

pollon - Simple dynamic tcp proxy library

pollon is a simple dynamic tcp proxy library that retrieves the backend destination ip:address from a user defined function and, if it's changed, forcibly closes all connections to the old destination.

simple usage

See the simple example

See also

stolon Stolon uses pollon for its stolon-proxy to enforce that the connections are directed to the right master

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l Logger)

SetLogger sets the logger used in this package. It should be called only from package user init() functions.

Types

type ConfData

type ConfData struct {
	DestAddr *net.TCPAddr
}

type Logger

type Logger interface {
	Print(args ...interface{})
	Printf(format string, args ...interface{})
	Println(args ...interface{})
}

Logger mimics golang's standard Logger as an interface. Only Print functions are needed.

type Proxy

type Proxy struct {
	C chan ConfData
	// contains filtered or unexported fields
}

func NewProxy

func NewProxy(listener *net.TCPListener) (*Proxy, error)

func (*Proxy) SetKeepAlive

func (p *Proxy) SetKeepAlive(keepalive bool)

func (*Proxy) SetKeepAliveCount

func (p *Proxy) SetKeepAliveCount(n int)

func (*Proxy) SetKeepAliveIdle

func (p *Proxy) SetKeepAliveIdle(d time.Duration)

func (*Proxy) SetKeepAliveInterval

func (p *Proxy) SetKeepAliveInterval(d time.Duration)

func (*Proxy) SetupKeepAlive

func (p *Proxy) SetupKeepAlive(conn *net.TCPConn) error

func (*Proxy) Start

func (p *Proxy) Start() error

func (*Proxy) Stop

func (p *Proxy) Stop()

Directories

Path Synopsis
examples
simple command

Jump to

Keyboard shortcuts

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