2021-02-27 06:26:33 +01:00
|
|
|
package app
|
2021-02-26 15:36:46 +01:00
|
|
|
|
|
|
|
import (
|
2023-03-27 00:33:20 +02:00
|
|
|
"git.zio.sh/astra/doggo/pkg/models"
|
|
|
|
"git.zio.sh/astra/doggo/pkg/resolvers"
|
2021-02-26 15:36:46 +01:00
|
|
|
"github.com/miekg/dns"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
|
|
)
|
|
|
|
|
2021-02-27 06:26:33 +01:00
|
|
|
// App represents the structure for all app wide configuration.
|
|
|
|
type App struct {
|
2021-02-26 15:36:46 +01:00
|
|
|
Logger *logrus.Logger
|
|
|
|
Version string
|
|
|
|
QueryFlags models.QueryFlags
|
|
|
|
Questions []dns.Question
|
|
|
|
Resolvers []resolvers.Resolver
|
|
|
|
ResolverOpts resolvers.Options
|
|
|
|
Nameservers []models.Nameserver
|
|
|
|
}
|
|
|
|
|
2021-02-27 06:26:33 +01:00
|
|
|
// NewApp initializes an instance of App which holds app wide configuration.
|
|
|
|
func New(logger *logrus.Logger, buildVersion string) App {
|
|
|
|
app := App{
|
2021-02-26 15:36:46 +01:00
|
|
|
Logger: logger,
|
|
|
|
Version: buildVersion,
|
|
|
|
QueryFlags: models.QueryFlags{
|
|
|
|
QNames: []string{},
|
|
|
|
QTypes: []string{},
|
|
|
|
QClasses: []string{},
|
|
|
|
Nameservers: []string{},
|
|
|
|
},
|
|
|
|
Nameservers: []models.Nameserver{},
|
|
|
|
}
|
2021-02-27 06:26:33 +01:00
|
|
|
return app
|
2021-02-26 15:36:46 +01:00
|
|
|
}
|