gonesrv

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 6 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoListener = errors.New("No Listener")

ErrNoListener is returned from Listen() when the Server didn't manage to find the required inherited socket to listen on (when Server.InheritOnly is true)

Functions

This section is empty.

Types

type Server

type Server struct {
	*graceful.Server

	// ListenerFdName can be set to pick a named file descriptor as
	// Listener via LISTEN_FDNAMES
	// It is updated to contain the name of the chosen file descriptor
	// - if any
	ListenerFdName string

	// Extra sd.FileTest to apply to the listener inherited.
	ExtraFileTests []sd.FileTest

	// InheritOnly set to true requires the Listener to be inherited via
	// the environment and there will not be created a fresh Listener.
	// Setting InheritOnly true will also disable port 80 as default port
	// and let the Serve listen on any inherited TCP socket it gets
	InheritOnly bool

	// PrepareListener provides a callback to do last minute modifications of
	// the chosen listener. (like wrapping it in something else)
	// It will be called as a callback with the listener chosen before it's set.
	// The returned listener is set instead - wrapped in any TLS if
	// there's a TLSConfig set.
	PrepareListener func(net.Listener) net.Listener
	// contains filtered or unexported fields
}

Server wraps around gone/http/graceful HTTP server implementing gone/the daemon/srv.Server interface If ErrorLog is set, errors will be logged to it.

func (*Server) Description

func (srv *Server) Description() string

Description implement gone/daemon/srv.Descripter interface.

func (*Server) Listen

func (srv *Server) Listen() (err error)

Listen implement the gone/daemon/src.Listener interface and pick an already open listener FD or create one.

func (*Server) Serve

func (srv *Server) Serve() (err error)

Serve implement the gone/daemon/srv.Server interface. Shutdown is already implemented by the graceful server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL