stdserver

package
v0.0.0-...-9e054ec Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package stdserver contains a generic HTTP server that can be used by sources that receive http requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Authenticator

func Authenticator(
	ctx *stopper.Context,
	diags *diag.Diagnostics,
	config *Config,
	pool *types.StagingPool,
	stagingDB ident.StagingSchema,
) (types.Authenticator, error)

Authenticator constructs a JWT-based authenticator, or a no-op authenticator if Config.DisableAuth has been set.

func Listener

func Listener(ctx *stopper.Context, config *Config, diags *diag.Diagnostics) (net.Listener, error)

Listener constructs the incoming network socket for the server.

func Mux

func Mux(
	handler http.Handler, stagingPool *types.StagingPool, targetPool *types.TargetPool,
) *http.ServeMux

Mux constructs the http.ServeMux that routes requests.

Types

type Config

type Config struct {
	BindAddr           string
	DisableAuth        bool
	GenerateSelfSigned bool
	TLSCertFile        string
	TLSPrivateKey      string
}

Config contains the user-visible configuration for running an http server.

func (*Config) Bind

func (c *Config) Bind(flags *pflag.FlagSet)

Bind registers flags.

func (*Config) Preflight

func (c *Config) Preflight() error

Preflight implements logical.Config.

type Server

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

A Server receives incoming messages and applies them to a target cluster.

func New

func New(
	ctx *stopper.Context,
	auth types.Authenticator,
	diags *diag.Diagnostics,
	listener net.Listener,
	mux *http.ServeMux,
	tlsConfig *tls.Config,
) *Server

New constructs the top-level network server. The server will execute the server on a background goroutine and will gracefully drain the server when the cancel function is called.

func (*Server) GetAuthenticator

func (s *Server) GetAuthenticator() types.Authenticator

GetAuthenticator implements stdlogical.HasAuthenticator.

func (*Server) GetDiagnostics

func (s *Server) GetDiagnostics() *diag.Diagnostics

GetDiagnostics implements stdlogical.HasDiagnostics.

func (*Server) GetServeMux

func (s *Server) GetServeMux() *http.ServeMux

GetServeMux implements stdlogical.HasServeMux.

Jump to

Keyboard shortcuts

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