@@ -12,13 +12,14 @@ import (
12
12
)
13
13
14
14
type NameServerConfig struct {
15
- Address * Address `json:"address"`
16
- ClientIP * Address `json:"clientIp"`
17
- Port uint16 `json:"port"`
18
- SkipFallback bool `json:"skipFallback"`
19
- Domains []string `json:"domains"`
20
- ExpectIPs StringList `json:"expectIps"`
21
- QueryStrategy string `json:"queryStrategy"`
15
+ Address * Address `json:"address"`
16
+ ClientIP * Address `json:"clientIp"`
17
+ Port uint16 `json:"port"`
18
+ SkipFallback bool `json:"skipFallback"`
19
+ Domains []string `json:"domains"`
20
+ ExpectIPs StringList `json:"expectIps"`
21
+ QueryStrategy string `json:"queryStrategy"`
22
+ AllowUnexpectedIPs bool `json:"allowUnexpectedIps"`
22
23
}
23
24
24
25
func (c * NameServerConfig ) UnmarshalJSON (data []byte ) error {
@@ -29,13 +30,14 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
29
30
}
30
31
31
32
var advanced struct {
32
- Address * Address `json:"address"`
33
- ClientIP * Address `json:"clientIp"`
34
- Port uint16 `json:"port"`
35
- SkipFallback bool `json:"skipFallback"`
36
- Domains []string `json:"domains"`
37
- ExpectIPs StringList `json:"expectIps"`
38
- QueryStrategy string `json:"queryStrategy"`
33
+ Address * Address `json:"address"`
34
+ ClientIP * Address `json:"clientIp"`
35
+ Port uint16 `json:"port"`
36
+ SkipFallback bool `json:"skipFallback"`
37
+ Domains []string `json:"domains"`
38
+ ExpectIPs StringList `json:"expectIps"`
39
+ QueryStrategy string `json:"queryStrategy"`
40
+ AllowUnexpectedIPs bool `json:"allowUnexpectedIps"`
39
41
}
40
42
if err := json .Unmarshal (data , & advanced ); err == nil {
41
43
c .Address = advanced .Address
@@ -45,6 +47,7 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
45
47
c .Domains = advanced .Domains
46
48
c .ExpectIPs = advanced .ExpectIPs
47
49
c .QueryStrategy = advanced .QueryStrategy
50
+ c .AllowUnexpectedIPs = advanced .AllowUnexpectedIPs
48
51
return nil
49
52
}
50
53
@@ -111,12 +114,13 @@ func (c *NameServerConfig) Build() (*dns.NameServer, error) {
111
114
Address : c .Address .Build (),
112
115
Port : uint32 (c .Port ),
113
116
},
114
- ClientIp : myClientIP ,
115
- SkipFallback : c .SkipFallback ,
116
- PrioritizedDomain : domains ,
117
- Geoip : geoipList ,
118
- OriginalRules : originalRules ,
119
- QueryStrategy : resolveQueryStrategy (c .QueryStrategy ),
117
+ ClientIp : myClientIP ,
118
+ SkipFallback : c .SkipFallback ,
119
+ PrioritizedDomain : domains ,
120
+ Geoip : geoipList ,
121
+ OriginalRules : originalRules ,
122
+ QueryStrategy : resolveQueryStrategy (c .QueryStrategy ),
123
+ AllowUnexpectedIPs : c .AllowUnexpectedIPs ,
120
124
}, nil
121
125
}
122
126
0 commit comments