server

package
v0.0.0-...-29c3169 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MIT Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLoggingServerHooks

func NewLoggingServerHooks() *twirp.ServerHooks

func WithUserAgent

func WithUserAgent(base http.Handler) http.Handler

Types

type Config

type Config struct {
	DeploymentEnv string
	Listen        string
	JWTKey        string
	CertProvider  apitls.CertificateProvider
}

type CounterOpt

type CounterOpt struct {
	Name    string
	Counter int
}

type MonitorSettings

type MonitorSettings struct {
	IntervalActive  timeutil.Duration `json:"interval_active"`
	IntervalTesting timeutil.Duration `json:"interval_testing"`
	IntervalAll     timeutil.Duration `json:"interval_all"`
	BatchSize       int32             `json:"batch_size"`
}

type Server

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

func NewServer

func NewServer(ctx context.Context, log *slog.Logger, cfg Config, dbconn *sql.DB, promRegistry prometheus.Registerer) (*Server, error)

func (*Server) GetConfig

func (srv *Server) GetConfig(ctx context.Context, in *pb.GetConfigParams) (*pb.Config, error)

func (*Server) GetServers

func (srv *Server) GetServers(ctx context.Context, in *pb.GetServersParams) (*pb.ServerList, error)

func (*Server) Run

func (srv *Server) Run() error

func (*Server) SignIPs

func (srv *Server) SignIPs(monitorID uint32, batchID []byte, ip *netip.Addr) ([]byte, error)

func (*Server) SubmitResults

func (srv *Server) SubmitResults(ctx context.Context, in *pb.ServerStatusList) (*pb.ServerStatusResult, error)

func (*Server) ValidateIPs

func (srv *Server) ValidateIPs(signature []byte, monitorID uint32, batchID []byte, ip *netip.Addr) (bool, error)

type SubmitCounters

type SubmitCounters struct {
	Ok         *CounterOpt
	Offset     *CounterOpt
	Timeout    *CounterOpt
	Sig        *CounterOpt
	BatchOrder *CounterOpt
}

Directories

Path Synopsis
cmd
twirp
Package prometheus is Twirp server hook that collects Prometheus metrics.
Package prometheus is Twirp server hook that collects Prometheus metrics.
http request to mqtt requests api
http request to mqtt requests api

Jump to

Keyboard shortcuts

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