Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

docs: Add godoc comments to exported functions

rcourtmanc05817f9de1d
diff --git a/internal/api/ratelimit.go b/internal/api/ratelimit.go
index 879189759a..4f49bfea34 100644
--- a/internal/api/ratelimit.go
+++ b/internal/api/ratelimit.go
@@ -14,6 +14,8 @@ type RateLimiter struct {
stopCleanup chan struct{}
}
+// NewRateLimiter creates a rate limiter that allows limit requests per window duration.
+// It starts a background goroutine to periodically clean up old entries.
func NewRateLimiter(limit int, window time.Duration) *RateLimiter {
rl := &RateLimiter{
attempts: make(map[string][]time.Time),
@@ -45,6 +47,8 @@ func (rl *RateLimiter) Stop() {
close(rl.stopCleanup)
}
+// Allow checks if a request from the given IP address is within the rate limit.
+// Returns true if the request is allowed, false if the rate limit is exceeded.
func (rl *RateLimiter) Allow(ip string) bool {
rl.mu.Lock()
defer rl.mu.Unlock()
diff --git a/internal/api/temperature_proxy.go b/internal/api/temperature_proxy.go
index 7b1f02f9c2..c5021ba52d 100644
--- a/internal/api/temperature_proxy.go
+++ b/internal/api/temperature_proxy.go
@@ -84,6 +84,7 @@ func (h *TemperatureProxyHandlers) recordSync(instance string, refreshSeconds in
}
}
+// SnapshotSyncStatus returns a copy of the current sync status for all temperature proxies.
func (h *TemperatureProxyHandlers) SnapshotSyncStatus() map[string]proxySyncState {
if h == nil {
return nil
diff --git a/pkg/pmg/client.go b/pkg/pmg/client.go
index 0e88d7c410..e7dd00f02c 100644
--- a/pkg/pmg/client.go
+++ b/pkg/pmg/client.go
@@ -126,6 +126,7 @@ type BackupEntry struct {
Timestamp flexibleInt `json:"timestamp"`
}
+// NewClient creates a new PMG (Proxmox Mail Gateway) API client.
func NewClient(cfg ClientConfig) (*Client, error) {
if cfg.Timeout <= 0 {
cfg.Timeout = 60 * time.Second
@@ -395,6 +396,7 @@ func (c *Client) getJSON(ctx context.Context, path string, params url.Values, ou
return nil
}
+// GetVersion returns version information for the PMG instance.
func (c *Client) GetVersion(ctx context.Context) (*VersionInfo, error) {
var resp apiResponse[VersionInfo]
if err := c.getJSON(ctx, "/version", nil, &resp); err != nil {