json

package
v0.0.0-...-6c087f3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 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")
	ErrOwnerNotSet         = errors.New("owner is not set")
	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, owner string,
	ipVersion ipversion.IPVersion) (events []models.HistoryEvent, err error)

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

func (*Database) StoreNewIP

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

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

Jump to

Keyboard shortcuts

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