server

package
v0.4.33 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: BSD-3-Clause-Clear Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CORSConfig added in v0.4.1

type CORSConfig struct {
	// Enable CORS for the server (default: true)
	Enabled          bool     `mapstructure:"enabled" json:"enabled" default:"true"`
	AllowedOrigins   []string `mapstructure:"allowedorigins" json:"allowedorigins"`
	AllowedMethods   []string `mapstructure:"allowedmethods" json:"allowedmethods"`
	AllowedHeaders   []string `mapstructure:"allowedheaders" json:"allowedheaders"`
	ExposedHeaders   []string `mapstructure:"exposedheaders" json:"exposedheaders"`
	AllowCredentials bool     `mapstructure:"allowcredentials" json:"allowedcredentials" default:"true"`
	MaxAge           int      `mapstructure:"maxage" json:"maxage" default:"3600"`
}

CORS Configuration for the server

type Config

type Config struct {
	Auth                    auth.Config                              `mapstructure:"auth" json:"auth"`
	GRPC                    GRPCConfig                               `mapstructure:"grpc" json:"grpc"`
	CryptoProvider          security.Config                          `mapstructure:"cryptoProvider" json:"cryptoProvider"`
	TLS                     TLSConfig                                `mapstructure:"tls" json:"tls"`
	CORS                    CORSConfig                               `mapstructure:"cors" json:"cors"`
	WellKnownConfigRegister func(namespace string, config any) error `mapstructure:"-" json:"-"`
	// Port to listen on
	Port int    `mapstructure:"port" json:"port" default:"8080"`
	Host string `mapstructure:"host,omitempty" json:"host"`
	// Enable pprof
	EnablePprof bool `mapstructure:"enable_pprof" json:"enable_pprof" default:"false"`
}

Configurations for the server

func (Config) LogValue added in v0.4.19

func (c Config) LogValue() slog.Value

type ConnectRPC added in v0.4.27

type ConnectRPC struct {
	Mux               *http.ServeMux
	Interceptors      []connect.HandlerOption
	ServiceReflection []string
}

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type GRPCConfig

type GRPCConfig struct {
	// Enable reflection for grpc server (default: true)
	ReflectionEnabled bool `mapstructure:"reflectionEnabled" json:"reflectionEnabled" default:"true"`

	MaxCallRecvMsgSizeBytes int `mapstructure:"maxCallRecvMsgSize" json:"maxCallRecvMsgSize" default:"4194304"` // 4MB = 4 * 1024 * 1024 = 4194304
	MaxCallSendMsgSizeBytes int `mapstructure:"maxCallSendMsgSize" json:"maxCallSendMsgSize" default:"4194304"` // 4MB = 4 * 1024 * 1024 = 4194304
}

GRPC Server specific configurations

type OpenTDFServer

type OpenTDFServer struct {
	AuthN               *auth.Authentication
	GRPCGatewayMux      *runtime.ServeMux
	HTTPServer          *http.Server
	ConnectRPCInProcess *inProcessServer
	ConnectRPC          *ConnectRPC
	CryptoProvider      security.CryptoProvider
	// contains filtered or unexported fields
}

func NewOpenTDFServer

func NewOpenTDFServer(config Config, logger *logger.Logger) (*OpenTDFServer, error)

func (OpenTDFServer) Start

func (s OpenTDFServer) Start() error

func (OpenTDFServer) Stop

func (s OpenTDFServer) Stop()

type TLSConfig

type TLSConfig struct {
	// Enable TLS for the server (default: false)
	Enabled bool `mapstructure:"enabled" json:"enabled" default:"false"`
	// Path to the certificate file
	Cert string `mapstructure:"cert" json:"cert"`
	// Path to the key file
	Key string `mapstructure:"key" json:"key"`
}

TLS Configuration for the server

Directories

Path Synopsis
Package memhttp provides an in-memory HTTP server and client.
Package memhttp provides an in-memory HTTP server and client.

Jump to

Keyboard shortcuts

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