Documentation
¶
Index ¶
- Constants
- func RegisterServer(ctx context.Context, scheme string, f ServerInitializeFunc) error
- func Schemes() []string
- type HTTPServer
- type LambdaFunctionURLServer
- type LambdaServer
- type Server
- func NewHTTPServer(ctx context.Context, uri string) (Server, error)
- func NewLambdaFunctionURLServer(ctx context.Context, uri string) (Server, error)
- func NewLambdaServer(ctx context.Context, uri string) (Server, error)
- func NewMkCertServer(ctx context.Context, uri string) (Server, error)
- func NewServer(ctx context.Context, uri string) (Server, error)
- type ServerInitializeFunc
Constants ¶
const MKCERT string = "mkcert"
Variables ¶
This section is empty.
Functions ¶
func RegisterServer ¶
func RegisterServer(ctx context.Context, scheme string, f ServerInitializeFunc) error
RegisterServer() associates 'scheme' with 'f' in an internal list of avilable `Server` implementations.
Types ¶
type HTTPServer ¶
type HTTPServer struct { Server // contains filtered or unexported fields }
HTTPServer implements the `Server` interface for a basic `net/http` server.
func (*HTTPServer) Address ¶
func (s *HTTPServer) Address() string
Address returns the fully-qualified URI where the server instance can be contacted.
func (*HTTPServer) ListenAndServe ¶
ListenAndServe starts the server and listens for requests using 'mux' for routing.
type LambdaFunctionURLServer ¶
type LambdaFunctionURLServer struct { Server // contains filtered or unexported fields }
LambdaFunctionURLServer implements the `Server` interface for a use in a AWS LambdaFunctionURL + API Gateway context.
func (*LambdaFunctionURLServer) Address ¶
func (s *LambdaFunctionURLServer) Address() string
Address returns the fully-qualified URL used to instantiate 's'.
func (*LambdaFunctionURLServer) ListenAndServe ¶
ListenAndServe starts the serve and listens for requests using 'mux' for routing.
type LambdaServer ¶
type LambdaServer struct { Server // contains filtered or unexported fields }
LambdaServer implements the `Server` interface for a use in a AWS Lambda + API Gateway context.
func (*LambdaServer) Address ¶
func (s *LambdaServer) Address() string
Address returns the fully-qualified URL used to instantiate 's'.
func (*LambdaServer) ListenAndServe ¶
ListenAndServe starts the serve and listens for requests using 'mux' for routing.
type Server ¶
type Server interface { // ListenAndServe starts the server and listens for requests using a `http.Handler` instance for routing. ListenAndServe(context.Context, http.Handler) error // Address returns the fully-qualified URI that the server is listening for requests on. Address() string }
type Server is an interface for creating server instances that serve requests using a `http.Handler` router.
func NewHTTPServer ¶
NewHTTPServer returns a new `HTTPServer` instance configured by 'uri' which is expected to be defined in the form of:
{SCHEME}://{ADDRESS}:{PORT}?{PARAMETERS}
Where {SCHEME} is either 'http' or 'https'; {ADDRESS} and {PORT} are the address and port to listen for requests on. Valid parameters are: * `tls_cert={CERTIFICATE}` The path for a TLS certificate to use; required if {SCHEME} is 'https'. * `tls_key={KEY}` The path for a TLS key to use; required if {SCHEME} is 'https' * `read_timeout={SECONDS}` A custom setting for HTTP read timeouts. Default is 2 seconds. * `write_timeout={SECONDS}` A custom setting for HTTP write timeouts. Default is 10 seconds. * `idle_timeout={SECONDS}` A custom setting for HTTP idle timeouts. Default is 15 seconds. * `header_timeout={SECONDS}` A custom setting for HTTP header timeouts. Default is 2 seconds.
func NewLambdaFunctionURLServer ¶
NewLambdaFunctionURLServer returns a new `LambdaFunctionURLServer` instance configured by 'uri' which is expected to be defined in the form of:
functionurl://?{PARAMETERS}
Valid parameters are: * `binary_type={MIMETYPE}` One or more mimetypes to be served by AWS FunctionURLs as binary content types.
func NewLambdaServer ¶
NewLambdaServer returns a new `LambdaServer` instance configured by 'uri' which is expected to be defined in the form of:
lambda://?{PARAMETERS}
Valid parameters are: * `binary_type={MIMETYPE}` One or more mimetypes to be served by AWS API Gateway as binary content types.
func NewMkCertServer ¶
NewMkCertServer returns a new `HTTPServer` instance configured using 'uri' in the form of:
mkcert://?{PARAMETERS}
Valid parameters are:
- `root={PATH}` An optional path to specify where `mkcert` certificates and keys should be created. If missing the operating system's temporary directory will be used.