gateway

package
v0.0.0-...-3fabec7 Latest Latest
Warning

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

Go to latest
Published: May 27, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIGateway

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

APIGateway provides a REST API interface to the Control Plane services

func NewAPIGateway

func NewAPIGateway(cfg *config.ControlPlaneConfig, cpConn, authConn *grpc.ClientConn) (*APIGateway, error)

NewAPIGateway creates a new API gateway

func (*APIGateway) Start

func (g *APIGateway) Start() error

Start starts the API gateway

func (*APIGateway) Stop

func (g *APIGateway) Stop(ctx context.Context) error

Stop stops the API gateway

type RateLimiter

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

RateLimiter implements a token bucket rate limiter

func NewRateLimiter

func NewRateLimiter(limit int, intervalStr string) (*RateLimiter, error)

NewRateLimiter creates a new rate limiter with the specified limit and interval

func (*RateLimiter) Allow

func (r *RateLimiter) Allow(key string) bool

Allow checks if a request is allowed under the rate limit

func (*RateLimiter) Stop

func (r *RateLimiter) Stop()

Stop stops the rate limiter cleanup ticker

Jump to

Keyboard shortcuts

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