ipaddr

package
v0.0.0-...-d3da680 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ipaddr implements IP allowlist check.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Allowlist

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

Allowlist holds all named IP allowlist and the allowlist assignment map.

func NewAllowlist

NewAllowlist creates new populated IP allowlist set.

func (Allowlist) GetAllowlistForIdentity

func (l Allowlist) GetAllowlistForIdentity(ident identity.Identity) string

GetAllowlistForIdentity returns name of the IP allowlist to use to check IP of requests from given `ident`.

Returns an empty string if the identity is not IP-restricted.

func (Allowlist) IsAllowedIP

func (l Allowlist) IsAllowedIP(ip net.IP, allowlist string) bool

IsAllowedIP returns true if IP address belongs to given named IP allowlist.

Jump to

Keyboard shortcuts

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