proxy_ip_parser

package module
v0.0.0-...-6d04d9f Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2022 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

proxy_ip_parser

X-Forwarded-*, Forwarded, True-Client-IP, X-Real-Ip parser http middleware

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cidrs

type Cidrs []*net.IPNet

Cidrs is a slice of IPNet addresses

func ParseCIDRs

func ParseCIDRs(subnets []string) (Cidrs, error)

ParseCIDRs parse IPNet addresses and return slice of its

func (*Cidrs) IsTrusted

func (c *Cidrs) IsTrusted(ip string) bool

IsTrusted checks if the ip address exists in the provided in the config addresses

type Config

type Config struct {
	// TrustedSubnets declare IP subnets which are allowed to set ip using X-Real-Ip and X-Forwarded-For
	TrustedSubnets []string `mapstructure:"trusted_subnets"`
}

func (*Config) InitDefaults

func (c *Config) InitDefaults() error

type Plugin

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

func (*Plugin) Init

func (p *Plugin) Init(cfg config.Configurer, l *zap.Logger) error

func (*Plugin) Middleware

func (p *Plugin) Middleware(next http.Handler) http.Handler

func (*Plugin) Name

func (p *Plugin) Name() string

Jump to

Keyboard shortcuts

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