Documentation
¶
Index ¶
- func IsNewer(remote, local string) bool
- type AgentBinaryInfo
- type DockerTag
- type GeoIPResolver
- type RegistrationToken
- type ReleaseAsset
- type ReleaseInfo
- type Server
- type ServerConfig
- type TagCache
- type TokenManager
- type UpdateStore
- func (s *UpdateStore) DownloadedVersions() []string
- func (s *UpdateStore) Get(osName, arch string) *AgentBinaryInfo
- func (s *UpdateStore) GetBinary(osName, arch string) ([]byte, *AgentBinaryInfo, error)
- func (s *UpdateStore) GetBinaryVersion(version, osName, arch string) ([]byte, *AgentBinaryInfo, error)
- func (s *UpdateStore) LatestVersion() string
- func (s *UpdateStore) List() []*AgentBinaryInfo
- func (s *UpdateStore) Store(version, osName, arch string, data []byte) (*AgentBinaryInfo, error)
- type VersionChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AgentBinaryInfo ¶
type AgentBinaryInfo struct {
Version string `json:"version"`
Checksum string `json:"checksum"` // SHA-256 hex
Size int64 `json:"size"`
OS string `json:"os"` // e.g. "linux"
Arch string `json:"arch"` // e.g. "amd64"
UploadedAt int64 `json:"uploaded_at"`
FilePath string `json:"-"` // internal, not serialized to API
}
AgentBinaryInfo holds metadata about an uploaded agent binary.
type DockerTag ¶
type DockerTag struct {
Name string `json:"name"`
LastUpdated string `json:"last_updated"`
FullSize int64 `json:"full_size"`
IsLatest bool `json:"is_latest,omitempty"`
}
DockerTag represents a Docker Hub image tag.
type GeoIPResolver ¶
type GeoIPResolver struct {
// contains filtered or unexported fields
}
GeoIPResolver resolves IP addresses to geographic regions.
func NewGeoIPResolver ¶
func NewGeoIPResolver() *GeoIPResolver
NewGeoIPResolver creates a new resolver with an in-memory cache.
type RegistrationToken ¶
RegistrationToken is a one-time token for agent registration.
type ReleaseAsset ¶
type ReleaseAsset struct {
Name string `json:"name"`
BrowserDownloadURL string `json:"browser_download_url"`
Size int64 `json:"size"`
}
ReleaseAsset holds info about a release download asset.
type ReleaseInfo ¶
type ReleaseInfo struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Body string `json:"body"`
HTMLURL string `json:"html_url"`
PublishAt string `json:"published_at"`
Assets []ReleaseAsset `json:"assets"`
CheckedAt time.Time `json:"-"`
HasUpdate bool `json:"has_update"`
CurrentVer string `json:"current_version"`
}
ReleaseInfo holds information about a GitHub release.
func (*ReleaseInfo) FindAsset ¶
func (r *ReleaseInfo) FindAsset(prefix, goos, goarch string) string
FindAsset returns the download URL for a specific binary type. Supports both legacy (klever-node-hub-, klever-agent-) and short (dashboard-, agent-) prefixes.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is the main dashboard HTTP server.
func NewServer ¶
func NewServer(config *ServerConfig) *Server
NewServer creates a new dashboard server.
func (*Server) SecurityHeadersMiddleware ¶
SecurityHeadersMiddleware wraps a handler with security headers.
func (*Server) SetupRoutes ¶
SetupRoutes configures all HTTP routes including static assets and templates.
type ServerConfig ¶
type ServerConfig struct {
Addr string // Listen address, e.g. ":9443"
CA *kvcrypto.CA // CA for mTLS (if nil, uses self-signed cert)
}
ServerConfig holds the dashboard HTTP server configuration.
type TagCache ¶
type TagCache struct {
// contains filtered or unexported fields
}
TagCache caches Docker Hub tag listings.
func (*TagCache) Invalidate ¶ added in v0.3.75
func (tc *TagCache) Invalidate()
Invalidate clears the cache so the next GetTags call fetches fresh from Docker Hub. Used by the manual "Check for updates" button so operators can pick up a freshly published release without waiting out the TTL.
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
TokenManager manages one-time registration tokens.
func NewTokenManager ¶
func NewTokenManager() *TokenManager
NewTokenManager creates a new TokenManager.
func (*TokenManager) Generate ¶
func (tm *TokenManager) Generate() (string, error)
Generate creates a new one-time registration token.
func (*TokenManager) PendingCount ¶
func (tm *TokenManager) PendingCount() int
PendingCount returns the number of valid pending tokens.
func (*TokenManager) Validate ¶
func (tm *TokenManager) Validate(token string) bool
Validate checks if a token is valid (exists and not expired). If valid, the token is consumed (single-use).
type UpdateStore ¶
type UpdateStore struct {
// contains filtered or unexported fields
}
UpdateStore manages uploaded agent binaries.
func NewUpdateStore ¶
func NewUpdateStore(dataDir string) *UpdateStore
NewUpdateStore creates a new update store.
func (*UpdateStore) DownloadedVersions ¶ added in v0.3.6
func (s *UpdateStore) DownloadedVersions() []string
DownloadedVersions returns a sorted list of unique version strings in the store.
func (*UpdateStore) Get ¶
func (s *UpdateStore) Get(osName, arch string) *AgentBinaryInfo
Get returns the binary info for the latest version of a specific OS/arch.
func (*UpdateStore) GetBinary ¶
func (s *UpdateStore) GetBinary(osName, arch string) ([]byte, *AgentBinaryInfo, error)
GetBinary returns the binary data for the latest version of a specific OS/arch.
func (*UpdateStore) GetBinaryVersion ¶ added in v0.3.6
func (s *UpdateStore) GetBinaryVersion(version, osName, arch string) ([]byte, *AgentBinaryInfo, error)
GetBinaryVersion returns the binary data for a specific version and OS/arch.
func (*UpdateStore) LatestVersion ¶
func (s *UpdateStore) LatestVersion() string
LatestVersion returns the version string of the most recently uploaded binary.
func (*UpdateStore) List ¶
func (s *UpdateStore) List() []*AgentBinaryInfo
List returns all stored binary infos.
func (*UpdateStore) Store ¶
func (s *UpdateStore) Store(version, osName, arch string, data []byte) (*AgentBinaryInfo, error)
Store saves an agent binary to disk and records its metadata.
type VersionChecker ¶
type VersionChecker struct {
// contains filtered or unexported fields
}
VersionChecker periodically checks GitHub for new releases.
func NewVersionChecker ¶
func NewVersionChecker(owner, repo string) *VersionChecker
NewVersionChecker creates a new version checker.
func (*VersionChecker) FetchReleases ¶ added in v0.3.4
func (vc *VersionChecker) FetchReleases(limit int) ([]ReleaseInfo, error)
FetchReleases fetches the last N releases from GitHub (on-demand, no caching).
func (*VersionChecker) ForceCheck ¶ added in v0.3.5
func (vc *VersionChecker) ForceCheck()
ForceCheck triggers an immediate version check (on-demand).
func (*VersionChecker) Latest ¶
func (vc *VersionChecker) Latest() *ReleaseInfo
Latest returns the most recently fetched release info.
func (*VersionChecker) Start ¶
func (vc *VersionChecker) Start()
Start begins periodic version checking.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package alerting implements the alert rules evaluation engine.
|
Package alerting implements the alert rules evaluation engine. |
|
Package scheduler implements background jobs for metrics maintenance.
|
Package scheduler implements background jobs for metrics maintenance. |