Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: routing rule not applied for DNS Server in TCP:// schema #1144

Merged
merged 1 commit into from
Jul 16, 2021

Conversation

digglife
Copy link
Contributor

This PR should fix the problem that routing rule is not applied for DNS Server in TCP:// schema. Related Issue: #1143

Root cause

dest := net.TCPDestination(net.DomainAddress(url.Hostname()), port)

The AddressFamily for the Address in dest here is actually a Domain. During Router's PickRoute process, it will match against the domain list of the router rule, not the IP list, so the routing rule with IP addresses will never be applied.

Fix

use net.ParseAddress instead, it will return the right type automatically.(Although the address here is supposed to be IP address).

@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2021

Codecov Report

Merging #1144 (04a0bb9) into master (00908a1) will decrease coverage by 9.27%.
The diff coverage is 40.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1144      +/-   ##
==========================================
- Coverage   54.09%   44.81%   -9.28%     
==========================================
  Files         294      485     +191     
  Lines       14869    29490   +14621     
==========================================
+ Hits         8043    13217    +5174     
- Misses       5969    14872    +8903     
- Partials      857     1401     +544     
Impacted Files Coverage Δ
app/browserforwarder/errors.generated.go 0.00% <0.00%> (ø)
app/commander/commander.go 2.04% <ø> (ø)
app/commander/errors.generated.go 0.00% <ø> (ø)
app/commander/outbound.go 0.00% <0.00%> (ø)
app/dispatcher/errors.generated.go 100.00% <ø> (ø)
app/dispatcher/fakednssniffer.go 0.00% <0.00%> (ø)
app/dispatcher/sniffer.go 0.00% <0.00%> (ø)
app/dispatcher/stats.go 42.85% <ø> (ø)
app/dns/errors.generated.go 100.00% <ø> (ø)
app/dns/fakedns/errors.generated.go 0.00% <0.00%> (ø)
... and 503 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b83bb1...04a0bb9. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants