2016-11-11 21:48:00 +07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/miekg/dns"
|
2016-11-13 19:50:44 +07:00
|
|
|
"github.com/satori/go.uuid"
|
2016-11-11 21:48:00 +07:00
|
|
|
)
|
|
|
|
|
2016-11-23 23:07:38 +07:00
|
|
|
// Records is for static records
|
2016-11-11 21:48:00 +07:00
|
|
|
type Records struct {
|
|
|
|
Records map[uint16]map[string][]dns.RR
|
|
|
|
}
|
|
|
|
|
2016-11-23 23:07:38 +07:00
|
|
|
// DNSConfig holds the config structure
|
2016-11-17 00:15:36 +07:00
|
|
|
type DNSConfig struct {
|
2016-11-13 19:50:44 +07:00
|
|
|
General general
|
2016-11-17 22:52:55 +07:00
|
|
|
Database dbsettings
|
2016-11-17 00:15:36 +07:00
|
|
|
API httpapi
|
2016-11-13 19:50:44 +07:00
|
|
|
Logconfig logconfig
|
2016-11-11 21:48:00 +07:00
|
|
|
}
|
|
|
|
|
2016-11-13 19:50:44 +07:00
|
|
|
// Auth middleware
|
2016-11-23 23:07:38 +07:00
|
|
|
type authMiddleware struct{}
|
2016-11-13 19:50:44 +07:00
|
|
|
|
2016-11-11 21:48:00 +07:00
|
|
|
// Config file general section
|
|
|
|
type general struct {
|
2016-11-15 14:27:34 +07:00
|
|
|
Domain string
|
|
|
|
Nsname string
|
|
|
|
Nsadmin string
|
2016-11-16 19:56:49 +07:00
|
|
|
Debug bool
|
2016-11-15 14:27:34 +07:00
|
|
|
StaticRecords []string `toml:"records"`
|
2016-11-13 19:50:44 +07:00
|
|
|
}
|
|
|
|
|
2016-11-17 22:52:55 +07:00
|
|
|
type dbsettings struct {
|
|
|
|
Engine string
|
|
|
|
Connection string
|
|
|
|
}
|
|
|
|
|
2016-11-13 19:50:44 +07:00
|
|
|
// API config
|
|
|
|
type httpapi struct {
|
2016-11-17 00:15:36 +07:00
|
|
|
Domain string
|
|
|
|
Port string
|
|
|
|
TLS string
|
|
|
|
TLSCertPrivkey string `toml:"tls_cert_privkey"`
|
|
|
|
TLSCertFullchain string `toml:"tls_cert_fullchain"`
|
|
|
|
CorsOrigins []string
|
2016-11-11 21:48:00 +07:00
|
|
|
}
|
2016-11-13 19:50:44 +07:00
|
|
|
|
|
|
|
// Logging config
|
|
|
|
type logconfig struct {
|
|
|
|
Level string `toml:"loglevel"`
|
|
|
|
Logtype string `toml:"logtype"`
|
|
|
|
File string `toml:"logfile"`
|
|
|
|
Format string `toml:"logformat"`
|
|
|
|
}
|
|
|
|
|
2016-11-23 23:07:38 +07:00
|
|
|
// ACMETxt is the default structure for the user controlled record
|
2016-11-13 19:50:44 +07:00
|
|
|
type ACMETxt struct {
|
|
|
|
Username uuid.UUID
|
|
|
|
Password string
|
|
|
|
ACMETxtPost
|
2016-11-17 22:52:55 +07:00
|
|
|
LastActive int64
|
2016-11-13 19:50:44 +07:00
|
|
|
}
|
|
|
|
|
2016-11-23 23:07:38 +07:00
|
|
|
// ACMETxtPost holds the DNS part of the ACMETxt struct
|
2016-11-13 19:50:44 +07:00
|
|
|
type ACMETxtPost struct {
|
|
|
|
Subdomain string `json:"subdomain"`
|
|
|
|
Value string `json:"txt"`
|
|
|
|
}
|