mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
Merge pull request #225 from ChickenSeller/bugfix_sublink
Suport negative port number in SSR sublink
This commit is contained in:
@@ -358,13 +358,17 @@ namespace Netch.Utils
|
||||
data.Type = "SS";
|
||||
}
|
||||
*/
|
||||
var parser = new Regex(@"^(?<server>.+):(?<port>\d+?):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
|
||||
var parser = new Regex(@"^(?<server>.+):(?<port>(-?\d+?)):(?<protocol>.+?):(?<method>.+?):(?<obfs>.+?):(?<password>.+?)/\?(?<info>.*)$");
|
||||
var match = parser.Match(URLSafeBase64Decode(text));
|
||||
|
||||
if(match.Success)
|
||||
{
|
||||
data.Hostname = match.Groups["server"].Value;
|
||||
data.Port = int.Parse(match.Groups["port"].Value);
|
||||
if (data.Port < 0)
|
||||
{
|
||||
data.Port += 65536;
|
||||
}
|
||||
data.Password = URLSafeBase64Decode(match.Groups["password"].Value);
|
||||
|
||||
data.EncryptMethod = match.Groups["method"].Value;
|
||||
|
||||
Reference in New Issue
Block a user