Documentation ¶
Index ¶
- func ListenAndServe(address string, server Server, opts ...ListenAndServeOption) service.RunFunc
- func NewListener(ctx context.Context, address string, opts ...ListenerOption) (net.Listener, error)
- func Serve(server Server, listener net.Listener, opts ...ServeOption) service.RunFunc
- type ListenAndServeOption
- type ListenerOption
- func ListenWithIntermediateTLSConfig(certFile, keyFile string, customizeFunc ...func(*tls.Config)) ListenerOption
- func ListenWithKeepAlive(keepAlive time.Duration) ListenerOption
- func ListenWithModernTLSConfig(certFile, keyFile string, customizeFunc ...func(*tls.Config)) ListenerOption
- func ListenWithNetwork(network string) ListenerOption
- func ListenWithTLSConfig(cfg *tls.Config) ListenerOption
- func ListenWithoutKeepAlive() ListenerOption
- type ServeOption
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
func ListenAndServe(address string, server Server, opts ...ListenAndServeOption) service.RunFunc
ListenAndServe is a shortcut for NewListener and Serve.
func NewListener ¶
NewListener creates a new listener.
Types ¶
type ListenAndServeOption ¶ added in v1.0.2
type ListenAndServeOption any
ListenAndServeOption allow underlying option to be of type ListenerOption or ServeOption.
type ListenerOption ¶
type ListenerOption func(*listenerOptions) error
ListenerOption defines options applier for the listener.
func ListenWithIntermediateTLSConfig ¶
func ListenWithIntermediateTLSConfig(certFile, keyFile string, customizeFunc ...func(*tls.Config)) ListenerOption
ListenWithIntermediateTLSConfig sets the tls configuration for tls.NewListener. "Intermediate" is defined based on this website: https://wiki.mozilla.org/Security/Server_Side_TLS.
func ListenWithKeepAlive ¶
func ListenWithKeepAlive(keepAlive time.Duration) ListenerOption
ListenWithKeepAlive sets keepalive period.
func ListenWithModernTLSConfig ¶
func ListenWithModernTLSConfig(certFile, keyFile string, customizeFunc ...func(*tls.Config)) ListenerOption
ListenWithModernTLSConfig sets the tls configuration for tls.NewListener. "Modern" is defined based on this website: https://wiki.mozilla.org/Security/Server_Side_TLS.
func ListenWithNetwork ¶
func ListenWithNetwork(network string) ListenerOption
ListenWithNetwork sets the network parameter for net.Listen().
func ListenWithTLSConfig ¶
func ListenWithTLSConfig(cfg *tls.Config) ListenerOption
ListenWithTLSConfig sets the tls configuration for tls.NewListener.
func ListenWithoutKeepAlive ¶
func ListenWithoutKeepAlive() ListenerOption
ListenWithoutKeepAlive disables the keepalive on the listener.
type ServeOption ¶
type ServeOption func(*serveOptions)
ServeOption defines options applier for the server.
func ServerWithServeErrorTransformer ¶
func ServerWithServeErrorTransformer(f func(error) error) ServeOption
ServerWithServeErrorTransformer sets a function to transform serve errors.
func ServerWithShutdownErrorTransformer ¶
func ServerWithShutdownErrorTransformer(f func(error) error) ServeOption
ServerWithShutdownErrorTransformer sets a function to transform shutdown errors.
func ServerWithShutdownTimeout ¶ added in v1.0.3
func ServerWithShutdownTimeout(timeout time.Duration) ServeOption
ServerWithShutdownTimeout sets the provider timeout to shut down.