Skip to content

Commit ed5f7e7

Browse files
authored
fix(dns): inheritance issue with disableCache (#5351)
1 parent 9d3401b commit ed5f7e7

File tree

5 files changed

+108
-96
lines changed

5 files changed

+108
-96
lines changed

app/dns/config.pb.go

Lines changed: 90 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/dns/config.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ message NameServer {
3131
bool actPrior = 8;
3232
string tag = 9;
3333
uint64 timeoutMs = 10;
34-
bool disableCache = 11;
35-
bool serveStale = 15;
34+
optional bool disableCache = 11;
35+
optional bool serveStale = 15;
3636
optional uint32 serveExpiredTTL = 16;
3737
bool finalQuery = 12;
3838
repeated xray.app.router.GeoIP unexpected_geoip = 13;

app/dns/dns.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,16 @@ func New(ctx context.Context, config *Config) (*DNS, error) {
121121
myClientIP = net.IP(ns.ClientIp)
122122
}
123123

124-
disableCache := config.DisableCache || ns.DisableCache
125-
serveStale := config.ServeStale || ns.ServeStale
124+
disableCache := config.DisableCache
125+
if ns.DisableCache != nil {
126+
disableCache = *ns.DisableCache
127+
}
128+
129+
serveStale := config.ServeStale
130+
if ns.ServeStale != nil {
131+
serveStale = *ns.ServeStale
132+
}
133+
126134
serveExpiredTTL := config.ServeExpiredTTL
127135
if ns.ServeExpiredTTL != nil {
128136
serveExpiredTTL = *ns.ServeExpiredTTL

0 commit comments

Comments
 (0)