Skip to content

Commit

Permalink
add nonIPQuery for dns config
Browse files Browse the repository at this point in the history
  • Loading branch information
local committed Nov 3, 2024
1 parent 26a4ae1 commit ae82fcd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions proxy/dns/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ message Config {
// original one.
v2ray.core.common.net.Endpoint server = 1;
uint32 user_level = 2;
string non_IP_query = 3;
}

message SimplifiedConfig {
Expand Down
5 changes: 4 additions & 1 deletion proxy/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,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 {
Expand Down Expand Up @@ -82,6 +83,8 @@ 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
}

Expand Down Expand Up @@ -194,7 +197,7 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, d internet.

if !h.isOwnLink(ctx) {
isIPQuery, domain, id, qType := parseIPQuery(b.Bytes())
if isIPQuery {
if isIPQuery || h.nonIPQuery != "drop" {
if domain, err := strmatcher.ToDomain(domain); err == nil {
go h.handleIPQuery(id, qType, domain, writer)
} else {
Expand Down

0 comments on commit ae82fcd

Please sign in to comment.