DNS: Add timeoutMs for DnsServerObject (#4523)

This commit is contained in:
patterniha 2025-03-21 13:54:58 +03:30 committed by GitHub
parent 86a225cda1
commit 1067171e6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 83 additions and 59 deletions

View file

@ -21,6 +21,7 @@ type NameServerConfig struct {
QueryStrategy string `json:"queryStrategy"`
AllowUnexpectedIPs bool `json:"allowUnexpectedIps"`
Tag string `json:"tag"`
TimeoutMs uint64 `json:"timeoutMs"`
}
func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
@ -40,6 +41,7 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
QueryStrategy string `json:"queryStrategy"`
AllowUnexpectedIPs bool `json:"allowUnexpectedIps"`
Tag string `json:"tag"`
TimeoutMs uint64 `json:"timeoutMs"`
}
if err := json.Unmarshal(data, &advanced); err == nil {
c.Address = advanced.Address
@ -51,6 +53,7 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
c.QueryStrategy = advanced.QueryStrategy
c.AllowUnexpectedIPs = advanced.AllowUnexpectedIPs
c.Tag = advanced.Tag
c.TimeoutMs = advanced.TimeoutMs
return nil
}
@ -125,6 +128,7 @@ func (c *NameServerConfig) Build() (*dns.NameServer, error) {
QueryStrategy: resolveQueryStrategy(c.QueryStrategy),
AllowUnexpectedIPs: c.AllowUnexpectedIPs,
Tag: c.Tag,
TimeoutMs: c.TimeoutMs,
}, nil
}