Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CORSConfig ¶ added in v0.25.3
type RateLimitConfig ¶
type RateLimitConfig struct {
// Enabled toggles the per-IP rate limit middleware.
Enabled bool
// RequestsPerSec is the sustained per-IP request rate; requests above
// this rate (after burst is drained) get 429 Too Many Requests.
RequestsPerSec int
// Burst is the per-IP burst allowance — the bucket size that absorbs
// short spikes before sustained rate kicks in.
Burst int
// CacheSize is the max number of per-IP buckets retained.
// When exceeded, the least-recently-seen IP is evicted (and gets a fresh
// burst on its next request). Bounds memory under unique-IP floods.
CacheSize int
}
RateLimitConfig configures per-IP rate limiting based on the connection's remote address. When the node runs behind a reverse proxy, RemoteAddr is the proxy's address, so all clients share one bucket — in that case keep this disabled and apply rate limiting at the proxy instead.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer( address, port string, authDisabled bool, corsConfig CORSConfig, tlsConfig TLSConfig, rateLimitCfg RateLimitConfig, signer jwt.Signer, verifier jwt.Verifier, ) *Server
func (*Server) ListenAddr ¶
ListenAddr returns the listen address of the server.
func (*Server) RegisterService ¶
RegisterService registers a service onto the RPC server. All methods on the service will then be exposed over the RPC.
func (*Server) WithMetrics ¶
WithMetrics enables OTel metrics on the RPC server. Must be called before Start, since it rebuilds the handler stack to install the metrics middleware and registers an http.Server.ConnState hook for connection-level gauges.