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

Upstream mode that combines responses #5703

Open
3 tasks done
xylagbx opened this issue Apr 11, 2023 · 4 comments
Open
3 tasks done

Upstream mode that combines responses #5703

xylagbx opened this issue Apr 11, 2023 · 4 comments

Comments

@xylagbx
Copy link

xylagbx commented Apr 11, 2023

Prerequisites

  • I have checked the Wiki and Discussions and found no answer

  • I have searched other issues and found no duplicates

  • I want to request a feature or enhancement and not ask a question

Description

What problem are you trying to solve?

Finding the fastest IP address can be time-consuming, and due to network fluctuations, the IP address obtained through testing may not be the true fastest one.

I use a proxy tool called Surge that initiates TCP handshakes to all IP addresses for domains with multiple IPs simultaneously and selects the fastest connection for subsequent requests. This logic ensures that when accessing websites with a large number of balanced nodes, the fastest node in terms of response speed can always be used, and problematic nodes can be bypassed directly. This can save time for AdGuardHome to test the fastest IP address.

Proposed solution

AdGuardHome can query all DNS servers, merge all query results, and immediately return them without testing the fastest IP address.

@ainar-g
Copy link
Contributor

ainar-g commented Apr 11, 2023

Hello. AdGuard Home only does that when a user selects “Fastest IP address” upstream mode, so I'm not quite sure what you're asking?

@ainar-g ainar-g added the waiting for data Waiting for users to provide more data. label Apr 11, 2023
@xylagbx
Copy link
Author

xylagbx commented Apr 12, 2023

I'm sorry for not making it clear earlier. My suggestion is for AdGuardHome to introduce a new upstream mode that would query all available DNS servers, combine the results, and give back all IP addresses.

@ainar-g ainar-g changed the title Proposal to Modify AdGuardHome DNS Query Logic to Return All Responses Instead of Only the Fastest Upstream mode that combines responses Apr 12, 2023
@ainar-g
Copy link
Contributor

ainar-g commented Apr 12, 2023

I see. In what order would the answer records be in the combined response? And what if two upstreams respond with valid data, but the third responds with NXDOMAIN or no data?

@ainar-g ainar-g added feature request and removed waiting for data Waiting for users to provide more data. labels Apr 12, 2023
@xylagbx
Copy link
Author

xylagbx commented Apr 12, 2023

When combining responses from multiple upstream servers, there is no need to worry about sorting the responses. If two of the upstream responses contain valid data, but the third response returns an NXDOMAIN or no data, it is fine to simply return the valid data.

The following is a description of Surge's TCP concurrent connection feature:

For domains with multiple IP addresses, Surge will directly initiate TCP handshake with all IP addresses concurrently and select the connection that completes the handshake the fastest for subsequent requests.

There is no need to worry about increasing the overall network load with this behavior, as the cost of TCP handshake is very small, and concurrent testing will only be performed when accessing the domain for the first time. Subsequent requests will use the preferred IP based on the previous test results, and other IPs will only be attempted if there are issues.

This logic ensures that when accessing websites with a large number of balanced nodes, the fastest responding node can always be used, and problematic nodes can be bypassed directly.

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

No branches or pull requests

2 participants