docs(proxy): align public docs with AX examples

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 23:54:23 +00:00
parent fd88492b00
commit 7a48e479ec
3 changed files with 11 additions and 3 deletions

View file

@ -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"`

View file

@ -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,

View file

@ -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