Make domain_resolver optional when only one DNS server is configured

This commit is contained in:
世界 committed 2025-07-08 13:12:26 +08:00
1 parent 23cf8c49e0
commit 390e30ae7b
4 files changed
+22 -2

No files matched your search

+8 -1
View File
@@ -116,7 +116,14 @@ func (o *DomainResolveOptions) UnmarshalJSON(bytes []byte) error {
o.Server = stringValue
return nil
}
return json.Unmarshal(bytes, (*_DomainResolveOptions)(o))
err = json.Unmarshal(bytes, (*_DomainResolveOptions)(o))
if err != nil {
return err
}
if o.Server == "" {
return E.New("empty domain_resolver.server")
}
return nil
}
func (o *DialerOptions) TakeDialerOptions() DialerOptions {