Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPinnedPortInUse = errors.New("unable to bind to pinned port")
Functions ¶
This section is empty.
Types ¶
type AutoPortListenerSource ¶
type AutoPortListenerSource struct{}
AutoPortListenerSource means listen on a port that's picked automatically by the kernel.
func NewAutoPortListenerSource ¶
func NewAutoPortListenerSource() *AutoPortListenerSource
NewAutoPortListenerSource creates a new AutoPortListenerSource.
func (AutoPortListenerSource) GetListener ¶
func (r AutoPortListenerSource) GetListener() (net.Listener, string, error)
GetListener implements ListenerSource.
type ListenerSource ¶
ListenerSource represents where an HTTP server should listen.
type PortRangeListenerSource ¶
PortRangeListenerSource means listen on the given range.
func NewFixedPortListenerSource ¶
func NewFixedPortListenerSource(port int) *PortRangeListenerSource
NewFixedPortListenerSource creates a new PortListenerSource listening on the given port.
func NewPortRangeListenerSource ¶
func NewPortRangeListenerSource(low, high int) *PortRangeListenerSource
NewPortRangeListenerSource creates a new PortListenerSource listening on low to high (inclusive).
func (*PortRangeListenerSource) GetListener ¶
func (p *PortRangeListenerSource) GetListener() (listener net.Listener, address string, err error)
GetListener implements ListenerSource.
type RandomPortRangeListenerSource ¶
RandomPortRangeListenerSource listens on a port randomly chosen within a given range.
func NewRandomPortRangeListenerSource ¶
func NewRandomPortRangeListenerSource(low, high int) *RandomPortRangeListenerSource
NewRandomPortRangeListenerSource creates a new RadomPortListenerSource listening on low to high (exclusive).
func (*RandomPortRangeListenerSource) GetListener ¶
func (p *RandomPortRangeListenerSource) GetListener() (listener net.Listener, address string, err error)
GetListener implements ListenerSource.
type Srv ¶
Srv starts a simple HTTP server with a parameter for a module to provide a listener source
func NewSrv ¶
func NewSrv(log logger.Logger, listenerSource ListenerSource) *Srv
NewSrv creates a new HTTP server with the given listener source.