json

package
v0.0.0-...-542e895 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDomainEmpty         = errors.New("domain is empty")
	ErrHostIsEmpty         = errors.New("host is empty")
	ErrIPRecordsMisordered = errors.New("IP records are not ordered correctly by time")
	ErrIPEmpty             = errors.New("IP is empty")
	ErrIPTimeEmpty         = errors.New("time of IP is empty")
)

Functions

This section is empty.

Types

type Database

type Database struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewDatabase

func NewDatabase(dataDir string) (*Database, error)

NewDatabase opens or creates the JSON file database.

func (*Database) Close

func (db *Database) Close() error

func (*Database) GetEvents

func (db *Database) GetEvents(domain, host string,
	ipVersion ipversion.IPVersion) (events []models.HistoryEvent, err error)

GetEvents gets all the IP addresses history for a certain domain, host and IP version, in the order from oldest to newest.

func (*Database) StoreNewIP

func (db *Database) StoreNewIP(domain, host string, ip netip.Addr, t time.Time) (err error)

StoreNewIP stores a new IP address for a certain domain and host.

Jump to

Keyboard shortcuts

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