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 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 RandomPortListenerSource ¶
type RandomPortListenerSource struct{}
RandomPortListenerSource means listen on a random port.
func NewRandomPortListenerSource ¶
func NewRandomPortListenerSource() *RandomPortListenerSource
NewRandomPortListenerSource creates a new RandomPortListenerSource.
func (RandomPortListenerSource) GetListener ¶
func (r RandomPortListenerSource) GetListener() (net.Listener, string, 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.