doggo/internal/app/app.go

36 lines
851 B
Go
Raw Normal View History

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