api

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2025 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Expire buckets after 1 hour of inactivity,
	// sweep for expired buckets every 10 minutes.
	// Note: entry expiration should be at least some multiple of
	// maximum (limit max / limit rate) minutes.
	RATE_LIMITER_SWEEP_INTERVAL = 10 * time.Minute
	RATE_LIMITER_EXPIRES_AFTER  = 1 * time.Hour
)
View Source
const IS_GATING_ENABLED = true

Variables

View Source
var (
	ErrMissingLog   = errors.New("missing log config")
	ErrMissingWaku  = errors.New("missing waku config")
	ErrMissingStore = errors.New("missing store config")
)

Functions

This section is empty.

Types

type AuthnConfig

type AuthnConfig struct {
	AuthnOptions
	Limiter     ratelimiter.RateLimiter
	AllowLister authz.AllowList
	Log         *zap.Logger
}

Config bundles Options and other parameters needed to set up an authorizer.

type AuthnOptions

type AuthnOptions struct {
	// DEPRECATED: This option is no longer used and will be removed in a future release
	Enable bool `long:"enable"     description:"require client authentication via wallet tokens"`
	/*
		Ratelimits enables request rate limiting.

		Requests are bucketed by client IP address and request type (there is one bucket for all requests without IPs).
		Each bucket is allocated a number of tokens that are refilled at a fixed rate per minute
		up to a given maximum number of tokens.
		Requests cost 1 token by default, except Publish requests cost the number of Envelopes carried
		and BatchQuery requests cost the number of queries carried.
		The limits depend on request type, e.g. Publish requests get lower limits than other types of request.
	*/
	Ratelimits bool `long:"ratelimits" description:"apply rate limits per client IP address"`
	/*
		Allowlists enables IP allow lists.

		Wallets that are explicitly Allowed will get priority rate limits if Ratelimits is true.
	*/
	AllowLists bool `long:"allowlists" description:"apply higher limits for allow listed wallets (requires authz and ratelimits)"`
}

AuthnOptions bundle command line options associated with the authn package.

type Config

type Config struct {
	Options
	AllowLister  authz.AllowList
	Waku         *wakunode.WakuNode
	Log          *zap.Logger
	Store        *store.Store
	MLSStore     mlsstore.ReadWriteMlsStore
	ReadMLSStore mlsstore.ReadMlsStore
	MLSValidator mlsvalidate.MLSValidationService
	RateLimiter  ratelimiter.RateLimiter
}

type GatingInterceptor

type GatingInterceptor struct {
	// contains filtered or unexported fields
}

func NewGatingInterceptor

func NewGatingInterceptor(log *zap.Logger) *GatingInterceptor

func (*GatingInterceptor) Stream

func (*GatingInterceptor) Unary

type Options

type Options struct {
	GRPCAddress string       `long:"grpc-address" description:"API GRPC listening address"               default:"0.0.0.0"`
	GRPCPort    uint         `long:"grpc-port"    description:"API GRPC listening port"                  default:"5556"`
	HTTPAddress string       `long:"http-address" description:"API HTTP listening address"               default:"0.0.0.0"`
	HTTPPort    uint         `long:"http-port"    description:"API HTTP listening port"                  default:"5555"`
	Authn       AuthnOptions `` /* 146-byte string literal not displayed */
	MaxMsgSize  int          `long:"max-msg-size" description:"Max message size in bytes (default 50MB)" default:"52428800"`
	EnableMls   bool         `long:"enable-mls"   description:"Enable the MLS server"`
}

type RateLimitInterceptor added in v1.0.1

type RateLimitInterceptor struct {
	// contains filtered or unexported fields
}

func NewRateLimitInterceptor added in v1.0.1

func NewRateLimitInterceptor(
	limiter ratelimiter.RateLimiter,
	ipAllowList authz.AllowList,
	log *zap.Logger,
) *RateLimitInterceptor

func (*RateLimitInterceptor) Stream added in v1.0.1

func (*RateLimitInterceptor) Unary added in v1.0.1

type Server

type Server struct {
	*Config
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Server, error)

func (*Server) Close

func (s *Server) Close()

type TelemetryInterceptor

type TelemetryInterceptor struct {
	// contains filtered or unexported fields
}

func NewTelemetryInterceptor

func NewTelemetryInterceptor(log *zap.Logger) *TelemetryInterceptor

func (*TelemetryInterceptor) Stream

func (*TelemetryInterceptor) Unary

Directories

Path Synopsis
message
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL