Support hysteria2 port ranges in URI import#889
Open
hellcatjack wants to merge 1 commit intotindy2013:masterfrom
Open
Support hysteria2 port ranges in URI import#889hellcatjack wants to merge 1 commit intotindy2013:masterfrom
hellcatjack wants to merge 1 commit intotindy2013:masterfrom
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.
Summary
This PR adds support for importing Hysteria 2 standard URIs that use a port range or multi-port spec in the authority section.
Previously, these links were rejected as invalid because the parser only accepted a single numeric port.
Problem
The current Hysteria 2 URI parser only matches a numeric-only
portvalue. As a result, valid port hopping style inputs such as port ranges or comma-separated port specs cannot be imported from standard URIs.There is also an argument ordering issue in the Clash importer path for Hysteria 2, which can cause fields such as
alpn,ca, andcwndto be assigned incorrectly.Changes
Portsportfor Hysteria 2 ifportscontains a range or multiple ports, and emit onlyportsResult
A URI like:
hysteria2://password@<server>:<port-range>/?sni=<server>#example-nodeis now converted to Clash output like: