graph

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const FILENAME = `resolver.db`

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolver

type Resolver struct {
	DBClient        interfaces.DBClient
	BlocklistClient interfaces.BlocklistClient
}

func (*Resolver) Get

func (r *Resolver) Get(IP string) (*model.IPDetails, error)

Get will return the IPDetails of a given IP address. If that IP is known, it returns details from the DB, otherwise it will do a lookup via the Internet.

IP is an IPv4 formatted address to be queried.

Returns the IPDetails if the query executed successfully; an error otherwise.

func (*Resolver) GetAndStore

func (r *Resolver) GetAndStore(IP string) (*model.IPDetails, error)

GetAndStore is the backing of the Enqueue mutation. It is designed to get details of an address in the database if they exist, create them if they don't, check the blocklist in either case and store the record of the check in the database. It returns a pointer to an IPDetails if the check and database store were successful; an error otherwise.

IP is the address that should be checked and stored into memory

Returns the IPDetails if the query executed successfully; an error otherwise.

func (*Resolver) Mutation

func (r *Resolver) Mutation() generated.MutationResolver

Mutation returns generated.MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() generated.QueryResolver

Query returns generated.QueryResolver implementation.

func (*Resolver) Queue

func (r *Resolver) Queue(ip string, modelChan chan *model.IPDetails, errChan chan error)

Queue is intended to be used asychronously. It runs GetAndStore and updates the provided channels.

IP is the IP to be checked and stored modelChan is the channel to receive full data back from the database errChan is the channel to receive any errors

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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