pathpolicy

package
v0.68.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PathPolicies

type PathPolicies = PathTrie

func NewPathPolicies

func NewPathPolicies(entries map[string]PathPolicy) *PathPolicies

Create a new PathPolicies trie from a map of path to PathPolicy

func (*PathPolicies) Check

func (pol *PathPolicies) Check(fsPath string) error

Check a given path against the PathPolicies

type PathPolicy

type PathPolicy struct {
	Deny  bool // explicitly do not allow this entry
	Exact bool // require and exact match, no subdirs
}

type PathTrie

type PathTrie struct {
	Name    []string
	Paths   []*PathTrie
	Payload interface{}
}

func NewPathTrieFromMap

func NewPathTrieFromMap(entries map[string]interface{}) *PathTrie

Construct a new trie from a map of paths to their payloads. Returns the root node of the trie.

func (*PathTrie) Lookup

func (root *PathTrie) Lookup(path string) (*PathTrie, []string)

Lookup returns the node that is the prefix of path and the unmatched path segment. Must be called on the root trie node.

Jump to

Keyboard shortcuts

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