From 7a48e479ece01a16d6ace4ee878ca608b0dcefcd Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 23:54:23 +0000 Subject: [PATCH] docs(proxy): align public docs with AX examples Co-Authored-By: Virgil --- api_rows.go | 9 ++++++--- core_impl.go | 2 ++ customdiffstats.go | 3 +++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/api_rows.go b/api_rows.go index 0d3bd6b..d3a11c9 100644 --- a/api_rows.go +++ b/api_rows.go @@ -6,7 +6,8 @@ type WorkerRow [13]any // MinerRow{1, "10.0.0.1:49152", 4096, 512, 2, 100000, "WALLET", "********", "rig-alpha", "XMRig/6.21.0"} type MinerRow [10]any -// p.SummaryDocument() +// doc := p.SummaryDocument() +// doc.Results.Accepted == 4821 type SummaryDocument struct { Version string `json:"version"` Mode string `json:"mode"` @@ -50,13 +51,15 @@ type ResultsDocument struct { Best [10]uint64 `json:"best"` } -// p.WorkersDocument() +// doc := p.WorkersDocument() +// doc.Workers[0][0] == "rig-alpha" type WorkersDocument struct { Mode string `json:"mode"` Workers []WorkerRow `json:"workers"` } -// p.MinersDocument() +// doc := p.MinersDocument() +// doc.Miners[0][7] == "********" type MinersDocument struct { Format []string `json:"format"` Miners []MinerRow `json:"miners"` diff --git a/core_impl.go b/core_impl.go index 1df005b..21e4844 100644 --- a/core_impl.go +++ b/core_impl.go @@ -234,6 +234,7 @@ func (cd *CustomDiff) OnLogin(e Event) { // NewRateLimiter creates a per-IP token bucket limiter. // // limiter := NewRateLimiter(RateLimit{MaxConnectionsPerMinute: 30, BanDurationSeconds: 300}) +// limiter.Allow("203.0.113.42:3333") func NewRateLimiter(config RateLimit) *RateLimiter { return &RateLimiter{ config: config, @@ -308,6 +309,7 @@ func (rl *RateLimiter) Tick() { // NewConfigWatcher creates a polling watcher for a config file. // // watcher := NewConfigWatcher("config.json", func(cfg *Config) { _ = cfg }) +// watcher.Start() func NewConfigWatcher(configPath string, onChange func(*Config)) *ConfigWatcher { watcher := &ConfigWatcher{ path: configPath, diff --git a/customdiffstats.go b/customdiffstats.go index 0511b03..665b811 100644 --- a/customdiffstats.go +++ b/customdiffstats.go @@ -15,6 +15,9 @@ type CustomDiffBucketStats struct { } // CustomDiffBuckets records share totals grouped by miner custom difficulty. +// +// buckets := NewCustomDiffBuckets(true) +// buckets.OnAccept(proxy.Event{Miner: &proxy.Miner{}}) type CustomDiffBuckets struct { enabled bool buckets map[uint64]*CustomDiffBucketStats