server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2023 License: MIT Imports: 20 Imported by: 0

README

server

This folder contains the module for starting the server service.

Documentation

Index

Constants

This section is empty.

Variables

Functions

func BasicAuth

func BasicAuth(username, password string) func(next http.Handler) http.Handler

func CanAccept

func CanAccept(r *http.Request, values ...string) bool

func Lifecycle

func Lifecycle(lifecycle fx.Lifecycle, listener net.Listener, server *http.Server)

Lifecycle runs the HTTP Server

func NewHandler

func NewHandler(params HandlerParams) http.Handler

func NewListener

func NewListener(config Config) (net.Listener, error)

NewListener returns a net.Listener for the given config

func NewServer

func NewServer(handler http.Handler) *http.Server

NewServer returns a new http.Server

func NewTLSConfig

func NewTLSConfig(cfg TLSConfig) (*tls.Config, error)

NewTLSConfig returns a tls.Config for the given Config

func WriteError

func WriteError(w http.ResponseWriter, metadata *types.Metadata, statusCode int, status string, message string)

Types

type Config

type Config struct {
	Bind     string
	Listen   uint
	TLS      TLSConfig
	Username string
	Password string
}

func NewConfig

func NewConfig() Config

func (Config) Addr

func (c Config) Addr() string

type Handler

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

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HandlerParams

type HandlerParams struct {
	fx.In

	Config             Config
	Access             types.AccessHandler             `optional:"true"`
	Delete             types.DeleteHandler             `optional:"true"`
	Correction         types.CorrectionHandler         `optional:"true"`
	RestrictProcessing types.RestrictProcessingHandler `optional:"true"`
}

type TLSConfig

type TLSConfig struct {
	CertFile   string
	KeyFile    string
	RootCAFile string
}

func (TLSConfig) GetEnabled

func (c TLSConfig) GetEnabled() bool

Jump to

Keyboard shortcuts

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