middleware

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GinLogger added in v0.1.19

func GinLogger() gin.HandlerFunc

GinLogger returns a gin middleware that logs request details via slog, so entries appear in both console and the app log file. Logs are structured with status, latency, client_ip, method, path fields. Log level: INFO for 1xx-3xx, WARN for 4xx, ERROR for 5xx.

func IPWhitelist added in v0.1.13

func IPWhitelist(host string, allowedIPs []string) gin.HandlerFunc

IPWhitelist returns middleware that rejects requests from IPs not in the allowed list. If host is 127.0.0.1 or localhost, all checks are skipped.

func LocalhostOnly

func LocalhostOnly() gin.HandlerFunc

LocalhostOnly returns middleware that restricts access to loopback addresses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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