handler

package
v0.0.0-...-a121bc4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2023 License: EUPL-1.2 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Online is the status of a service that is online.
	Online string = "Online"

	// Offline is the status of a service that is offline.
	Offline string = "Offline"
)

Variables

This section is empty.

Functions

func AnonymizeIP

func AnonymizeIP(ipStr string) string

AnonymizeIP anonymizes the last two octets of an IPv4 address or the last 80 bits of an IPv6 address.

func ClientIP

func ClientIP(r *http.Request, proxy string) (string, error)

ClientIP returns the client's IP address from the request headers or RemoteAddr.

func HashIP

func HashIP(ip string) string

HashIP hashes an IP address using SHA256.

Types

type AnonymizedIPHandler

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

AnonymizedIPHandler is an HTTP handler for the /ip/anonymized endpoint.

func NewAnonymizedIPHandler

func NewAnonymizedIPHandler(cfg *config.Config, db *database.DB, logger *zap.Logger) *AnonymizedIPHandler

NewAnonymizedIPHandler creates a new AnonymizedIPHandler instance.

func (*AnonymizedIPHandler) Handle

ServeHTTP serves the /ip/anonymized endpoint.

type HashedIPHandler

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

HashedIPHandler is an HTTP handler for the /ip/hashed endpoint.

func NewHashedIPHandler

func NewHashedIPHandler(cfg *config.Config, db *database.DB, logger *zap.Logger) *HashedIPHandler

NewHashedIPHandler returns a new HashedIPHandler instance.

func (*HashedIPHandler) Handle

ServeHTTP serves the /ip/hashed endpoint.

type HealthHandler

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

HealthHandler is an HTTP handler for the /health endpoint.

func NewHealthHandler

func NewHealthHandler(db *database.DB, logger *zap.Logger) *HealthHandler

NewHealthHandler creates a new HealthHandler instance.

func (*HealthHandler) Handle

ServeHTTP serves the /health endpoint.

type HeartbeatHandler

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

HeartbeatHandler is an HTTP handler for the /heartbeat endpoint.

func NewHeartbeatHandler

func NewHeartbeatHandler(logger *zap.Logger) *HeartbeatHandler

NewHeartbeatHandler creates a new HeartbeatHandler instance.

func (*HeartbeatHandler) Handle

ServeHTTP serves the /heartbeat endpoint.

type IPHandler

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

IPHandler is an HTTP handler for the /ip endpoint.

func NewIPHandler

func NewIPHandler(cfg *config.Config, db *database.DB, logger *zap.Logger) *IPHandler

NewIPHandler creates a new IPHandler instance.

func (*IPHandler) Handle

ServeHTTP serves the /ip endpoint.

type MetricsHandler

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

MetricsHandler is an HTTP handler for the /metrics endpoint.

func NewMetricsHandler

func NewMetricsHandler(db *database.DB, logger *zap.Logger) *MetricsHandler

NewMetricsHandler creates a new MetricsHandler instance.

func (*MetricsHandler) Handle

ServeHTTP serves the /metrics endpoint.

Jump to

Keyboard shortcuts

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