Documentation
¶
Overview ¶
Package database handles all communication between software and the database
Index ¶
- Constants
- Variables
- func IDtoKey(id int) []byte
- type Datastore
- func (ds *Datastore) CheckAdminSettings() (rerr error)
- func (ds *Datastore) Close() error
- func (ds *Datastore) Count(bucket string) (int, error)
- func (ds *Datastore) Delete(bucket string, key []byte) error
- func (ds *Datastore) Get(bucket string, key []byte, result interface{}) error
- func (ds *Datastore) GetFilteredIPs(iptype string) (map[int]Struct_Filtered_IP, error)
- func (ds *Datastore) IsFiltered(ip string, iptype string) (bool, error)
- func (ds *Datastore) ListAllUsers() ([]string, error)
- func (ds *Datastore) ListDomains(bundle string) (map[string]Struct_Domain, error)
- func (ds *Datastore) ListNameservers() ([]string, error)
- func (ds *Datastore) ListSubdomains() (map[string]StructSubdomain, error)
- func (ds *Datastore) NewFilteredIP(newip *Struct_Filtered_IP) error
- func (ds *Datastore) Put(bucket string, key []byte, value interface{}) error
- func (ds *Datastore) RemoveInstances(bundle string) error
- type StructSubdomain
- type Struct_Admin
- type Struct_Domain
- type Struct_Filtered_IP
- type Struct_Nameserver
- type Struct_SMTP
- type Struct_Users
Constants ¶
const ( DB_MAIN = "datastore.db" DB_SETTINGS = "settings.db" DB_DOMAINS = "domains.db" )
Database constants
const ( // DB_MAIN BUCKETS BUCKET_USERS = "users" BUCKET_PORTS = "ports" BUCKET_FILTERED_IPS = "filtered_ips" BUCKET_SUBDOMAINS = "subdomains" // DB_SETTINGS BUCKETS BUCKET_GENERAL = "general" BUCKET_NAMESERVERS = "nameservers" // DB_DOMAINS BUCKETS BUCKET_DOMAINS = "domains" )
Bucket constants
Variables ¶
var (
ErrKeyNotExist = errors.New("key does not exist")
)
Error codes
Functions ¶
Types ¶
type Datastore ¶
type Datastore struct {
// contains filtered or unexported fields
}
func Open ¶
Open function will open the database and return a Datastore struct that has a handle within it for various datastore functions.
func (*Datastore) CheckAdminSettings ¶
Function CheckAdminSettings makes sure that the admin settings are set and are valid.
func (*Datastore) Close ¶
Close is a function attached to the Datastore struct that will close the current bolt instance
func (*Datastore) Delete ¶
Delete is a function attached to the Datastore struct that will delete data from the current bolt instance
func (*Datastore) Get ¶
Get is a function attached to the Datastore struct that will get data from the current bolt instance
func (*Datastore) GetFilteredIPs ¶
func (ds *Datastore) GetFilteredIPs(iptype string) (map[int]Struct_Filtered_IP, error)
func (*Datastore) IsFiltered ¶
func (*Datastore) ListAllUsers ¶
func (*Datastore) ListDomains ¶
func (ds *Datastore) ListDomains(bundle string) (map[string]Struct_Domain, error)
func (*Datastore) ListNameservers ¶
func (*Datastore) ListSubdomains ¶
func (ds *Datastore) ListSubdomains() (map[string]StructSubdomain, error)
func (*Datastore) NewFilteredIP ¶
func (ds *Datastore) NewFilteredIP(newip *Struct_Filtered_IP) error
func (*Datastore) Put ¶
Put is a function attached to the Datastore struct that will put data into the current bolt instance
func (*Datastore) RemoveInstances ¶
type StructSubdomain ¶
type StructSubdomain struct {
Root string `json:"root"`
}
type Struct_Admin ¶
type Struct_Domain ¶
type Struct_Filtered_IP ¶
type Struct_Nameserver ¶
type Struct_Nameserver struct {
Nameserver string `json:"nameserver"`
}