blacklist

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: Apache-2.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlackListedItem

type BlackListedItem struct {
	ID     string
	Reason string
}

BlackListedItem is the regex that expresses the devices that are blacklisted and the reason why.

func (BlackListedItem) TableName

func (BlackListedItem) TableName() string

TableName sets BlackListedItem's table name to be "blacklist"; for the GORM driver.

type List

type List interface {
	InList(ID string) (reason string, ok bool)
}

List is for checking if a device id is in the blacklist.

func NewListRefresher

func NewListRefresher(config RefresherConfig, updater Updater, stop chan struct{}) List

NewListRefresher takes the given values and uses them to create a new listRefresher

type RefresherConfig

type RefresherConfig struct {
	UpdateInterval time.Duration
	Logger         log.Logger
}

RefresherConfig is the configuration specifying how often to update the list and what logger to use when logging.

type SyncList

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

SyncList is an implemention of the List interface that works synchronously.

func NewEmptySyncList

func NewEmptySyncList() SyncList

NewEmptySyncList creates a new SyncList that holds no information.

func (*SyncList) InList

func (m *SyncList) InList(ID string) (string, bool)

InList returns whether or not a device is on the blacklist and why, if it's on the list.

func (*SyncList) UpdateList

func (m *SyncList) UpdateList(data []BlackListedItem)

UpdateList takes the data given and overwrites the blacklist with the new information.

type Updater

type Updater interface {
	GetBlacklist() ([]BlackListedItem, error)
}

Updater is for getting the blacklist.

Jump to

Keyboard shortcuts

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