go-proxy/server.go
Virgil 5a3fcf4fab docs(proxy): sharpen AX usage comments
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-05 01:50:02 +00:00

26 lines
573 B
Go

package proxy
import (
"crypto/tls"
"net"
)
// Server listens on one BindAddr and creates a Miner for each accepted connection.
//
// srv, result := proxy.NewServer(
// proxy.BindAddr{Host: "0.0.0.0", Port: 3333, TLS: false},
// nil,
// proxy.NewRateLimiter(proxy.RateLimit{MaxConnectionsPerMinute: 30}),
// onAccept,
// )
// if result.OK {
// srv.Start()
// }
type Server struct {
addr BindAddr
tlsCfg *tls.Config // nil for plain TCP
limiter *RateLimiter
onAccept func(net.Conn, uint16)
listener net.Listener
done chan struct{}
}