blocklist

package
v3.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package blocklist implements a list of forbidden IDs.

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 blocklist as well as the blocklists that may be in the context.

func NewContext

func NewContext(parent context.Context, blocklists ...*Blocklist) context.Context

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

Types

type Blocklist

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

Blocklist is a list of forbidden IDs.

func New

func New(ids ...string) *Blocklist

New returns a new Blocklist for the given IDs.

func (*Blocklist) Add

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

Add an ID to the blocklist.

func (*Blocklist) Contains

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

Contains returns whether the blocklist contains the given ID.

type Blocklists

type Blocklists []*Blocklist

Blocklists contains multiple blocklists.

func FromContext

func FromContext(ctx context.Context) Blocklists

FromContext returns the blocklists from the given context.

func (Blocklists) Contains

func (b Blocklists) Contains(id string) bool

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

Jump to

Keyboard shortcuts

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