Documentation
¶
Index ¶
- func IsValidMonitorDNSName(name string) bool
- func NewConnectServer(srv *Server) *conServer
- func NewLoggingServerHooks() *twirp.ServerHooks
- func WithLogger(h http.Handler, l *slog.Logger) http.Handler
- func WithUserAgent(base http.Handler) http.Handler
- type AuthMethod
- type Config
- type CounterOpt
- type JWTAuthenticator
- type JWTClaims
- type MonitorSettings
- type Server
- func (srv *Server) GetConfig(ctx context.Context, monIP string) (*ntpdb.MonitorConfig, error)
- func (srv *Server) GetServers(ctx context.Context, monID string) (*ServerListResponse, error)
- func (srv *Server) Run() error
- func (srv *Server) SignIPs(monitorID uint32, batchID []byte, ip *netip.Addr) ([]byte, error)
- func (srv *Server) SubmitResults(ctx context.Context, in SubmitResultsParam, monIP string) (bool, error)
- func (srv *Server) ValidateIPs(signature []byte, monitorID uint32, batchID []byte, ip *netip.Addr) (bool, error)
- type ServerListResponse
- type SubmitCounters
- type SubmitResultsParam
- type TwServer
- func (s *TwServer) GetConfig(ctx context.Context, in *pb.GetConfigParams) (*pb.Config, error)
- func (s *TwServer) GetServers(ctx context.Context, in *pb.GetServersParams) (*pb.ServerList, error)
- func (s *TwServer) SubmitResults(ctx context.Context, in *pb.ServerStatusList) (*pb.ServerStatusResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsValidMonitorDNSName ¶
IsValidMonitorDNSName validates DNS names for monitor certificates Monitor names are always 5 parts: host.environment.mon.ntppool.dev
func NewConnectServer ¶
func NewConnectServer(srv *Server) *conServer
func NewLoggingServerHooks ¶
func NewLoggingServerHooks() *twirp.ServerHooks
Types ¶
type AuthMethod ¶
type AuthMethod string
AuthMethod represents the authentication method used
const ( AuthMethodMTLS AuthMethod = "mtls" AuthMethodJWT AuthMethod = "jwt" )
type Config ¶
type Config struct {
DeploymentEnv depenv.DeploymentEnvironment
Listen string
JWTKey string
CertProvider apitls.AuthProvider
}
type CounterOpt ¶
type JWTAuthenticator ¶
type JWTAuthenticator struct {
// contains filtered or unexported fields
}
JWTAuthenticator handles JWT token validation using JWKS
func NewJWTAuthenticator ¶
func NewJWTAuthenticator(ctx context.Context, deploymentEnv depenv.DeploymentEnvironment) (*JWTAuthenticator, error)
NewJWTAuthenticator creates a new JWT authenticator with JWKS support
func (*JWTAuthenticator) ValidateToken ¶
func (j *JWTAuthenticator) ValidateToken(ctx context.Context, tokenString string) (*JWTClaims, error)
ValidateToken validates a JWT token and returns the claims
type JWTClaims ¶
type JWTClaims struct {
jwt.RegisteredClaims
Monitor string `json:"monitor,omitempty"`
Scope string `json:"scope,omitempty"`
}
JWTClaims represents the expected JWT claims structure
type MonitorSettings ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(ctx context.Context, cfg Config, dbconn *sql.DB, promRegistry prometheus.Registerer) (*Server, error)
func (*Server) GetServers ¶
func (*Server) SubmitResults ¶
type ServerListResponse ¶
type ServerListResponse struct {
BatchID []byte
Config *ntpdb.MonitorConfig
Servers []ntpdb.Server
// contains filtered or unexported fields
}
type SubmitCounters ¶
type SubmitCounters struct {
Ok *CounterOpt
Offset *CounterOpt
Timeout *CounterOpt
Sig *CounterOpt
BatchOrder *CounterOpt
}
type SubmitResultsParam ¶
type SubmitResultsParam struct {
Version int32
List []*apiv2.ServerStatus
BatchId []byte
}
type TwServer ¶
type TwServer struct {
// contains filtered or unexported fields
}
func NewTwServer ¶
func (*TwServer) GetServers ¶
func (s *TwServer) GetServers(ctx context.Context, in *pb.GetServersParams) (*pb.ServerList, error)
func (*TwServer) SubmitResults ¶
func (s *TwServer) SubmitResults(ctx context.Context, in *pb.ServerStatusList) (*pb.ServerStatusResult, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.