Documentation ¶
Index ¶
- func Config(cfg config.Config) proxyOption
- func Execute(jobs ...func()) func(*executor)
- func ExecuteWithContext(jobs ...func(context.Context)) func(*executor)
- func Instrument(inst ...Instrumentation) proxyOption
- func SetSignalCallback(callOnSignal func()) (wait, cancel func())
- func Version(version string) proxyOption
- func WhenAllFinished(closeHandler func()) func(*executor)
- func WhenPanic(panicHandler func(interface{})) func(*executor)
- type Instrumentation
- type Instrumentations
- func (ci Instrumentations) ConnectionClosed(id, alias string, d time.Duration)
- func (ci Instrumentations) ConnectionClosedDownstream(id, alias string)
- func (ci Instrumentations) ConnectionClosedUpstream(id, alias string)
- func (ci Instrumentations) ConnectionCompleted(id, alias, direction string, transferredBytes int, duration time.Duration)
- func (ci Instrumentations) ConnectionDelayed(id, alias, direction string, delay time.Duration)
- func (ci Instrumentations) ConnectionOpened(id, alias, typ string)
- func (ci Instrumentations) ConnectionProgressed(id, alias, direction string, transferredBytes int)
- func (ci Instrumentations) ConnectionScheduledClose(id, alias string, delay time.Duration)
- type Logs
- func (l *Logs) ConnectionClosed(id, alias string, d time.Duration)
- func (l *Logs) ConnectionClosedDownstream(id, alias string)
- func (l *Logs) ConnectionClosedUpstream(id, alias string)
- func (l *Logs) ConnectionCompleted(id, alias, direction string, transferredBytes int, duration time.Duration)
- func (l *Logs) ConnectionDelayed(id, alias, direction string, delay time.Duration)
- func (l *Logs) ConnectionOpened(id, alias, typ string)
- func (l *Logs) ConnectionProgressed(id, alias, direction string, transferredBytes int)
- func (l *Logs) ConnectionScheduledClose(id, alias string, delay time.Duration)
- type Metrics
- func (m *Metrics) ConnectionClosed(id, alias string, d time.Duration)
- func (m *Metrics) ConnectionClosedDownstream(id, alias string)
- func (m *Metrics) ConnectionClosedUpstream(id, alias string)
- func (m *Metrics) ConnectionCompleted(id, alias, direction string, transferredBytes int, duration time.Duration)
- func (m *Metrics) ConnectionDelayed(id, alias, direction string, delay time.Duration)
- func (m *Metrics) ConnectionOpened(id, alias, typ string)
- func (m *Metrics) ConnectionProgressed(id, alias, direction string, transferredBytes int)
- func (m *Metrics) ConnectionScheduledClose(id, alias string, delay time.Duration)
- func (m *Metrics) Init(ctx context.Context, g *run.Group, adminPort int, data *admin.AdminData)
- type Proxy
- type Runner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
func Execute(jobs ...func()) func(*executor)
Execute wraps list of plain, argumentless funtions to be independent jobs to be executed concurrently
func ExecuteWithContext ¶
ExecuteWithContext wraps list of plain, argumentless funtions to be independent jobs to be executed concurrently; additional context argument allows job to monitor cancellation signals from outside.
func Instrument ¶
func Instrument(inst ...Instrumentation) proxyOption
func SetSignalCallback ¶
func SetSignalCallback(callOnSignal func()) (wait, cancel func())
SetSignalCallback registers callback function to be called when one of SIGTERM, SIGINT signals is received. Returns two functions: first one should be called from separate goroutine as it is returing only if signal is received; it calls callback before returning second one is cancelling waiting for signal; callback won't be called.
func WhenAllFinished ¶
func WhenAllFinished(closeHandler func()) func(*executor)
WhenAllFinished adds handler that is called when all jobs finishes. It will be called only once and only when all jobs quit no matter of the result or panic they raise.
Types ¶
type Instrumentation ¶
type Instrumentation interface { ConnectionOpened(id, alias, typ string) ConnectionProgressed(id, alias, direction string, transferredBytes int) ConnectionDelayed(id, alias, direction string, delay time.Duration) ConnectionCompleted(id, alias, direction string, transferredBytes int, duration time.Duration) ConnectionScheduledClose(id, alias string, delay time.Duration) ConnectionClosedUpstream(id, alias string) ConnectionClosedDownstream(id, alias string) ConnectionClosed(id, alias string, duration time.Duration) }
Instrumentation is interface of hooks called by main application logic to support decoupled and pluggable logging, metrics, tracing etc.
type Instrumentations ¶
type Instrumentations []Instrumentation
func (Instrumentations) ConnectionClosed ¶
func (ci Instrumentations) ConnectionClosed(id, alias string, d time.Duration)
func (Instrumentations) ConnectionClosedDownstream ¶
func (ci Instrumentations) ConnectionClosedDownstream(id, alias string)
func (Instrumentations) ConnectionClosedUpstream ¶
func (ci Instrumentations) ConnectionClosedUpstream(id, alias string)
func (Instrumentations) ConnectionCompleted ¶
func (ci Instrumentations) ConnectionCompleted(id, alias, direction string, transferredBytes int, duration time.Duration)
func (Instrumentations) ConnectionDelayed ¶
func (ci Instrumentations) ConnectionDelayed(id, alias, direction string, delay time.Duration)
func (Instrumentations) ConnectionOpened ¶
func (ci Instrumentations) ConnectionOpened(id, alias, typ string)
func (Instrumentations) ConnectionProgressed ¶
func (ci Instrumentations) ConnectionProgressed(id, alias, direction string, transferredBytes int)
func (Instrumentations) ConnectionScheduledClose ¶
func (ci Instrumentations) ConnectionScheduledClose(id, alias string, delay time.Duration)
type Logs ¶
func DefaultLogs ¶
func DefaultLogs() *Logs
func (*Logs) ConnectionClosedDownstream ¶
func (*Logs) ConnectionClosedUpstream ¶
func (*Logs) ConnectionCompleted ¶
func (*Logs) ConnectionDelayed ¶
func (*Logs) ConnectionOpened ¶
func (*Logs) ConnectionProgressed ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}