Documentation
¶
Index ¶
- Constants
- type Resolver
- func (r *Resolver) Get(IP string) (*model.IPDetails, error)
- func (r *Resolver) GetAndStore(IP string) (*model.IPDetails, error)
- func (r *Resolver) Mutation() generated.MutationResolver
- func (r *Resolver) Query() generated.QueryResolver
- func (r *Resolver) Queue(ip string, modelChan chan *model.IPDetails, errChan chan error)
Constants ¶
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 ¶
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 ¶
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.