Documentation ¶
Index ¶
- func InitPeerMeta() map[string]string
- type CoreServer
- type HttpMux
- type ListableMux
- func (mux *ListableMux) DeregisterPattern(pattern string)
- func (mux *ListableMux) Handle(pattern string, handler http.Handler)
- func (mux *ListableMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
- func (mux *ListableMux) Handler(r *http.Request) (h http.Handler, pattern string)
- func (mux *ListableMux) Patterns() (patterns []string)
- func (mux *ListableMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type Option
- type Options
- type PatternsProvider
- type RawServer
- type ServeOption
- func WithAfterServe(f func(oo ...registry.RegisterOption) error) ServeOption
- func WithBeforeServe(f func(oo ...registry.RegisterOption) error) ServeOption
- func WithErrorCallback(cb func(err error)) ServeOption
- func WithGrpcBindAddress(a string) ServeOption
- func WithHttpBindAddress(a string) ServeOption
- type ServeOptions
- type Server
- type Type
- type URLMux
- type URLOpener
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitPeerMeta ¶
Types ¶
type CoreServer ¶ added in v4.0.1
type ListableMux ¶
type ListableMux struct {
// contains filtered or unexported fields
}
ListableMux is a simple rewrite of http.ServeMux with accessor to the list of registered patterns
func NewListableMux ¶
func NewListableMux() *ListableMux
NewListableMux allocates and returns a new ListableMux.
func (*ListableMux) DeregisterPattern ¶ added in v4.0.1
func (mux *ListableMux) DeregisterPattern(pattern string)
func (*ListableMux) Handle ¶
func (mux *ListableMux) Handle(pattern string, handler http.Handler)
Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.
func (*ListableMux) HandleFunc ¶
func (mux *ListableMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
HandleFunc registers the handler function for the given pattern.
func (*ListableMux) Handler ¶
Handler returns the handler to use for the given request, consulting r.Method, r.Host, and r.URL.Path. It always returns a non-nil handler. If the path is not in its canonical form, the handler will be an internally-generated handler that redirects to the canonical path. If the host contains a port, it is ignored when matching handlers.
The path and host are used unchanged for CONNECT requests.
Handler also returns the registered pattern that matches the request or, in the case of internally-generated redirects, the pattern that will match after following the redirect.
If there is no registered handler that applies to the request, Handler returns a “page not found” handler and an empty pattern.
func (*ListableMux) Patterns ¶
func (mux *ListableMux) Patterns() (patterns []string)
Patterns list registered patterns using the internal lock on the mux.m map
func (*ListableMux) ServeHTTP ¶
func (mux *ListableMux) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP dispatches the request to the handler whose pattern most closely matches the request URL.
type PatternsProvider ¶
type RawServer ¶
type RawServer interface { CoreServer Stop() error RawServe(options *ServeOptions) ([]registry.Item, error) }
type ServeOption ¶ added in v4.0.1
type ServeOption func(options *ServeOptions)
func WithAfterServe ¶ added in v4.0.1
func WithAfterServe(f func(oo ...registry.RegisterOption) error) ServeOption
func WithBeforeServe ¶ added in v4.0.1
func WithBeforeServe(f func(oo ...registry.RegisterOption) error) ServeOption
func WithErrorCallback ¶ added in v4.0.1
func WithErrorCallback(cb func(err error)) ServeOption
func WithGrpcBindAddress ¶ added in v4.0.1
func WithGrpcBindAddress(a string) ServeOption
func WithHttpBindAddress ¶ added in v4.0.1
func WithHttpBindAddress(a string) ServeOption
type ServeOptions ¶ added in v4.0.1
type ServeOptions struct { HttpBindAddress string GrpcBindAddress string ErrorCallback func(error) BeforeServe []func(oo ...registry.RegisterOption) error AfterServe []func(oo ...registry.RegisterOption) error RegistryOptions []registry.RegisterOption }
type Server ¶
type Server interface { CoreServer Serve(...ServeOption) error Stop(oo ...registry.RegisterOption) error Is(status registry.Status) bool NeedsRestart() bool }
func OpenServer ¶ added in v4.0.1
OpenServer opens the Registry identified by the URL given. See the URLOpener documentation in driver subpackages for details on supported URL formats, and https://gocloud.dev/concepts/urls for more information.
type URLMux ¶ added in v4.0.1
type URLMux struct {
// contains filtered or unexported fields
}
URLMux is a URL opener multiplexer. It matches the scheme of the URLs against a set of registered schemes and calls the opener that matches the URL's scheme. See https://gocloud.dev/concepts/urls/ for more information.
The zero value is a multiplexer with no registered schemes.
func DefaultURLMux ¶ added in v4.0.1
func DefaultURLMux() *URLMux
DefaultURLMux returns the URLMux used by OpenTopic and OpenSubscription.
Driver packages can use this to register their TopicURLOpener and/or SubscriptionURLOpener on the mux.
func (*URLMux) OpenServer ¶ added in v4.0.1
OpenServer calls OpenTopicURL with the URL parsed from urlstr. OpenTopic is safe to call from multiple goroutines.
func (*URLMux) Register ¶ added in v4.0.1
Register registers the opener with the given scheme. If an opener already exists for the scheme, Register panics.
func (*URLMux) ValidScheme ¶ added in v4.0.1
ValidScheme returns true if scheme has been registered.
Directories ¶
Path | Synopsis |
---|---|
Package servercontext performs context values read/write, generally through server or client wrappers
|
Package servercontext performs context values read/write, generally through server or client wrappers |