database

package
v0.0.0-...-f014db2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: GPL-3.0 Imports: 6 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlacklistResult

type BlacklistResult struct {
	//Index is the main data held by this entry
	Index string
	//List is the source list
	List string
	//ExtraData contains extra information this blacklist source provides
	ExtraData map[string]interface{}
}

BlacklistResult is the database safe version of BlacklistedEntry. A way to think about this is that entries go in the database, and results come out. This structure is also used to return data from RPC calls.

type Handle

type Handle interface {
	//GetRegisteredLists retrieves all of the lists registered with the database
	GetRegisteredLists() ([]list.Metadata, error)

	//RegisterList registers a new blacklist source with the database
	RegisterList(list.Metadata) error

	//RemoveList removes an existing blacklist source from the database
	RemoveList(list.Metadata) error

	//UpdateListMetadata updates the metadata of an existing blacklist
	UpdateListMetadata(list.Metadata) error

	//ClearCache clears old entries for a given list
	ClearCache(list.Metadata) error

	//InsertEntries inserts entries from a list into the database
	InsertEntries(
		entryType list.BlacklistedEntryType,
		entries <-chan list.BlacklistedEntry,
		wg *sync.WaitGroup, errorsOut chan<- error,
	)

	//FindEntries finds entries of a given type and index
	FindEntries(dataType list.BlacklistedEntryType, index string) ([]BlacklistResult, error)
}

Handle provides an interface for using a databae to hold blacklist information

func NewMongoDB

func NewMongoDB(conn string, authMech mgosec.AuthMechanism,
	db string) (Handle, error)

NewMongoDB returns a new mongoDB Handle

func NewSecureMongoDB

func NewSecureMongoDB(conn string, authMech mgosec.AuthMechanism,
	db string, tlsConf *tls.Config) (Handle, error)

NewSecureMongoDB returns a new mongoDB Handle encrypted with TLS

Jump to

Keyboard shortcuts

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