interfaces

package
v0.0.0-...-16bbc8a Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

interfaces defines a set of contracts that implementations can be built to. The application should use contracts and not implementations whenever possible.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlocklistClient

type BlocklistClient interface {
	// Lookup will query an externally maintained blocklist and return some return status code associated with given IP.
	//
	// IP is an IPv4 formatted address to be queried in the externally maintained blocklist.
	//
	// The string return value is return code returned back by the externally maintained blocklist.
	Lookup(IP string) ([]string, error)
}

BlocklistClient defines the minimal behavior needed to perform lookups on an external blocklist

type DBClient

type DBClient interface {
	// Close will attempt to close the database connection.
	// This should usually be called with a defer statement when opening any connection to the database.
	Close() error

	// AddIPDetails is the creation operation for adding new data to the database.
	// It returns a representation of the object added to the database if successful; an error otherwise.
	//
	// contract is the data model used by most of the system for IPDetails and represents the object to be stored.
	//
	// It returns a representation of the object added to the database if successful; an error otherwise.
	AddIPDetails(contract model.IPDetails) (*model.IPDetails, error)

	// UpdateIPDetails is the update operation for editing data to the database.
	// It returns a representation of the object updated in the database if successful; an error otherwise.
	//
	// contract is the data model used by most of the system for IPDetails and represents the object to be stored.
	//
	// It returns a representation of the object updated it the database if successful; an error otherwise.
	UpdateIPDetails(contract model.IPDetails) (*model.IPDetails, error)

	// GetIPDetailByAddress is the retrieval operation for getting data from the database.
	// It returns a representation of the object requested in the database if successful; an error otherwise.
	//
	// address is the IP address that we want to query the database for.
	//
	// It returns a representation of the object requested in the database if successful; an error otherwise.
	GetIPDetailByAddress(address string) (*model.IPDetails, error)
}

DBClient describes the principal methods needed to operate a database with the system.

Jump to

Keyboard shortcuts

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