server

package
v0.0.0-...-07a5409 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0, MIT Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// IPNIPath is the path that the Publisher expects as the last port of the
	// HTTP request URL path. The sync client automatically adds this to the
	// request path.
	IPNIPath = "/ipni/v1/ad"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config) error

Option is a function that sets a value in a config.

func WithHTTPListenAddrs

func WithHTTPListenAddrs(addr string) Option

WithHTTPListenAddrs sets the HTTP addresse to listen on. These are in addresses:port format

Setting HTTP listen addresses is optional when a stream host is provided by the WithStreamHost option.

func WithHandlerPath

func WithHandlerPath(urlPath string) Option

WithHandlerPath sets the path used to handle requests to this publisher. This specifies the portion of the path before the implicit /ipni/v1/ad/ part of the path. Calling WithHandlerPath("/foo/bar") configures the publisher to handle HTTP requests on the path "/foo/bar/ipni/v1/ad/".

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(store store.EncodeableStore, options ...Option) (*Server, error)

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) Start

func (s *Server) Start(ctx context.Context) error

Jump to

Keyboard shortcuts

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