sacrebleu-dns/utils/structs.go

49 lines
1.1 KiB
Go
Raw Normal View History

2020-12-13 03:01:04 +00:00
package utils
//App : Struct for App (dns server) configuration in the config.ini file
2020-12-13 03:01:04 +00:00
type App struct {
Port int
IP string `ini:"IP"`
2020-12-13 03:01:04 +00:00
Logdir string
Logfile bool
}
//Database : Struct for SQL Database configuration in the config.ini file
2020-12-13 03:01:04 +00:00
type Database struct {
IP string `ini:"IP"`
2020-12-13 03:01:04 +00:00
Port string
Username string
Password string
Db string `ini:"DB"`
Type string
2020-12-13 03:01:04 +00:00
}
//Redis : Struct for Redis Database configuration in the config.ini file
2020-12-13 03:01:04 +00:00
type Redis struct {
IP string `ini:"IP"`
2020-12-13 03:01:04 +00:00
Port int
Password string
Db int `ini:"DB"`
TTL int `ini:"TTL"`
2020-12-13 03:01:04 +00:00
}
//Conf : Struct for the whole config.ini file when it will be parsed by go-ini
2020-12-13 03:01:04 +00:00
type Conf struct {
AppMode string `ini:"app_mode"`
2020-12-13 03:01:04 +00:00
App
Database
Redis
}
//Record : Struct for a domain record
2020-12-14 22:20:24 +00:00
//Defined by it's ID, DomainID (parent domain), Fqdn (or name), Content (value of the record), Type (as Qtype/int), TTL (used only for the DNS response and not the Redis TTL)
2020-12-13 03:01:04 +00:00
type Record struct {
2020-12-23 00:09:10 +00:00
ID uint `gorm:"primaryKey"`
DomainID int
2020-12-13 03:01:04 +00:00
Fqdn string
Content string
Type int
2020-12-23 00:09:10 +00:00
Qtype uint16 `gorm:"-"`
2020-12-13 03:01:04 +00:00
TTL int
}