mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-06-12 11:29:36 +03:00
Add "nonIPQuery" to DNS outbound ("drop" by default)
And fixed a memory leak And regenerated *.pb.go
This commit is contained in:
@ -44,6 +44,7 @@ type Handler struct {
|
||||
ownLinkVerifier ownLinkVerifier
|
||||
server net.Destination
|
||||
timeout time.Duration
|
||||
nonIPQuery string
|
||||
}
|
||||
|
||||
func (h *Handler) Init(config *Config, dnsClient dns.Client, policyManager policy.Manager) error {
|
||||
@ -57,6 +58,7 @@ func (h *Handler) Init(config *Config, dnsClient dns.Client, policyManager polic
|
||||
if config.Server != nil {
|
||||
h.server = config.Server.AsDestination()
|
||||
}
|
||||
h.nonIPQuery = config.Non_IPQuery
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -175,6 +177,9 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, d internet.
|
||||
isIPQuery, domain, id, qType := parseIPQuery(b.Bytes())
|
||||
if isIPQuery {
|
||||
go h.handleIPQuery(id, qType, domain, writer)
|
||||
}
|
||||
if isIPQuery || h.nonIPQuery == "drop" {
|
||||
b.Release()
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user