Stratum mining proxy library skeleton with 18 Go source files, type declarations, event bus, NiceHash/simple splitter packages, pool client, HTTP API types, access/share logging, and rate limiter. No function implementations — ready for agent dispatch. Co-Authored-By: Virgil <virgil@lethean.io>
23 lines
839 B
Go
23 lines
839 B
Go
// Package log implements append-only access and share logging for the proxy.
|
|
//
|
|
// al, result := log.NewAccessLog("/var/log/proxy-access.log")
|
|
// bus.Subscribe(proxy.EventLogin, al.OnLogin)
|
|
// bus.Subscribe(proxy.EventClose, al.OnClose)
|
|
package log
|
|
|
|
import "sync"
|
|
|
|
// AccessLog writes connection lifecycle lines to an append-only text file.
|
|
//
|
|
// Line format (connect): 2026-04-04T12:00:00Z CONNECT <ip> <user> <agent>
|
|
// Line format (close): 2026-04-04T12:00:00Z CLOSE <ip> <user> rx=<bytes> tx=<bytes>
|
|
//
|
|
// al, result := log.NewAccessLog("/var/log/proxy-access.log")
|
|
// bus.Subscribe(proxy.EventLogin, al.OnLogin)
|
|
// bus.Subscribe(proxy.EventClose, al.OnClose)
|
|
type AccessLog struct {
|
|
path string
|
|
mu sync.Mutex
|
|
// f is opened append-only on first write; nil until first event.
|
|
// Uses core.File for I/O abstraction.
|
|
}
|