8000 GitHub - dominicbarnes/go-allowed-list: A helper library for creating allowed lists using either a blacklist or whitelist strategy. · GitHub
[go: up one dir, main page]

Skip to content

About

A helper library for creating allowed lists using either a blacklist or whitelist strategy.

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

go-allowed-list

godoc

A helper library for creating allowed lists using either a blacklist or whitelist strategy.

Example

import (
  "log"

  "github.com/dominicbarnes/go-allowed-list"
)

func main() {
  blacklist := allowedList.NewBlacklist()
  blacklist.Allowed("a") // true, because an empty list is permissive
  blacklist.Add("a", "b", "c")
  blacklist.Allowed("a") // false, because "a" is present
  blacklist.Allowed("d") // true, because "d" is absent

  whitelist := allowedList.NewWhitelist()
  whitelist.Allowed("a") // true, because an empty list is permissive
  whitelist.Add("a", "b", "c")
  whitelist.Allowed("a") // true, because "a" is present
  whitelist.Allowed("d") // false, because "d" is absent
}

About

A helper library for creating allowe 480B d lists using either a blacklist or whitelist strategy.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0