mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
XDNS finalmask: Support resolvers (client) and domains (server) instead of domain (#5872)
https://github.com/XTLS/Xray-core/pull/5872#issuecomment-4192730898 Example: https://github.com/XTLS/Xray-core/pull/5872#issuecomment-4196172391 --------- Co-authored-by: LjhAUMEM <llnu14702@gmail.com>
This commit is contained in:
committed by
GitHub
parent
a91a88c7b2
commit
1642fdfbdd
@@ -1662,16 +1662,30 @@ func (c *Sudoku) Build() (proto.Message, error) {
|
||||
}
|
||||
|
||||
type Xdns struct {
|
||||
Domain string `json:"domain"`
|
||||
Domain json.RawMessage `json:"domain"`
|
||||
|
||||
Domains []string `json:"domains"`
|
||||
Resolvers []string `json:"resolvers"`
|
||||
}
|
||||
|
||||
func (c *Xdns) Build() (proto.Message, error) {
|
||||
if c.Domain == "" {
|
||||
return nil, errors.New("empty domain")
|
||||
if c.Domain != nil {
|
||||
return nil, errors.PrintRemovedFeatureError("domain", "domains(server) & resolvers(client)")
|
||||
}
|
||||
|
||||
if len(c.Domains) == 0 && len(c.Resolvers) == 0 {
|
||||
return nil, errors.New("empty domains & empty resolvers")
|
||||
}
|
||||
|
||||
for _, r := range c.Resolvers {
|
||||
if !strings.Contains(r, "+udp://") {
|
||||
return nil, errors.New("invalid resolver ", r)
|
||||
}
|
||||
}
|
||||
|
||||
return &xdns.Config{
|
||||
Domain: c.Domain,
|
||||
Domains: c.Domains,
|
||||
Resolvers: c.Resolvers,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user