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

Retry again when connection is broken #22

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

lisongmin
Copy link

The DNS query will be dropped if the connection is lost, resulting in a DNS query timeout.
We can avoid this timeout by retrying with a new connection.

Here is the logs before this PR(testing by dig command):

Jan 25 11:01:24  sing-box[208068]: DEBUG[8693] [1845195939 0ms] dns: exchange www.baidu.com. IN A via dns-v4
Jan 25 11:01:24  sing-box[208068]: ERROR[8693] [1845195939 0ms] dns: exchange failed for www.baidu.com. IN A: NO_ERROR (remote): 168:Connection max age expired
Jan 25 11:01:29  sing-box[208068]: INFO[8698] [3587433723 0ms] inbound/direct[dns-entry]: inbound packet connection from 127.0.0.1:34366
Jan 25 11:01:29  sing-box[208068]: INFO[8698] [3587433723 0ms] inbound/direct[dns-entry]: inbound packet connection to :0
Jan 25 11:01:29  sing-box[208068]: DEBUG[8698] [3587433723 0ms] router: match[0] inbound=dns-entry => hijack-dns
Jan 25 11:01:29  sing-box[208068]: DEBUG[8698] [3587433723 0ms] router: sniffed packet protocol: dns
Jan 25 11:01:29  sing-box[208068]: DEBUG[8698] [3587433723 0ms] router: match[8] rule_set=geosite-cn => route(dns-v4)
Jan 25 11:01:29  sing-box[208068]: DEBUG[8698] [3587433723 0ms] router: match[8] => route(dns-v4)
Jan 25 11:01:29  sing-box[208068]: DEBUG[8698] [3587433723 0ms] dns: exchange www.baidu.com. IN A via dns-v4
Jan 25 11:01:29  sing-box[208068]: INFO[8698] [3587433723 0ms] outbound/trojan[proxy]: outbound multiplex packet connection to 8.8.8.8:443
Jan 25 11:01:30  sing-box[208068]: DEBUG[8699] [3587433723 622ms] dns: exchanged www.baidu.com NOERROR 13
Jan 25 11:01:30  sing-box[208068]: INFO[8699] [3587433723 622ms] dns: exchanged CNAME www.baidu.com. 13 IN CNAME www.a.shifen.com.

And the logs after apply this PR:

Jan 25 19:11:39  sing-box[620606]: DEBUG[4478] [1233815260 0ms] dns: exchange www.baidu.com. IN A via dns-v4
Jan 25 19:11:39  sing-box[620606]: DEBUG[4478] [1233815260 0ms] dns: exchange retry again for www.baidu.com. IN A failed with: NO_ERROR (remote): 168:Connection max age expired
Jan 25 19:11:39  sing-box[620606]: INFO[4478] [1233815260 0ms] outbound/trojan[proxy]: outbound multiplex packet connection to 8.8.8.8:443
Jan 25 19:11:40  sing-box[620606]: DEBUG[4479] [1233815260 609ms] dns: exchanged www.baidu.com NOERROR 12
Jan 25 19:11:40  sing-box[620606]: INFO[4479] [1233815260 609ms] dns: exchanged CNAME www.baidu.com. 12 IN CNAME www.a.shifen.com.
Jan 25 19:11:40  sing-box[620606]: INFO[4479] [1233815260 609ms] dns: exchanged CNAME www.a.shifen.com. 12 IN CNAME www.wshifen.com.
Jan 25 19:11:40  sing-box[620606]: INFO[4479] [1233815260 609ms] dns: exchanged A www.wshifen.com. 12 IN A 103.235.46.96
Jan 25 19:11:40  sing-box[620606]: INFO[4479] [1233815260 609ms] dns: exchanged A www.wshifen.com. 12 IN A 103.235.47.188

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.

1 participant