database

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VerdictPrefix string = "ip-verdict-"

	VerdictNone = iota
	VerdictAccept
	VerdictReject
)
View Source
const GeolocationPrefix string = "ip-geo-"
View Source
const ReverseLookupPrefix string = "ip-lookup-"

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	DB *badger.DB
}

func New

func New(path string, inMemory bool) (*DB, error)

Init open DB connection and run migrations.

func (*DB) GetGeolocation

func (db *DB) GetGeolocation(ip string) (*Geolocation, error)

func (*DB) GetReverseLookup

func (db *DB) GetReverseLookup(ip string) (*ReverseLookup, error)

func (*DB) GetVerdict

func (db *DB) GetVerdict(ip string) (*Verdict, error)

func (*DB) IncAccepts

func (db *DB) IncAccepts(ip string) error

func (*DB) IncRejects

func (db *DB) IncRejects(ip string) error

func (*DB) SaveGeolocation

func (db *DB) SaveGeolocation(ip string, geo *Geolocation) error

func (*DB) SaveReverseLookup

func (db *DB) SaveReverseLookup(ip string, rl *ReverseLookup) error

type Geolocation

type Geolocation struct {
	Organisation []string
	CountryCode  string
	Country      string
	RegionCode   string
	Region       string
	City         string
	Timezone     string
	ASN          string
}

type ReverseLookup

type ReverseLookup struct {
	Domains []string
}

type Verdict

type Verdict struct {
	Accepts uint
	Rejects uint
}

Jump to

Keyboard shortcuts

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