Add optional DNS validation to filter out fake SNI targets#43
Open
noleston wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add optional DNS validation to filter out fake SNI targets
*Note: This PR is a redesigned and fully explained version of the closed #27
Problem & Background
RealiTLScanner is used to find suitable destination (
dest) and SNI (serverNames) pairs for VLESS Reality. The goal is to find legitimate websites hosted on the same hosting provider/subnet as the user's VPS to masquerade under them.Why this feature is needed now:
google.com,microsoft.com,apple.com,vk.com).Addressing the doubts in #27
In #27, the question was raised: "Even if the IP doesn't match the DNS record, you can still use it as a fallback target. What is the practical benefit of filtering this?"
While connecting to such a target technically "works" (the handshake succeeds), using them as a Reality destination is highly counterproductive for two reasons:
The Solution
This PR adds a
-resolve-domainsflag (disabled by default).When enabled, the scanner:
DNSNames[0], falling back toSubject.CommonName).Implementation Details
sync.RWMutex. Only successful resolutions are stored to prevent permanent domain filtering caused by temporary network timeouts.golang.org/x/sync/singleflightto prevent duplicate concurrent DNS requests for the same domain, protecting the local resolver from overload during high-thread scans.