blacklist

package
v0.0.0-...-60b8695 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, id string) error

Check the given ID on the builtin blacklist as well as the blacklists that may be in the context.

func NewContext

func NewContext(parent context.Context, blacklists ...*Blacklist) context.Context

NewContext returns a new context derived from parent with the given blacklists attached.

Types

type Blacklist

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

Blacklist is a list of IDs that is blacklisted.

func New

func New(ids ...string) *Blacklist

New returns a new Blacklist for the given IDs.

func (*Blacklist) Add

func (b *Blacklist) Add(ids ...string)

Add an ID to the blacklist.

func (*Blacklist) Contains

func (b *Blacklist) Contains(id string) bool

Contains returns whether the blacklist contains the given ID.

type Blacklists

type Blacklists []*Blacklist

Blacklists contains multiple blacklists.

func FromContext

func FromContext(ctx context.Context) Blacklists

FromContext returns the blacklists from the given context.

func (Blacklists) Contains

func (b Blacklists) Contains(id string) bool

Contains returns whether any of the blacklists contains the given ID.

Jump to

Keyboard shortcuts

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