ipaddr

package
v0.0.0-...-51f9457 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package ipaddr implements IP whitelist check.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Whitelist

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

Whitelist holds all named IP whitelists and the whitelist assignment map.

func NewWhitelist

NewWhitelist creates new populated IP whitelist.

func (Whitelist) GetWhitelistForIdentity

func (wl Whitelist) GetWhitelistForIdentity(ident identity.Identity) string

GetWhitelistForIdentity returns name of the IP whitelist to use to check IP of requests from given `ident`.

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

func (Whitelist) IsInWhitelist

func (wl Whitelist) IsInWhitelist(ip net.IP, whitelist string) bool

IsInWhitelist returns true if IP address belongs to given named IP whitelist.

Jump to

Keyboard shortcuts

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