diff --git a/Netch/Models/Server.cs b/Netch/Models/Server.cs index d299d9f2..ae9be171 100644 --- a/Netch/Models/Server.cs +++ b/Netch/Models/Server.cs @@ -34,7 +34,7 @@ namespace Netch.Models /// /// 端口 /// - public int Port; + public ushort Port; /// /// 延迟 diff --git a/Netch/Servers/Shadowsocks/Models/SSD/Main.cs b/Netch/Servers/Shadowsocks/Models/SSD/Main.cs index 4494203f..cfa1c16a 100644 --- a/Netch/Servers/Shadowsocks/Models/SSD/Main.cs +++ b/Netch/Servers/Shadowsocks/Models/SSD/Main.cs @@ -12,7 +12,7 @@ namespace Netch.Servers.Shadowsocks.Models.SSD /// /// 端口 /// - public int port; + public ushort port; /// /// 加密方式 diff --git a/Netch/Servers/Shadowsocks/Models/SSD/SSDServer.cs b/Netch/Servers/Shadowsocks/Models/SSD/SSDServer.cs index 52cfa77d..ed246edb 100644 --- a/Netch/Servers/Shadowsocks/Models/SSD/SSDServer.cs +++ b/Netch/Servers/Shadowsocks/Models/SSD/SSDServer.cs @@ -10,7 +10,7 @@ /// /// 端口 /// - public int port; + public ushort port; /// /// 加密方式 diff --git a/Netch/Servers/Shadowsocks/Models/ShadowsocksConfig.cs b/Netch/Servers/Shadowsocks/Models/ShadowsocksConfig.cs index 9a32f11c..b28f19bb 100644 --- a/Netch/Servers/Shadowsocks/Models/ShadowsocksConfig.cs +++ b/Netch/Servers/Shadowsocks/Models/ShadowsocksConfig.cs @@ -3,7 +3,7 @@ namespace Netch.Servers.Shadowsocks.Models public class ShadowsocksConfig { public string server { get; set; } - public int server_port { get; set; } + public ushort server_port { get; set; } public string password { get; set; } public string method { get; set; } public string remarks { get; set; } diff --git a/Netch/Servers/Shadowsocks/SSUtil.cs b/Netch/Servers/Shadowsocks/SSUtil.cs index d325e27f..885c1751 100644 --- a/Netch/Servers/Shadowsocks/SSUtil.cs +++ b/Netch/Servers/Shadowsocks/SSUtil.cs @@ -140,7 +140,7 @@ namespace Netch.Servers.Shadowsocks if (!match.Success) throw new FormatException(); data.Hostname = match.Groups["server"].Value; - data.Port = int.Parse(match.Groups["port"].Value); + data.Port = ushort.Parse(match.Groups["port"].Value); var base64 = ShareLink.URLSafeBase64Decode(match.Groups["base64"].Value); match = parser.Match(base64); @@ -156,7 +156,7 @@ namespace Netch.Servers.Shadowsocks if (!match.Success) throw new FormatException(); data.Hostname = match.Groups["server"].Value; - data.Port = int.Parse(match.Groups["port"].Value); + data.Port = ushort.Parse(match.Groups["port"].Value); data.EncryptMethod = match.Groups["method"].Value; data.Password = match.Groups["password"].Value; } diff --git a/Netch/Servers/Socks5/S5Util.cs b/Netch/Servers/Socks5/S5Util.cs index 81a5102e..3983de7e 100644 --- a/Netch/Servers/Socks5/S5Util.cs +++ b/Netch/Servers/Socks5/S5Util.cs @@ -61,7 +61,7 @@ namespace Netch.Servers.Socks5 var data = new Socks5 { Hostname = dict["server"], - Port = int.Parse(dict["port"]) + Port = ushort.Parse(dict["port"]) }; if (dict.ContainsKey("user") && !string.IsNullOrWhiteSpace(dict["user"])) diff --git a/Netch/Servers/Trojan/TrojanUtil.cs b/Netch/Servers/Trojan/TrojanUtil.cs index 2408e289..9917176d 100644 --- a/Netch/Servers/Trojan/TrojanUtil.cs +++ b/Netch/Servers/Trojan/TrojanUtil.cs @@ -85,7 +85,7 @@ namespace Netch.Servers.Trojan data.Password = match.Groups["psk"].Value; data.Hostname = match.Groups["server"].Value; - data.Port = int.Parse(match.Groups["port"].Value); + data.Port = ushort.Parse(match.Groups["port"].Value); return new[] {data}; } diff --git a/Netch/Servers/VMess/Models/V2rayConfig.cs b/Netch/Servers/VMess/Models/V2rayConfig.cs index 88ece854..e2c591e8 100644 --- a/Netch/Servers/VMess/Models/V2rayConfig.cs +++ b/Netch/Servers/VMess/Models/V2rayConfig.cs @@ -15,7 +15,7 @@ namespace Netch.Servers.VMess.Models { public string tag { get; set; } - public int port { get; set; } + public ushort port { get; set; } public string listen { get; set; } @@ -92,7 +92,7 @@ namespace Netch.Servers.VMess.Models { public string address { get; set; } - public int port { get; set; } + public ushort port { get; set; } public List users { get; set; } } @@ -109,7 +109,7 @@ namespace Netch.Servers.VMess.Models public string password { get; set; } - public int port { get; set; } + public ushort port { get; set; } public int level { get; set; }