domain

package
v0.0.0-...-63fad0f Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Id     uint64
	URL    string
	Health string
}

func NewBackend

func NewBackend(url string, health string) *Backend

type BackendRegistry

type BackendRegistry interface {
	UpdateHealth(status BackendStatus) error
	Subscribe(backendId uint64) <-chan BackendStatus
	GetBackendById(backendId uint64) (Backend, bool)
	AddBackendToRegistry(backend Backend)
}

type BackendStatus

type BackendStatus struct {
	Id        uint64
	IsHealthy bool
}

type RateLimiter

type RateLimiter interface {
	IsAllowed(ip string) bool           // Allow or reject a request based on IP
	GetState() map[string]int           // Get the current state of the rate limiter
	GetRateLimit() (int, time.Duration) // Returns the request limit and the time window
}

Jump to

Keyboard shortcuts

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