mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-07 04:55:00 +03:00
fix(fmt): import legacy base64 SOCKS links again (#10505)
SocksFmt.Resolve tries ResolveSocksNew first and only falls back to the legacy socks://base64(user:pass@host:port) parser when System.Uri rejects the link. System.Uri accepts most legacy links, though: it takes the base64 as the host (lower-cased) and anything after a '/' as the path. It only rejects a base64 that ends in '=' padding and has no '/', so links without padding, or with a '/' or '_' in the base64, were imported with the base64 as the address, port -1 and no credentials. A legacy link has no port of its own, so let ResolveSocksNew give up when the URI has none and leave the link to ResolveSocks. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,7 +86,10 @@ public class SocksFmt : BaseFmt
|
||||
private static ProfileItem? ResolveSocksNew(string result)
|
||||
{
|
||||
var parsedUrl = Utils.TryUri(result);
|
||||
if (parsedUrl == null)
|
||||
// A legacy socks://base64(user:pass@host:port) link has no port of its own, but System.Uri
|
||||
// accepts many of them, reading the base64 as the host (and whatever follows a '/' as the
|
||||
// path). Leave those to ResolveSocks.
|
||||
if (parsedUrl == null || parsedUrl.Port == -1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user