Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ListenerFactory ¶
type ListenerFactory interface { //Listener should return a new net.Listener that is open and available for use //or an error if there is a failure. Listener() (net.Listener, error) }
ListenerFactory provides the Listener method that is used to create a net.Listener.
type PortListenerFactory ¶
type PortListenerFactory int
PortListenerFactory is a ListenerFactory that returns a Listener by listening via tcp4 on the loopback interface and the port represented by this value.
type Server ¶
type Server struct { //ListenerFactory is the promoted factory used to create a Listener. //Must not be nil. ListenerFactory // contains filtered or unexported fields }
Server is a wrapper for the http.Server to use in the application.
func (*Server) Serve ¶
Serve attempts to serve h on the Listener returned from s.ListenerFactory. If a Listener could not be created, then that error is returned immediately. Otherwise, an http.Server is created to use h and its Serve method is called with the new Listener.
The new Listener is closed before this method returns.
A non-nil error means serving has failed in some way. If s is stoped via a call to s.Shutdown, then the error returned should be nil if nothing went wrong during the shutdown process.