Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DeadMansSwitch ¶
type DeadMansSwitch struct { DelayCh chan<- struct{} ExpireCh <-chan struct{} Expired bool }
DeadMansSwitch is a struct used for getting automatically notified some time after a process stops sending events. See GetDeadMansSwitch for more explanation of usage.
func NewDeadMansSwitch ¶
func NewDeadMansSwitch(timeout time.Duration) *DeadMansSwitch
NewDeadMansSwitch returns a DeadMansSwitch struct. This struct contains two channels. The ExpireCh will receive an event automatically after the provided timeout. However, at any time you can send an event to the DelayCh to re-set this timeout to be from the current time rather than from when the NewDeadMansSwitch was returned. In other words, this lets you get notified automatically some time after a process stops sending events. To help in avoiding race conditions, the field Expired is set from false to true immediately *before* an event is sent to the ExpireCh.
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a struct returned by NewProxy, that represents a running proxy server. It can be used to stop the server by calling Close.
func NewProxy ¶
func NewProxy(opts *ProxyOptions) (*Proxy, error)
NewProxy creates and starts a TCP or UDP server that will transparently proxy TCP/UDP traffic to an upstream address, see ProxyOptions for the options. An instance of Proxy is returned which can be used to stop the server later.
type ProxyOptions ¶
type ProxyOptions struct { // Protocol is either "tcp" or "udp" Protocol string // ListenAddr is the address the proxy server will listen for // incoming TCP/UDP traffic on, e.g. "127.0.0.1:80" ListenAddr string // UpstreamAddr is the upstream address the proxy will proxy // TCP/UDP traffic to, e.g. "127.0.0.1:8080" UpstreamAddr string // NewConnectionCallback is a function of no arguments, // optional. If provided, then it is called synchronously when // a new connection is accepted, but before the connection is // proxied to the upstream address. This could be used to // track metrics on incoming connections, or to ensure that // the upstream is available before traffic is proxied to it. NewConnectionCallback func() }
ProxyOptions is used to configure NewProxy, which see for documentation. All fields are required except NewConnectionCallback.
type SubprocessManager ¶
type SubprocessManager struct { Command []string TerminationGracePeriod time.Duration EnsureListeningTimeout time.Duration // contains filtered or unexported fields }
func (*SubprocessManager) EnsureListening ¶
func (sm *SubprocessManager) EnsureListening(port int) error
func (*SubprocessManager) EnsureStarted ¶
func (sm *SubprocessManager) EnsureStarted() error
func (*SubprocessManager) EnsureStopped ¶
func (sm *SubprocessManager) EnsureStopped() error