mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 18:09:05 +00:00
fix(dns): inheritance issue with disableCache (#5351)
This commit is contained in:
+4
-4
@@ -26,8 +26,8 @@ type NameServerConfig struct {
|
||||
QueryStrategy string `json:"queryStrategy"`
|
||||
Tag string `json:"tag"`
|
||||
TimeoutMs uint64 `json:"timeoutMs"`
|
||||
DisableCache bool `json:"disableCache"`
|
||||
ServeStale bool `json:"serveStale"`
|
||||
DisableCache *bool `json:"disableCache"`
|
||||
ServeStale *bool `json:"serveStale"`
|
||||
ServeExpiredTTL *uint32 `json:"serveExpiredTTL"`
|
||||
FinalQuery bool `json:"finalQuery"`
|
||||
UnexpectedIPs StringList `json:"unexpectedIPs"`
|
||||
@@ -52,8 +52,8 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
|
||||
QueryStrategy string `json:"queryStrategy"`
|
||||
Tag string `json:"tag"`
|
||||
TimeoutMs uint64 `json:"timeoutMs"`
|
||||
DisableCache bool `json:"disableCache"`
|
||||
ServeStale bool `json:"serveStale"`
|
||||
DisableCache *bool `json:"disableCache"`
|
||||
ServeStale *bool `json:"serveStale"`
|
||||
ServeExpiredTTL *uint32 `json:"serveExpiredTTL"`
|
||||
FinalQuery bool `json:"finalQuery"`
|
||||
UnexpectedIPs StringList `json:"unexpectedIPs"`
|
||||
|
||||
@@ -20,6 +20,7 @@ func TestDNSConfigParsing(t *testing.T) {
|
||||
return config.Build()
|
||||
}
|
||||
}
|
||||
expectedServeStale := true
|
||||
expectedServeExpiredTTL := uint32(172800)
|
||||
runMultiTestCase(t, []TestCase{
|
||||
{
|
||||
@@ -72,7 +73,7 @@ func TestDNSConfigParsing(t *testing.T) {
|
||||
Size: 1,
|
||||
},
|
||||
},
|
||||
ServeStale: true,
|
||||
ServeStale: &expectedServeStale,
|
||||
ServeExpiredTTL: &expectedServeExpiredTTL,
|
||||
PolicyID: 1, // Servers with certain identical fields share this ID, incrementing starting from 1. See: Build PolicyID
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user