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"
|
|
|
|
"time"
|
2016-11-11 21:48:00 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
// Static records
|
|
|
|
type Records struct {
|
|
|
|
Records map[uint16]map[string][]dns.RR
|
|
|
|
}
|
|
|
|
|
|
|
|
// Config file main struct
|
|
|
|
type DnsConfig struct {
|
2016-11-13 19:50:44 +07:00
|
|
|
General general
|
|
|
|
Api httpapi
|
|
|
|
Logconfig logconfig
|
2016-11-11 21:48:00 +07:00
|
|
|
}
|
|
|
|
|
2016-11-13 19:50:44 +07:00
|
|
|
// Auth middleware
|
|
|
|
type AuthMiddleware struct{}
|
|
|
|
|
2016-11-11 21:48:00 +07:00
|
|
|
// Config file general section
|
|
|
|
type general struct {
|
2016-11-13 19:50:44 +07:00
|
|
|
Domain string
|
|
|
|
Nsname string
|
|
|
|
Nsadmin string
|
|
|
|
}
|
|
|
|
|
|
|
|
// API config
|
|
|
|
type httpapi struct {
|
2016-11-11 21:48:00 +07:00
|
|
|
Domain string
|
2016-11-13 19:50:44 +07:00
|
|
|
Port string
|
2016-11-11 21:48:00 +07:00
|
|
|
Tls string
|
|
|
|
Tls_cert_privkey string
|
|
|
|
Tls_cert_fullchain string
|
|
|
|
StaticRecords []string `toml:"records"`
|
|
|
|
}
|
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"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// The default object
|
|
|
|
type ACMETxt struct {
|
|
|
|
Username uuid.UUID
|
|
|
|
Password string
|
|
|
|
ACMETxtPost
|
|
|
|
LastActive time.Time
|
|
|
|
}
|
|
|
|
|
|
|
|
type ACMETxtPost struct {
|
|
|
|
Subdomain string `json:"subdomain"`
|
|
|
|
Value string `json:"txt"`
|
|
|
|
}
|