Update SS/SSR Parameter

This commit is contained in:
ChsBuffer
2021-03-19 03:55:53 +08:00
parent 18168c3a4e
commit 95de42e778
3 changed files with 16 additions and 8 deletions

View File

@@ -27,9 +27,9 @@ namespace Netch.Servers.Shadowsocks
var command = new SSParameter
{
s = server.AutoResolveHostname(),
p = server.Port.ToString(),
p = server.Port,
b = this.LocalAddress(),
l = this.Socks5LocalPort().ToString(),
l = this.Socks5LocalPort(),
m = server.EncryptMethod,
k = server.Password,
u = true,
@@ -48,11 +48,11 @@ namespace Netch.Servers.Shadowsocks
{
public string? s { get; set; }
public string? p { get; set; }
public ushort? p { get; set; }
public string? b { get; set; }
public string? l { get; set; }
public ushort? l { get; set; }
public string? m { get; set; }

View File

@@ -27,7 +27,7 @@ namespace Netch.Servers.ShadowsocksR
var command = new SSRParameter
{
s = server.AutoResolveHostname(),
p = server.Port.ToString(),
p = server.Port,
k = server.Password,
m = server.EncryptMethod,
t = "120",
@@ -36,7 +36,7 @@ namespace Netch.Servers.ShadowsocksR
o = server.OBFS,
g = server.OBFSParam,
b = this.LocalAddress(),
l = this.Socks5LocalPort().ToString(),
l = this.Socks5LocalPort(),
u = true
};
@@ -51,7 +51,7 @@ namespace Netch.Servers.ShadowsocksR
{
public string? s { get; set; }
public string? p { get; set; }
public ushort? p { get; set; }
[Quote]
public string? k { get; set; }
@@ -74,7 +74,7 @@ namespace Netch.Servers.ShadowsocksR
public string? b { get; set; }
public string? l { get; set; }
public ushort? l { get; set; }
public bool u { get; set; }

View File

@@ -74,6 +74,13 @@ namespace UnitTest
public string? udp { get; set; } = null;
}
private class Number : ParameterBase
{
public ushort a { get; set; } = 1;
public int b { get; set; } = 1;
}
[TestMethod]
public void Test()
{
@@ -85,6 +92,7 @@ namespace UnitTest
Assert.AreEqual(new FlagAndOptional().ToString(), "--a");
Assert.ThrowsException<RequiredArgumentValueInvalidException>(() => { _ = new RequiredEmpty().ToString(); });
Assert.ThrowsException<RequiredArgumentValueInvalidException>(() => { _ = new RequiredNull().ToString(); });
Assert.AreEqual(new Number().ToString(), "--a 1 --b 1");
}
}
}