Documentation ¶
Overview ¶
Package server is an interface for a micro server
Index ¶
- type HandlerFunc
- type HandlerWrapper
- type Option
- func Address(a string) Option
- func Advertise(a string) Option
- func Codec(contentType string, c codec.NewCodec) Option
- func ID(id string) Option
- func Metadata(md map[string]string) Option
- func Name(n string) Option
- func PrivateIPBlocks(blocks string) Option
- func RegisterCheck(fn func(context.Context) error) Option
- func RegisterInterval(t time.Duration) Option
- func RegisterTTL(t time.Duration) Option
- func Registry(r registry.Registry) Option
- func Transport(t transport.Transport) Option
- func Version(v string) Option
- func WrapHandler(w HandlerWrapper) Option
- type Options
- type Request
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
HandlerFunc represents a single method of a handler. It's used primarily for the wrappers. What's handed to the actual method is the concrete request and response types.
type HandlerWrapper ¶
type HandlerWrapper func(HandlerFunc) HandlerFunc
HandlerWrapper wraps the HandlerFunc and returns the equivalent
type Option ¶
type Option func(*Options)
Option option
func PrivateIPBlocks ¶
PrivateIPBlocks When Advertise is "0.0.0.0", "[::]", "::", the network segment in PrivateIPBlocks is preferentially matched. PrivateIPBlocks default value is 192.168.0.0/16. Separator is a comma (,)
func RegisterCheck ¶
RegisterCheck run func before registry service
func RegisterInterval ¶
RegisterInterval Register the service with at interval
func RegisterTTL ¶
RegisterTTL Register the service with a TTL
func WrapHandler ¶
func WrapHandler(w HandlerWrapper) Option
WrapHandler Adds a handler Wrapper to a list of options passed into the server
type Options ¶
type Options struct { Codecs map[string]codec.NewCodec Registry registry.Registry Transport transport.Transport Metadata map[string]string Name string Address string Advertise string PrivateIPBlocks string ID string Version string HdlrWrappers []HandlerWrapper // RegisterCheck runs a check function before registering the service RegisterCheck func(context.Context) error // The register expiry time RegisterTTL time.Duration // The interval on which to register RegisterInterval time.Duration // Other options for implementations of the interface // can be stored in a context Context context.Context }
Options options