refactor: new dns app

This commit is contained in:
AkinoKaede 2021-03-18 23:24:24 +08:00
parent 4e63c22197
commit 8884e948fe
No known key found for this signature in database
GPG key ID: C687746B27587C0D
24 changed files with 1240 additions and 620 deletions

View file

@ -108,10 +108,11 @@ var typeMap = map[router.Domain_Type]dns.DomainMatchingType{
// DNSConfig is a JSON serializable object for dns.Config.
type DNSConfig struct {
Servers []*NameServerConfig `json:"servers"`
Hosts map[string]*Address `json:"hosts"`
ClientIP *Address `json:"clientIp"`
Tag string `json:"tag"`
Servers []*NameServerConfig `json:"servers"`
Hosts map[string]*Address `json:"hosts"`
ClientIP *Address `json:"clientIp"`
Tag string `json:"tag"`
DisableCache bool `json:"disableCache"`
}
func getHostMapping(addr *Address) *dns.Config_HostMapping {
@ -129,7 +130,8 @@ func getHostMapping(addr *Address) *dns.Config_HostMapping {
// Build implements Buildable
func (c *DNSConfig) Build() (*dns.Config, error) {
config := &dns.Config{
Tag: c.Tag,
Tag: c.Tag,
DisableCache: c.DisableCache,
}
if c.ClientIP != nil {