acl

package
v0.0.0-...-be629c2 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_IPV4_BIT uint32 = 0x80000000
	NO_VALUE     string = ""
)

Variables

View Source
var (
	InvaildIpAddress  = errors.New("invaild ip address, maybe with out mask")
	InvaildNetMask    = errors.New("invaild net mask, must in [0, 32]")
	CantFindIpNet     = errors.New("can't find ip")
	AccessControlList *RadixTree
)

Functions

This section is empty.

Types

type RadixTree

type RadixTree struct {
	sync.RWMutex

	Record map[string]bool `json:"record"`
	// contains filtered or unexported fields
}

func NewRadixTree

func NewRadixTree() *RadixTree

func (*RadixTree) AccessControl

func (tree *RadixTree) AccessControl(ipAddress string) bool

func (*RadixTree) Add

func (tree *RadixTree) Add(ipNet string, value string) error

func (*RadixTree) Delete

func (tree *RadixTree) Delete(ipNet string) error

func (*RadixTree) GetBlackList

func (tree *RadixTree) GetBlackList() []string

func (*RadixTree) Marshal

func (tree *RadixTree) Marshal() ([]byte, error)

func (*RadixTree) Search

func (tree *RadixTree) Search(ip string) string

func (*RadixTree) UnMarshal

func (tree *RadixTree) UnMarshal(serialized io.ReadCloser) error

Jump to

Keyboard shortcuts

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