http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAddress

type IPAddress string

IPAddress represents an IP address string.

type IPRateLimiter

type IPRateLimiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

IPRateLimiter represents a rate limiter based on an IP address.

func NewIPRateLimiter

func NewIPRateLimiter(tps rate.Limit, size int) *IPRateLimiter

NewIPRateLimiter returns a new IPRateLimiter.

func (*IPRateLimiter) AddLimiter

func (ipLimiter *IPRateLimiter) AddLimiter(ipAddr string) *rate.Limiter

AddLimiter creates a new rate limiter and adds it to the limiters map, using the IP address as the key.

func (*IPRateLimiter) GetLimiter

func (ipLimiter *IPRateLimiter) GetLimiter(ipAddr string) *rate.Limiter

GetLimiter returns the rate limiter for the provided IP address if it exists. Otherwise calls AddLimiter to add a new limiter to the map.

type IPWhiteList

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

IPWhiteList contains white list information for rate limiting.

func NewIPWhiteList

func NewIPWhiteList(ipList []string) (*IPWhiteList, error)

NewIPWhiteList builds a new IPWhiteList from the list of IPs.

type Server

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

Server represents the entry point to interact with the service via HTTP requests.

func NewServer

func NewServer(version string, keys *auth.Keys, config *config.Service) (*Server, error)

NewServer returns a new instance of Server.

func (*Server) Start

func (ws *Server) Start() error

Start initiates the HTTP server.

Jump to

Keyboard shortcuts

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