Documentation ¶
Overview ¶
Package database provides an interface to the underlying database.
Index ¶
- type HostDB
- func (db *HostDB) Begin() error
- func (db *HostDB) Close()
- func (db *HostDB) Commit() error
- func (db *HostDB) HostAdd(host *data.Host) error
- func (db *HostDB) HostExists(addr string) (bool, error)
- func (db *HostDB) HostGetAll() ([]data.Host, error)
- func (db *HostDB) HostGetByHostReport() ([]data.HostWithPorts, error)
- func (db *HostDB) HostGetByID(id krylib.ID) (*data.Host, error)
- func (db *HostDB) HostGetCount() (int64, error)
- func (db *HostDB) HostGetRandom(max int) ([]data.Host, error)
- func (db *HostDB) HostSetLocation(h *data.Host, location string) error
- func (db *HostDB) HostSetOS(h *data.Host, osName string) error
- func (db *HostDB) PortAdd(res *data.ScanResult) error
- func (db *HostDB) PortGetByHost(hostID krylib.ID) ([]data.Port, error)
- func (db *HostDB) PortGetOpen() ([]data.ScanResult, error)
- func (db *HostDB) PortGetRecent(ref time.Time) ([]data.ScanResult, error)
- func (db *HostDB) PortGetReplyCount() (int64, error)
- func (db *HostDB) Rollback() error
- func (db *HostDB) XfrAdd(xfr *data.XFR) error
- func (db *HostDB) XfrFinish(xfr *data.XFR, status xfrstatus.XfrStatus) error
- func (db *HostDB) XfrGetByZone(zone string) (*data.XFR, error)
- type Pool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HostDB ¶
type HostDB struct {
// contains filtered or unexported fields
}
HostDB is a wrapper around the database connection.
func (*HostDB) HostExists ¶
HostExists checks if a Host with the given address already exists in the database.
func (*HostDB) HostGetAll ¶
HostGetAll returns ALL hosts from the database.
func (*HostDB) HostGetByHostReport ¶
func (db *HostDB) HostGetByHostReport() ([]data.HostWithPorts, error)
HostGetByHostReport bla
func (*HostDB) HostGetByID ¶
HostGetByID loads a Host by its ID
func (*HostDB) HostGetCount ¶
HostGetCount returns the number of Hosts in the database.
func (*HostDB) HostGetRandom ¶
HostGetRandom fetches up to <max> randomly chosen hosts from the database.
func (*HostDB) HostSetLocation ¶
HostSetLocation sets a Host's location.
func (*HostDB) PortAdd ¶
func (db *HostDB) PortAdd(res *data.ScanResult) error
PortAdd adds a new scanned port to the database.
func (*HostDB) PortGetByHost ¶
PortGetByHost loads all the scanned ports of a given Host.
func (*HostDB) PortGetOpen ¶
func (db *HostDB) PortGetOpen() ([]data.ScanResult, error)
PortGetOpen loads a list of all open ports that were scanned
func (*HostDB) PortGetRecent ¶
PortGetRecent returns all scanned ports that were scanned since the given time.
func (*HostDB) PortGetReplyCount ¶
PortGetReplyCount returns the number of open ports found on the given Host
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
Pool is a pool of database connections
func NewPool ¶
NewPool creates a Pool of database connections. The number of connections to use is given by the parameter cnt.
func (*Pool) Close ¶
Close closes all open database connections currently in the pool and empties the pool. Any connections retrieved from the pool that are in use at the time Close is called are unaffected.
func (*Pool) Get ¶
Get returns a DB connection from the pool. If the pool is empty, it waits for a connection to be returned.
func (*Pool) GetNoWait ¶
GetNoWait returns a DB connection from the pool. If the pool is empty, it creates a new one.