deny

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SystemNow

func SystemNow() int64

Types

type Store

type Store struct {
	sync.Mutex

	// map of IDs currently connected, with expiry time
	AllowList map[string]int64

	// bookingIDs currently denied, with expiry time
	DenyList map[string]int64

	// Now is a function for getting the time - useful for mocking in test
	// note time is in int64 format
	Now func() int64 `json:"-" yaml:"-"`
	// contains filtered or unexported fields
}

func New

func New() *Store

func (*Store) Allow

func (s *Store) Allow(ID string, expiresAt int64)

func (*Store) Deny

func (s *Store) Deny(ID string, expiresAt int64)

func (*Store) GetAllowList

func (s *Store) GetAllowList() []string

func (*Store) GetDenyList

func (s *Store) GetDenyList() []string

func (*Store) IsDenied

func (s *Store) IsDenied(ID string) bool

func (*Store) Prune

func (s *Store) Prune()

Prune removes stale entries from the Allow, Deny lists

func (*Store) SetNowFunc

func (s *Store) SetNowFunc(nf func() int64)

Jump to

Keyboard shortcuts

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