server

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2025 License: BSD-3-Clause-Clear Imports: 32 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" default:"[\"GET\",\"POST\",\"PATCH\",\"DELETE\",\"OPTIONS\"]"`
	AllowedHeaders   []string `` /* 224-byte string literal not displayed */
	ExposedHeaders   []string `mapstructure:"exposedheaders" json:"exposedheaders"`
	AllowCredentials bool     `mapstructure:"allowcredentials" json:"allowedcredentials" default:"true"`
	MaxAge           int      `mapstructure:"maxage" json:"maxage" default:"3600"`
	Debug            bool     `mapstructure:"debug" json:"debug"`
}

CORS Configuration for the server

type Config

type Config struct {
	Auth auth.Config `mapstructure:"auth" json:"auth"`

	Cache cache.Config `mapstructure:"cache" json:"cache"`

	GRPC GRPCConfig `mapstructure:"grpc" json:"grpc"`
	// To Deprecate: Use the WithKey[X]Provider StartOptions to register trust providers.
	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"`
	PublicHostname string `mapstructure:"public_hostname,omitempty" json:"publicHostname"`
	// Http server config
	HTTPServerConfig HTTPServerConfig `mapstructure:"http" json:"http"`
	// Enable pprof
	EnablePprof bool `mapstructure:"enable_pprof" json:"enable_pprof" default:"false"`
	// Trace is for configuring open telemetry based tracing.
	Trace tracing.Config `mapstructure:"trace"`
}

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 HTTPServerConfig added in v0.7.2

type HTTPServerConfig struct {
	ReadTimeout       time.Duration `mapstructure:"readTimeout" json:"readTimeout"`
	ReadHeaderTimeout time.Duration `mapstructure:"readHeaderTimeout" json:"readHeaderTimeout"`
	WriteTimeout      time.Duration `mapstructure:"writeTimeout" json:"writeTimeout"`
	IdleTimeout       time.Duration `mapstructure:"idleTimeout" json:"idleTimeout"`
	MaxHeaderBytes    int           `mapstructure:"maxHeaderBytes" json:"maxHeaderBytes"`
}

type OpenTDFServer

type OpenTDFServer struct {
	AuthN               *auth.Authentication
	GRPCGatewayMux      *runtime.ServeMux
	HTTPServer          *http.Server
	ConnectRPCInProcess *inProcessServer
	ConnectRPC          *ConnectRPC
	CacheManager        *cache.Manager

	// To Deprecate: Use the TrustKeyIndex and TrustKeyManager instead
	CryptoProvider *security.StandardCrypto
	Listener       net.Listener

	PublicHostname string
	// contains filtered or unexported fields
}

func NewOpenTDFServer

func NewOpenTDFServer(config Config, logger *logger.Logger, cacheManager *cache.Manager) (*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