httpserver

package
v1.4.6 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// CorsAllowCredentials CORS setting to control whether a browser allows credentials to be sent to this API
	CorsAllowCredentials = "credentials"
	// CorsAllowedHeaders CORS setting to control the allowed headers
	CorsAllowedHeaders = "headers"
	// CorsAllowedMethods CORS setting to control the allowed methods
	CorsAllowedMethods = "methods"
	// CorsAllowedOrigins CORS setting to control the allowed origins
	CorsAllowedOrigins = "origins"
	// CorsDebug is whether debug is enabled for the CORS implementation
	CorsDebug = "debug"
	// CorsEnabled is whether cors is enabled
	CorsEnabled = "enabled"
	// CorsMaxAge is the maximum age a browser should rely on CORS checks
	CorsMaxAge = "maxAge"
)
View Source
const (
	// HTTPConfAddress the local address to listen on
	HTTPConfAddress = "address"
	// HTTPConfPublicURL the public address of the node to advertise in the swagger
	HTTPConfPublicURL = "publicURL"
	// HTTPConfPort the local port to listen on for HTTP/Websocket connections
	HTTPConfPort = "port"
	// HTTPConfReadTimeout the write timeout for the HTTP server
	HTTPConfReadTimeout = "readTimeout"
	// HTTPConfWriteTimeout the write timeout for the HTTP server
	HTTPConfWriteTimeout = "writeTimeout"
	// HTTPConfShutdownTimeout The maximum amount of time to wait for any open HTTP requests to finish before shutting down the HTTP server
	HTTPConfShutdownTimeout = "shutdownTimeout"
	// HTTPAuthType the auth plugin to use for the HTTP server
	HTTPAuthType = "auth.type"
)
View Source
const (

	// DebugEnabled is whether to actually run the debug server or not
	DebugEnabled = "enabled"
)

Variables

This section is empty.

Functions

func InitCORSConfig

func InitCORSConfig(conf config.Section)

func InitDebugConfig added in v1.2.8

func InitDebugConfig(conf config.Section)

func InitHTTPConfig added in v0.1.4

func InitHTTPConfig(conf config.Section, defaultPort int)

func RunDebugServer added in v1.2.8

func RunDebugServer(ctx context.Context, debugServerConf config.Section, captureAddr ...func(addr net.Addr))

func WrapCorsIfEnabled added in v1.2.11

func WrapCorsIfEnabled(ctx context.Context, conf config.Section, chain http.Handler) http.Handler

Types

type GoHTTPServer

type GoHTTPServer interface {
	Close() error
	Serve(l net.Listener) error
	ServeTLS(l net.Listener, certFile, keyFile string) error
	Shutdown(ctx context.Context) error
}

type HTTPServer

type HTTPServer interface {
	ServeHTTP(ctx context.Context)
	Addr() net.Addr
}

func NewHTTPServer

func NewHTTPServer(ctx context.Context, name string, r *mux.Router, onClose chan error, conf config.Section, corsConf config.Section, opts ...*ServerOptions) (is HTTPServer, err error)

type ServerOptions added in v0.1.20

type ServerOptions struct {
	MaximumRequestTimeout time.Duration
}

ServerOptions are config parameters that are not set from the config, but rather the context in which the HTTP server is being used

Jump to

Keyboard shortcuts

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