mirror of
https://github.com/2dust/v2rayN.git
synced 2026-02-28 05:03:02 +00:00
Refactor id and security
This commit is contained in:
parent
2d450357d1
commit
ee7d3c60b6
20 changed files with 302 additions and 222 deletions
|
|
@ -292,24 +292,28 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.ConfigType = EConfigType.VMess;
|
||||
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Security = profileItem.Security.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
protocolExtra.VmessSecurity = protocolExtra.VmessSecurity?.TrimEx();
|
||||
profileItem.Network = profileItem.Network.TrimEx();
|
||||
profileItem.HeaderType = profileItem.HeaderType.TrimEx();
|
||||
profileItem.RequestHost = profileItem.RequestHost.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.StreamSecurity = profileItem.StreamSecurity.TrimEx();
|
||||
|
||||
if (!Global.VmessSecurities.Contains(profileItem.Security))
|
||||
if (!Global.VmessSecurities.Contains(protocolExtra.VmessSecurity))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
profileItem.SetProtocolExtra(protocolExtra);
|
||||
|
||||
await AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
|
|
@ -607,19 +611,23 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.ConfigType = EConfigType.Shadowsocks;
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Security = profileItem.Security.TrimEx();
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
|
||||
if (!AppManager.Instance.GetShadowsocksSecurities(profileItem).Contains(profileItem.Security))
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
protocolExtra.SsMethod = protocolExtra.SsMethod.TrimEx();
|
||||
|
||||
if (!AppManager.Instance.GetShadowsocksSecurities(profileItem).Contains(protocolExtra.SsMethod))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
profileItem.SetProtocolExtra(protocolExtra);
|
||||
|
||||
await AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
|
|
@ -676,12 +684,12 @@ public static class ConfigHandler
|
|||
profileItem.ConfigType = EConfigType.Trojan;
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
if (profileItem.StreamSecurity.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.StreamSecurity = Global.StreamSecurity;
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -706,7 +714,7 @@ public static class ConfigHandler
|
|||
//profileItem.CoreType = ECoreType.sing_box;
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.Network = string.Empty;
|
||||
|
||||
|
|
@ -714,7 +722,7 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.StreamSecurity = Global.StreamSecurity;
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -738,9 +746,11 @@ public static class ConfigHandler
|
|||
profileItem.ConfigType = EConfigType.TUIC;
|
||||
profileItem.CoreType = ECoreType.sing_box;
|
||||
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Security = profileItem.Security.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
protocolExtra.Username = protocolExtra.Username?.TrimEx();
|
||||
profileItem.Network = string.Empty;
|
||||
|
||||
if (!Global.TuicCongestionControls.Contains(profileItem.HeaderType))
|
||||
|
|
@ -756,7 +766,7 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.Alpn = "h3";
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -778,22 +788,26 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.ConfigType = EConfigType.WireGuard;
|
||||
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.PublicKey = profileItem.PublicKey.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.RequestHost = profileItem.RequestHost.TrimEx();
|
||||
profileItem.Network = string.Empty;
|
||||
if (profileItem.ShortId.IsNullOrEmpty())
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
protocolExtra.WgPublicKey = protocolExtra.WgPublicKey?.TrimEx();
|
||||
protocolExtra.WgPresharedKey = protocolExtra.WgPresharedKey?.TrimEx();
|
||||
protocolExtra.WgInterfaceAddress = protocolExtra.WgInterfaceAddress?.TrimEx();
|
||||
protocolExtra.WgReserved = protocolExtra.WgReserved?.TrimEx();
|
||||
if (protocolExtra.WgMtu <= 0)
|
||||
{
|
||||
profileItem.ShortId = Global.TunMtus.First().ToString();
|
||||
protocolExtra.WgMtu = Global.TunMtus.First();
|
||||
}
|
||||
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
profileItem.SetProtocolExtra(protocolExtra);
|
||||
|
||||
await AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
|
|
@ -813,14 +827,13 @@ public static class ConfigHandler
|
|||
profileItem.CoreType = ECoreType.sing_box;
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Security = profileItem.Security.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Network = string.Empty;
|
||||
if (profileItem.StreamSecurity.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.StreamSecurity = Global.StreamSecurity;
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -858,7 +871,7 @@ public static class ConfigHandler
|
|||
Remarks = t.Remarks,
|
||||
Address = t.Address,
|
||||
Port = t.Port,
|
||||
Security = t.Security,
|
||||
//Security = t.Security,
|
||||
Network = t.Network,
|
||||
StreamSecurity = t.StreamSecurity,
|
||||
Delay = t33?.Delay ?? 0,
|
||||
|
|
@ -956,28 +969,28 @@ public static class ConfigHandler
|
|||
{
|
||||
profileItem.ConfigType = EConfigType.VLESS;
|
||||
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
|
||||
profileItem.Address = profileItem.Address.TrimEx();
|
||||
profileItem.Id = profileItem.Id.TrimEx();
|
||||
profileItem.Security = profileItem.Security.TrimEx();
|
||||
profileItem.Password = profileItem.Password.TrimEx();
|
||||
profileItem.Network = profileItem.Network.TrimEx();
|
||||
profileItem.HeaderType = profileItem.HeaderType.TrimEx();
|
||||
profileItem.RequestHost = profileItem.RequestHost.TrimEx();
|
||||
profileItem.Path = profileItem.Path.TrimEx();
|
||||
profileItem.StreamSecurity = profileItem.StreamSecurity.TrimEx();
|
||||
|
||||
var protocolExtra = profileItem.GetProtocolExtra();
|
||||
protocolExtra.VlessEncryption = protocolExtra.VlessEncryption?.TrimEx();
|
||||
|
||||
if (!Global.Flows.Contains(protocolExtra.Flow ?? string.Empty))
|
||||
{
|
||||
protocolExtra.Flow = Global.Flows.First();
|
||||
}
|
||||
if (profileItem.Id.IsNullOrEmpty())
|
||||
if (profileItem.Password.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (profileItem.Security.IsNullOrEmpty())
|
||||
if (protocolExtra.VlessEncryption.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.Security = Global.None;
|
||||
protocolExtra.VlessEncryption = Global.None;
|
||||
}
|
||||
|
||||
profileItem.SetProtocolExtra(protocolExtra);
|
||||
|
|
@ -1099,19 +1112,22 @@ public static class ConfigHandler
|
|||
return false;
|
||||
}
|
||||
|
||||
var protocolExtra = o.GetProtocolExtra();
|
||||
var oProtocolExtra = o.GetProtocolExtra();
|
||||
var nProtocolExtra = n.GetProtocolExtra();
|
||||
|
||||
return o.ConfigType == n.ConfigType
|
||||
&& AreEqual(o.Address, n.Address)
|
||||
&& o.Port == n.Port
|
||||
&& AreEqual(o.Id, n.Id)
|
||||
&& AreEqual(o.Security, n.Security)
|
||||
&& AreEqual(o.Password, n.Password)
|
||||
&& AreEqual(oProtocolExtra.VlessEncryption, nProtocolExtra.VlessEncryption)
|
||||
&& AreEqual(oProtocolExtra.SsMethod, nProtocolExtra.SsMethod)
|
||||
&& AreEqual(oProtocolExtra.VmessSecurity, nProtocolExtra.VmessSecurity)
|
||||
&& AreEqual(o.Network, n.Network)
|
||||
&& AreEqual(o.HeaderType, n.HeaderType)
|
||||
&& AreEqual(o.RequestHost, n.RequestHost)
|
||||
&& AreEqual(o.Path, n.Path)
|
||||
&& (o.ConfigType == EConfigType.Trojan || o.StreamSecurity == n.StreamSecurity)
|
||||
&& AreEqual(protocolExtra.Flow, protocolExtra.Flow)
|
||||
&& AreEqual(oProtocolExtra.Flow, nProtocolExtra.Flow)
|
||||
&& AreEqual(o.Sni, n.Sni)
|
||||
&& AreEqual(o.Alpn, n.Alpn)
|
||||
&& AreEqual(o.Fingerprint, n.Fingerprint)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class AnytlsFmt : BaseFmt
|
|||
Port = parsedUrl.Port,
|
||||
};
|
||||
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
|
||||
item.Id = rawUserInfo;
|
||||
item.Password = rawUserInfo;
|
||||
|
||||
var query = Utils.ParseQueryString(parsedUrl.Query);
|
||||
ResolveUriQuery(query, ref item);
|
||||
|
|
@ -39,7 +39,7 @@ public class AnytlsFmt : BaseFmt
|
|||
{
|
||||
remark = "#" + Utils.UrlEncode(item.Remarks);
|
||||
}
|
||||
var pw = item.Id;
|
||||
var pw = item.Password;
|
||||
var dicQuery = new Dictionary<string, string>();
|
||||
ToUriQuery(item, Global.None, ref dicQuery);
|
||||
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ public class Hysteria2Fmt : BaseFmt
|
|||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
item.Remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.Id = Utils.UrlDecode(url.UserInfo);
|
||||
item.Password = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
ResolveUriQuery(query, ref item);
|
||||
|
|
@ -75,7 +75,7 @@ public class Hysteria2Fmt : BaseFmt
|
|||
dicQuery.Add("pinSHA256", Utils.UrlEncode(sha));
|
||||
}
|
||||
|
||||
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Password, dicQuery, remark);
|
||||
}
|
||||
|
||||
public static ProfileItem? ResolveFull2(string strData, string? subRemarks)
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ public class ShadowsocksFmt : BaseFmt
|
|||
{
|
||||
return null;
|
||||
}
|
||||
if (item.Address.Length == 0 || item.Port == 0 || item.Security.Length == 0 || item.Id.Length == 0)
|
||||
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
if (item.Address.Length == 0 || item.Port == 0 || protocolExtra.SsMethod.IsNullOrEmpty() || item.Password.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
@ -40,7 +42,8 @@ public class ShadowsocksFmt : BaseFmt
|
|||
// item.port);
|
||||
//url = Utile.Base64Encode(url);
|
||||
//new Sip002
|
||||
var pw = Utils.Base64Encode($"{item.Security}:{item.Id}", true);
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
var pw = Utils.Base64Encode($"{protocolExtra.SsMethod}:{item.Password}", true);
|
||||
|
||||
// plugin
|
||||
var plugin = string.Empty;
|
||||
|
|
@ -136,10 +139,12 @@ public class ShadowsocksFmt : BaseFmt
|
|||
{
|
||||
return null;
|
||||
}
|
||||
item.Security = details.Groups["method"].Value;
|
||||
item.Id = details.Groups["password"].Value;
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
protocolExtra.SsMethod = details.Groups["method"].Value;
|
||||
item.Password = details.Groups["password"].Value;
|
||||
item.Address = details.Groups["hostname"].Value;
|
||||
item.Port = details.Groups["port"].Value.ToInt();
|
||||
item.SetProtocolExtra(protocolExtra);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -157,6 +162,7 @@ public class ShadowsocksFmt : BaseFmt
|
|||
Address = parsedUrl.IdnHost,
|
||||
Port = parsedUrl.Port,
|
||||
};
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
|
||||
//2022-blake3
|
||||
if (rawUserInfo.Contains(':'))
|
||||
|
|
@ -166,8 +172,8 @@ public class ShadowsocksFmt : BaseFmt
|
|||
{
|
||||
return null;
|
||||
}
|
||||
item.Security = userInfoParts.First();
|
||||
item.Id = Utils.UrlDecode(userInfoParts.Last());
|
||||
protocolExtra.SsMethod = userInfoParts.First();
|
||||
item.Password = Utils.UrlDecode(userInfoParts.Last());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -178,8 +184,8 @@ public class ShadowsocksFmt : BaseFmt
|
|||
{
|
||||
return null;
|
||||
}
|
||||
item.Security = userInfoParts.First();
|
||||
item.Id = userInfoParts.Last();
|
||||
protocolExtra.SsMethod = userInfoParts.First();
|
||||
item.Password = userInfoParts.Last();
|
||||
}
|
||||
|
||||
var queryParameters = Utils.ParseQueryString(parsedUrl.Query);
|
||||
|
|
@ -300,11 +306,11 @@ public class ShadowsocksFmt : BaseFmt
|
|||
var ssItem = new ProfileItem()
|
||||
{
|
||||
Remarks = it.remarks,
|
||||
Security = it.method,
|
||||
Id = it.password,
|
||||
Password = it.password,
|
||||
Address = it.server,
|
||||
Port = it.server_port.ToInt()
|
||||
};
|
||||
ssItem.SetProtocolExtra(new ProtocolExtraItem() { SsMethod = it.method });
|
||||
lst.Add(ssItem);
|
||||
}
|
||||
return lst;
|
||||
|
|
|
|||
|
|
@ -33,7 +33,8 @@ public class SocksFmt : BaseFmt
|
|||
remark = "#" + Utils.UrlEncode(item.Remarks);
|
||||
}
|
||||
//new
|
||||
var pw = Utils.Base64Encode($"{item.Security}:{item.Id}", true);
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
var pw = Utils.Base64Encode($"{protocolExtra.Username}:{item.Password}", true);
|
||||
return ToUri(EConfigType.SOCKS, item.Address, item.Port, pw, null, remark);
|
||||
}
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ public class SocksFmt : BaseFmt
|
|||
{
|
||||
ConfigType = EConfigType.SOCKS
|
||||
};
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
result = result[Global.ProtocolShares[EConfigType.SOCKS].Length..];
|
||||
//remark
|
||||
var indexRemark = result.IndexOf('#');
|
||||
|
|
@ -78,9 +80,10 @@ public class SocksFmt : BaseFmt
|
|||
}
|
||||
item.Address = arr1[1][..indexPort];
|
||||
item.Port = arr1[1][(indexPort + 1)..].ToInt();
|
||||
item.Security = arr21.First();
|
||||
item.Id = arr21[1];
|
||||
protocolExtra.Username = arr21.First();
|
||||
item.Password = arr21[1];
|
||||
|
||||
item.SetProtocolExtra(protocolExtra);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -98,6 +101,7 @@ public class SocksFmt : BaseFmt
|
|||
Address = parsedUrl.IdnHost,
|
||||
Port = parsedUrl.Port,
|
||||
};
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
// parse base64 UserInfo
|
||||
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
|
||||
|
|
@ -105,8 +109,8 @@ public class SocksFmt : BaseFmt
|
|||
var userInfoParts = userInfo.Split([':'], 2);
|
||||
if (userInfoParts.Length == 2)
|
||||
{
|
||||
item.Security = userInfoParts.First();
|
||||
item.Id = userInfoParts[1];
|
||||
protocolExtra.Username = userInfoParts.First();
|
||||
item.Password = userInfoParts[1];
|
||||
}
|
||||
|
||||
return item;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ public class TrojanFmt : BaseFmt
|
|||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
item.Remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.Id = Utils.UrlDecode(url.UserInfo);
|
||||
item.Password = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
ResolveUriQuery(query, ref item);
|
||||
|
|
@ -42,6 +42,6 @@ public class TrojanFmt : BaseFmt
|
|||
var dicQuery = new Dictionary<string, string>();
|
||||
ToUriQuery(item, null, ref dicQuery);
|
||||
|
||||
return ToUri(EConfigType.Trojan, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
return ToUri(EConfigType.Trojan, item.Address, item.Port, item.Password, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ public class TuicFmt : BaseFmt
|
|||
{
|
||||
ConfigType = EConfigType.TUIC
|
||||
};
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
|
|
@ -24,14 +25,15 @@ public class TuicFmt : BaseFmt
|
|||
var userInfoParts = rawUserInfo.Split(new[] { ':' }, 2);
|
||||
if (userInfoParts.Length == 2)
|
||||
{
|
||||
item.Id = userInfoParts.First();
|
||||
item.Security = userInfoParts.Last();
|
||||
item.Password = userInfoParts.First();
|
||||
protocolExtra.Username = userInfoParts.Last();
|
||||
}
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
ResolveUriQuery(query, ref item);
|
||||
item.HeaderType = GetQueryValue(query, "congestion_control");
|
||||
|
||||
item.SetProtocolExtra(protocolExtra);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -53,6 +55,6 @@ public class TuicFmt : BaseFmt
|
|||
|
||||
dicQuery.Add("congestion_control", item.HeaderType);
|
||||
|
||||
return ToUri(EConfigType.TUIC, item.Address, item.Port, $"{item.Id}:{item.Security}", dicQuery, remark);
|
||||
return ToUri(EConfigType.TUIC, item.Address, item.Port, $"{item.Password}:{item.GetProtocolExtra().Username ?? ""}", dicQuery, remark);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ public class VLESSFmt : BaseFmt
|
|||
ProfileItem item = new()
|
||||
{
|
||||
ConfigType = EConfigType.VLESS,
|
||||
Security = Global.None
|
||||
};
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null)
|
||||
|
|
@ -21,13 +21,14 @@ public class VLESSFmt : BaseFmt
|
|||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
item.Remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.Id = Utils.UrlDecode(url.UserInfo);
|
||||
item.Password = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
item.Security = GetQueryValue(query, "encryption", Global.None);
|
||||
protocolExtra.VlessEncryption = GetQueryValue(query, "encryption", Global.None);
|
||||
item.StreamSecurity = GetQueryValue(query, "security");
|
||||
ResolveUriQuery(query, ref item);
|
||||
|
||||
item.SetProtocolExtra(protocolExtra);
|
||||
return item;
|
||||
}
|
||||
|
||||
|
|
@ -38,22 +39,18 @@ public class VLESSFmt : BaseFmt
|
|||
return null;
|
||||
}
|
||||
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
var remark = string.Empty;
|
||||
if (item.Remarks.IsNotEmpty())
|
||||
{
|
||||
remark = "#" + Utils.UrlEncode(item.Remarks);
|
||||
}
|
||||
var dicQuery = new Dictionary<string, string>();
|
||||
if (item.Security.IsNotEmpty())
|
||||
{
|
||||
dicQuery.Add("encryption", item.Security);
|
||||
}
|
||||
else
|
||||
{
|
||||
dicQuery.Add("encryption", Global.None);
|
||||
}
|
||||
dicQuery.Add("encryption",
|
||||
!protocolExtra.VlessEncryption.IsNullOrEmpty() ? protocolExtra.VlessEncryption : Global.None);
|
||||
ToUriQuery(item, Global.None, ref dicQuery);
|
||||
|
||||
return ToUri(EConfigType.VLESS, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
return ToUri(EConfigType.VLESS, item.Address, item.Port, item.Password, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,9 @@ public class VmessFmt : BaseFmt
|
|||
ps = item.Remarks.TrimEx(),
|
||||
add = item.Address,
|
||||
port = item.Port,
|
||||
id = item.Id,
|
||||
id = item.Password,
|
||||
aid = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0,
|
||||
scy = item.Security,
|
||||
scy = item.GetProtocolExtra().VmessSecurity ?? "",
|
||||
net = item.Network,
|
||||
type = item.HeaderType,
|
||||
host = item.RequestHost,
|
||||
|
|
@ -77,14 +77,12 @@ public class VmessFmt : BaseFmt
|
|||
item.Remarks = Utils.ToString(vmessQRCode.ps);
|
||||
item.Address = Utils.ToString(vmessQRCode.add);
|
||||
item.Port = vmessQRCode.port;
|
||||
item.Id = Utils.ToString(vmessQRCode.id);
|
||||
item.Password = Utils.ToString(vmessQRCode.id);
|
||||
item.SetProtocolExtra(new ProtocolExtraItem
|
||||
{
|
||||
AlterId = vmessQRCode.aid.ToString(),
|
||||
VmessSecurity = vmessQRCode.scy.IsNullOrEmpty() ? Global.DefaultSecurity : vmessQRCode.scy,
|
||||
});
|
||||
item.Security = Utils.ToString(vmessQRCode.scy);
|
||||
|
||||
item.Security = vmessQRCode.scy.IsNotEmpty() ? vmessQRCode.scy : Global.DefaultSecurity;
|
||||
if (vmessQRCode.net.IsNotEmpty())
|
||||
{
|
||||
item.Network = vmessQRCode.net;
|
||||
|
|
@ -110,7 +108,6 @@ public class VmessFmt : BaseFmt
|
|||
var item = new ProfileItem
|
||||
{
|
||||
ConfigType = EConfigType.VMess,
|
||||
Security = "auto"
|
||||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
|
|
@ -122,7 +119,12 @@ public class VmessFmt : BaseFmt
|
|||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
item.Remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.Id = Utils.UrlDecode(url.UserInfo);
|
||||
item.Password = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
item.SetProtocolExtra(new ProtocolExtraItem
|
||||
{
|
||||
VmessSecurity = "auto",
|
||||
});
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
ResolveUriQuery(query, ref item);
|
||||
|
|
|
|||
|
|
@ -17,17 +17,20 @@ public class WireguardFmt : BaseFmt
|
|||
return null;
|
||||
}
|
||||
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
item.Remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.Id = Utils.UrlDecode(url.UserInfo);
|
||||
item.Password = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
|
||||
item.PublicKey = GetQueryDecoded(query, "publickey");
|
||||
item.Path = GetQueryDecoded(query, "reserved");
|
||||
item.RequestHost = GetQueryDecoded(query, "address");
|
||||
item.ShortId = GetQueryDecoded(query, "mtu");
|
||||
protocolExtra.WgPublicKey = GetQueryDecoded(query, "publickey");
|
||||
protocolExtra.WgReserved = GetQueryDecoded(query, "reserved");
|
||||
protocolExtra.WgInterfaceAddress = GetQueryDecoded(query, "address");
|
||||
protocolExtra.WgMtu = int.TryParse(GetQueryDecoded(query, "mtu"), out var mtu) ? mtu : 1280;
|
||||
protocolExtra.WgPresharedKey = GetQueryDecoded(query, "presharedKey");
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
@ -39,6 +42,8 @@ public class WireguardFmt : BaseFmt
|
|||
return null;
|
||||
}
|
||||
|
||||
var protocolExtra = item.GetProtocolExtra();
|
||||
|
||||
var remark = string.Empty;
|
||||
if (item.Remarks.IsNotEmpty())
|
||||
{
|
||||
|
|
@ -46,22 +51,19 @@ public class WireguardFmt : BaseFmt
|
|||
}
|
||||
|
||||
var dicQuery = new Dictionary<string, string>();
|
||||
if (item.PublicKey.IsNotEmpty())
|
||||
if (!protocolExtra.WgPublicKey.IsNullOrEmpty())
|
||||
{
|
||||
dicQuery.Add("publickey", Utils.UrlEncode(item.PublicKey));
|
||||
dicQuery.Add("publickey", Utils.UrlEncode(protocolExtra.WgPublicKey));
|
||||
}
|
||||
if (item.Path.IsNotEmpty())
|
||||
if (!protocolExtra.WgReserved.IsNullOrEmpty())
|
||||
{
|
||||
dicQuery.Add("reserved", Utils.UrlEncode(item.Path));
|
||||
dicQuery.Add("reserved", Utils.UrlEncode(protocolExtra.WgReserved));
|
||||
}
|
||||
if (item.RequestHost.IsNotEmpty())
|
||||
if (!protocolExtra.WgInterfaceAddress.IsNullOrEmpty())
|
||||
{
|
||||
dicQuery.Add("address", Utils.UrlEncode(item.RequestHost));
|
||||
dicQuery.Add("address", Utils.UrlEncode(protocolExtra.WgInterfaceAddress));
|
||||
}
|
||||
if (item.ShortId.IsNotEmpty())
|
||||
{
|
||||
dicQuery.Add("mtu", Utils.UrlEncode(item.ShortId));
|
||||
}
|
||||
return ToUri(EConfigType.WireGuard, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
dicQuery.Add("mtu", Utils.UrlEncode(protocolExtra.WgMtu > 0 ? protocolExtra.WgMtu.ToString() : "1280"));
|
||||
return ToUri(EConfigType.WireGuard, item.Address, item.Port, item.Password, dicQuery, remark);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using ServiceLib.Common;
|
||||
|
||||
namespace ServiceLib.Manager;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -133,17 +135,17 @@ public class ActionPrecheckManager
|
|||
switch (item.ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
if (item.Id.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Id))
|
||||
if (item.Password.IsNullOrEmpty() || !Utils.IsGuidByParse(item.Password))
|
||||
{
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Id"));
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Password"));
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
if (item.Id.IsNullOrEmpty() || (!Utils.IsGuidByParse(item.Id) && item.Id.Length > 30))
|
||||
if (item.Password.IsNullOrEmpty() || (!Utils.IsGuidByParse(item.Password) && item.Password.Length > 30))
|
||||
{
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Id"));
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Password"));
|
||||
}
|
||||
|
||||
if (!Global.Flows.Contains(protocolExtra.Flow ?? string.Empty))
|
||||
|
|
@ -154,14 +156,14 @@ public class ActionPrecheckManager
|
|||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
if (item.Id.IsNullOrEmpty())
|
||||
if (item.Password.IsNullOrEmpty())
|
||||
{
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Id"));
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Password"));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(item.Security) || !Global.SsSecuritiesInSingbox.Contains(item.Security))
|
||||
if (string.IsNullOrEmpty(protocolExtra.SsMethod) || !Global.SsSecuritiesInSingbox.Contains(protocolExtra.SsMethod))
|
||||
{
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "Security"));
|
||||
errors.Add(string.Format(ResUI.InvalidProperty, "SsMethod"));
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -294,6 +294,22 @@ public sealed class AppManager
|
|||
extra.Filter = groupItem.Filter;
|
||||
extra.MultipleLoad = groupItem.MultipleLoad;
|
||||
}
|
||||
|
||||
switch (item.ConfigType)
|
||||
{
|
||||
case EConfigType.Shadowsocks:
|
||||
extra.SsMethod = item.Security.IsNotEmpty() ? item.Security : null;
|
||||
break;
|
||||
case EConfigType.VMess:
|
||||
extra.VmessSecurity = item.Security.IsNotEmpty() ? item.Security : null;
|
||||
break;
|
||||
case EConfigType.WireGuard:
|
||||
extra.WgPublicKey = item.PublicKey.IsNotEmpty() ? item.PublicKey : null;
|
||||
extra.WgInterfaceAddress = item.RequestHost.IsNotEmpty() ? item.RequestHost : null;
|
||||
extra.WgReserved = item.Path.IsNotEmpty() ? item.Path : null;
|
||||
extra.WgMtu = int.TryParse(item.ShortId, out var mtu) ? mtu : 1280;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
item.SetProtocolExtra(extra);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using ServiceLib.Common;
|
||||
|
||||
namespace ServiceLib.Models;
|
||||
|
||||
[Serializable]
|
||||
|
|
@ -11,9 +13,6 @@ public class ProfileItem : ReactiveObject
|
|||
Address = string.Empty;
|
||||
Port = 0;
|
||||
Password = string.Empty;
|
||||
Id = string.Empty;
|
||||
AlterId = 0;
|
||||
Security = string.Empty;
|
||||
Network = string.Empty;
|
||||
Remarks = string.Empty;
|
||||
HeaderType = string.Empty;
|
||||
|
|
@ -22,7 +21,6 @@ public class ProfileItem : ReactiveObject
|
|||
StreamSecurity = string.Empty;
|
||||
AllowInsecure = string.Empty;
|
||||
Subid = string.Empty;
|
||||
Flow = string.Empty;
|
||||
}
|
||||
|
||||
#region function
|
||||
|
|
@ -82,7 +80,7 @@ public class ProfileItem : ReactiveObject
|
|||
switch (ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
if (Id.IsNullOrEmpty() || !Utils.IsGuidByParse(Id))
|
||||
if (Password.IsNullOrEmpty() || !Utils.IsGuidByParse(Password))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -90,7 +88,7 @@ public class ProfileItem : ReactiveObject
|
|||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
if (Id.IsNullOrEmpty() || (!Utils.IsGuidByParse(Id) && Id.Length > 30))
|
||||
if (Password.IsNullOrEmpty() || (!Utils.IsGuidByParse(Password) && Password.Length > 30))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -103,12 +101,15 @@ public class ProfileItem : ReactiveObject
|
|||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
if (Id.IsNullOrEmpty())
|
||||
if (Password.IsNullOrEmpty())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(Security) || !Global.SsSecuritiesInSingbox.Contains(Security))
|
||||
var protocolExtra = GetProtocolExtra();
|
||||
|
||||
if (string.IsNullOrEmpty(protocolExtra.SsMethod)
|
||||
|| !Global.SsSecuritiesInSingbox.Contains(protocolExtra.SsMethod))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace ServiceLib.Services.CoreConfig;
|
||||
|
||||
public partial class CoreConfigSingboxService
|
||||
|
|
@ -15,11 +17,11 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
case EConfigType.VMess:
|
||||
{
|
||||
outbound.uuid = node.Id;
|
||||
outbound.alter_id = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0;
|
||||
if (Global.VmessSecurities.Contains(node.Security))
|
||||
outbound.uuid = node.Password;
|
||||
outbound.alter_id = int.TryParse(protocolExtra.AlterId, out var result) ? result : 0;
|
||||
if (Global.VmessSecurities.Contains(protocolExtra.VmessSecurity))
|
||||
{
|
||||
outbound.security = node.Security;
|
||||
outbound.security = protocolExtra.VmessSecurity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -32,8 +34,9 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Shadowsocks:
|
||||
{
|
||||
outbound.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(node.Security) ? node.Security : Global.None;
|
||||
outbound.password = node.Id;
|
||||
outbound.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(protocolExtra.SsMethod)
|
||||
? protocolExtra.SsMethod : Global.None;
|
||||
outbound.password = node.Password;
|
||||
|
||||
if (node.Network == nameof(ETransport.tcp) && node.HeaderType == Global.TcpHeaderHttp)
|
||||
{
|
||||
|
|
@ -89,27 +92,27 @@ public partial class CoreConfigSingboxService
|
|||
case EConfigType.SOCKS:
|
||||
{
|
||||
outbound.version = "5";
|
||||
if (node.Security.IsNotEmpty()
|
||||
&& node.Id.IsNotEmpty())
|
||||
if (protocolExtra.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
{
|
||||
outbound.username = node.Security;
|
||||
outbound.password = node.Id;
|
||||
outbound.username = protocolExtra.Username;
|
||||
outbound.password = node.Password;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EConfigType.HTTP:
|
||||
{
|
||||
if (node.Security.IsNotEmpty()
|
||||
&& node.Id.IsNotEmpty())
|
||||
if (protocolExtra.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
{
|
||||
outbound.username = node.Security;
|
||||
outbound.password = node.Id;
|
||||
outbound.username = protocolExtra.Username;
|
||||
outbound.password = node.Password;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EConfigType.VLESS:
|
||||
{
|
||||
outbound.uuid = node.Id;
|
||||
outbound.uuid = node.Password;
|
||||
|
||||
outbound.packet_encoding = "xudp";
|
||||
|
||||
|
|
@ -127,7 +130,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Trojan:
|
||||
{
|
||||
outbound.password = node.Id;
|
||||
outbound.password = node.Password;
|
||||
|
||||
await GenOutboundMux(node, outbound);
|
||||
await GenOutboundTransport(node, outbound);
|
||||
|
|
@ -135,7 +138,7 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.Hysteria2:
|
||||
{
|
||||
outbound.password = node.Id;
|
||||
outbound.password = node.Password;
|
||||
|
||||
if (node.Path.IsNotEmpty())
|
||||
{
|
||||
|
|
@ -174,14 +177,14 @@ public partial class CoreConfigSingboxService
|
|||
}
|
||||
case EConfigType.TUIC:
|
||||
{
|
||||
outbound.uuid = node.Id;
|
||||
outbound.password = node.Security;
|
||||
outbound.uuid = node.Password;
|
||||
outbound.password = protocolExtra.Username;
|
||||
outbound.congestion_control = node.HeaderType;
|
||||
break;
|
||||
}
|
||||
case EConfigType.Anytls:
|
||||
{
|
||||
outbound.password = node.Id;
|
||||
outbound.password = node.Password;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -199,7 +202,9 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
try
|
||||
{
|
||||
endpoint.address = Utils.String2List(node.RequestHost);
|
||||
var protocolExtra = node.GetProtocolExtra();
|
||||
|
||||
endpoint.address = Utils.String2List(protocolExtra.WgInterfaceAddress);
|
||||
endpoint.type = Global.ProtocolTypes[node.ConfigType];
|
||||
|
||||
switch (node.ConfigType)
|
||||
|
|
@ -208,16 +213,17 @@ public partial class CoreConfigSingboxService
|
|||
{
|
||||
var peer = new Peer4Sbox
|
||||
{
|
||||
public_key = node.PublicKey,
|
||||
reserved = Utils.String2List(node.Path)?.Select(int.Parse).ToList(),
|
||||
public_key = protocolExtra.WgPublicKey,
|
||||
pre_shared_key = protocolExtra.WgPresharedKey,
|
||||
reserved = Utils.String2List(protocolExtra.WgReserved)?.Select(int.Parse).ToList(),
|
||||
address = node.Address,
|
||||
port = node.Port,
|
||||
// TODO default ["0.0.0.0/0", "::/0"]
|
||||
allowed_ips = new() { "0.0.0.0/0", "::/0" },
|
||||
};
|
||||
endpoint.private_key = node.Id;
|
||||
endpoint.mtu = node.ShortId.IsNullOrEmpty() ? Global.TunMtus.First() : node.ShortId.ToInt();
|
||||
endpoint.peers = new() { peer };
|
||||
endpoint.private_key = node.Password;
|
||||
endpoint.mtu = protocolExtra.WgMtu > 0 ? protocolExtra.WgMtu : Global.TunMtus.First();
|
||||
endpoint.peers = [peer];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
using System.Linq;
|
||||
|
||||
namespace ServiceLib.Services.CoreConfig;
|
||||
|
||||
public partial class CoreConfigV2rayService
|
||||
|
|
@ -36,12 +38,12 @@ public partial class CoreConfigV2rayService
|
|||
usersItem = vnextItem.users.First();
|
||||
}
|
||||
|
||||
usersItem.id = node.Id;
|
||||
usersItem.id = node.Password;
|
||||
usersItem.alterId = int.TryParse(protocolExtra?.AlterId, out var result) ? result : 0;
|
||||
usersItem.email = Global.UserEMail;
|
||||
if (Global.VmessSecurities.Contains(node.Security))
|
||||
if (Global.VmessSecurities.Contains(protocolExtra.VmessSecurity))
|
||||
{
|
||||
usersItem.security = node.Security;
|
||||
usersItem.security = protocolExtra.VmessSecurity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -67,8 +69,9 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
serversItem.address = node.Address;
|
||||
serversItem.port = node.Port;
|
||||
serversItem.password = node.Id;
|
||||
serversItem.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(node.Security) ? node.Security : "none";
|
||||
serversItem.password = node.Password;
|
||||
serversItem.method = AppManager.Instance.GetShadowsocksSecurities(node).Contains(protocolExtra.SsMethod)
|
||||
? protocolExtra.SsMethod : "none";
|
||||
|
||||
serversItem.ota = false;
|
||||
serversItem.level = 1;
|
||||
|
|
@ -96,13 +99,13 @@ public partial class CoreConfigV2rayService
|
|||
serversItem.method = null;
|
||||
serversItem.password = null;
|
||||
|
||||
if (node.Security.IsNotEmpty()
|
||||
&& node.Id.IsNotEmpty())
|
||||
if (protocolExtra.Username.IsNotEmpty()
|
||||
&& node.Password.IsNotEmpty())
|
||||
{
|
||||
SocksUsersItem4Ray socksUsersItem = new()
|
||||
{
|
||||
user = node.Security,
|
||||
pass = node.Id,
|
||||
user = protocolExtra.Username ?? "",
|
||||
pass = node.Password,
|
||||
level = 1
|
||||
};
|
||||
|
||||
|
|
@ -139,9 +142,9 @@ public partial class CoreConfigV2rayService
|
|||
{
|
||||
usersItem = vnextItem.users.First();
|
||||
}
|
||||
usersItem.id = node.Id;
|
||||
usersItem.id = node.Password;
|
||||
usersItem.email = Global.UserEMail;
|
||||
usersItem.encryption = node.Security;
|
||||
usersItem.encryption = protocolExtra.VlessEncryption;
|
||||
|
||||
if (protocolExtra.Flow.IsNullOrEmpty())
|
||||
{
|
||||
|
|
@ -169,7 +172,7 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
serversItem.address = node.Address;
|
||||
serversItem.port = node.Port;
|
||||
serversItem.password = node.Id;
|
||||
serversItem.password = node.Password;
|
||||
|
||||
serversItem.ota = false;
|
||||
serversItem.level = 1;
|
||||
|
|
@ -200,16 +203,16 @@ public partial class CoreConfigV2rayService
|
|||
}
|
||||
var peer = new WireguardPeer4Ray
|
||||
{
|
||||
publicKey = node.PublicKey,
|
||||
publicKey = protocolExtra.WgPublicKey ?? "",
|
||||
endpoint = address + ":" + node.Port.ToString()
|
||||
};
|
||||
var setting = new Outboundsettings4Ray
|
||||
{
|
||||
address = Utils.String2List(node.RequestHost),
|
||||
secretKey = node.Id,
|
||||
reserved = Utils.String2List(node.Path)?.Select(int.Parse).ToList(),
|
||||
mtu = node.ShortId.IsNullOrEmpty() ? Global.TunMtus.First() : node.ShortId.ToInt(),
|
||||
peers = new List<WireguardPeer4Ray> { peer }
|
||||
address = Utils.String2List(protocolExtra.WgInterfaceAddress),
|
||||
secretKey = node.Password,
|
||||
reserved = Utils.String2List(protocolExtra.WgReserved)?.Select(int.Parse).ToList(),
|
||||
mtu = protocolExtra.WgMtu > 0 ? protocolExtra.WgMtu : Global.TunMtus.First(),
|
||||
peers = [peer]
|
||||
};
|
||||
outbound.settings = setting;
|
||||
outbound.settings.vnext = null;
|
||||
|
|
@ -534,7 +537,7 @@ public partial class CoreConfigV2rayService
|
|||
HysteriaSettings4Ray hysteriaSettings = new()
|
||||
{
|
||||
version = 2,
|
||||
auth = node.Id,
|
||||
auth = node.Password,
|
||||
up = upMbps > 0 ? $"{upMbps}mbps" : null,
|
||||
down = downMbps > 0 ? $"{downMbps}mbps" : null,
|
||||
udphop = udpHop,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,29 @@ public class AddServerViewModel : MyReactiveObject
|
|||
[Reactive]
|
||||
public string Flow { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string VmessSecurity { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string VlessEncryption { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string SsMethod { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string Username { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string WgPublicKey { get; set; }
|
||||
//[Reactive]
|
||||
//public string WgPresharedKey { get; set; }
|
||||
[Reactive]
|
||||
public string WgInterfaceAddress { get; set; }
|
||||
[Reactive]
|
||||
public string WgReserved { get; set; }
|
||||
[Reactive]
|
||||
public int WgMtu { get; set; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> FetchCertCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> FetchCertChainCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
|
|
@ -89,6 +112,14 @@ public class AddServerViewModel : MyReactiveObject
|
|||
UpMbps = protocolExtra?.UpMbps ?? 0;
|
||||
DownMbps = protocolExtra?.DownMbps ?? 0;
|
||||
HopInterval = protocolExtra?.HopInterval ?? Global.Hysteria2DefaultHopInt;
|
||||
VmessSecurity = protocolExtra?.VmessSecurity?.IsNullOrEmpty() == false ? protocolExtra.VmessSecurity : Global.DefaultSecurity;
|
||||
VlessEncryption = protocolExtra?.VlessEncryption.IsNullOrEmpty() == false ? protocolExtra.VlessEncryption : Global.None;
|
||||
SsMethod = protocolExtra?.SsMethod ?? string.Empty;
|
||||
Username = protocolExtra?.Username ?? string.Empty;
|
||||
WgPublicKey = protocolExtra?.WgPublicKey ?? string.Empty;
|
||||
WgInterfaceAddress = protocolExtra?.WgInterfaceAddress ?? string.Empty;
|
||||
WgReserved = protocolExtra?.WgReserved ?? string.Empty;
|
||||
WgMtu = protocolExtra?.WgMtu ?? 1280;
|
||||
}
|
||||
|
||||
private async Task SaveServerAsync()
|
||||
|
|
@ -113,12 +144,12 @@ public class AddServerViewModel : MyReactiveObject
|
|||
}
|
||||
if (SelectedSource.ConfigType == EConfigType.Shadowsocks)
|
||||
{
|
||||
if (SelectedSource.Id.IsNullOrEmpty())
|
||||
if (SelectedSource.Password.IsNullOrEmpty())
|
||||
{
|
||||
NoticeManager.Instance.Enqueue(ResUI.FillPassword);
|
||||
return;
|
||||
}
|
||||
if (SelectedSource.Security.IsNullOrEmpty())
|
||||
if (SsMethod.IsNullOrEmpty())
|
||||
{
|
||||
NoticeManager.Instance.Enqueue(ResUI.PleaseSelectEncryption);
|
||||
return;
|
||||
|
|
@ -126,7 +157,7 @@ public class AddServerViewModel : MyReactiveObject
|
|||
}
|
||||
if (SelectedSource.ConfigType is not EConfigType.SOCKS and not EConfigType.HTTP)
|
||||
{
|
||||
if (SelectedSource.Id.IsNullOrEmpty())
|
||||
if (SelectedSource.Password.IsNullOrEmpty())
|
||||
{
|
||||
NoticeManager.Instance.Enqueue(ResUI.FillUUID);
|
||||
return;
|
||||
|
|
@ -136,12 +167,20 @@ public class AddServerViewModel : MyReactiveObject
|
|||
SelectedSource.Cert = Cert.IsNullOrEmpty() ? string.Empty : Cert;
|
||||
SelectedSource.CertSha = CertSha.IsNullOrEmpty() ? string.Empty : CertSha;
|
||||
var protocolExtra = SelectedSource.GetProtocolExtra();
|
||||
protocolExtra.Ports = Ports;
|
||||
protocolExtra.Ports = Ports.IsNullOrEmpty() ? null : Ports;
|
||||
protocolExtra.AlterId = AlterId > 0 ? AlterId.ToString() : string.Empty;
|
||||
protocolExtra.Flow = Flow;
|
||||
protocolExtra.UpMbps = UpMbps;
|
||||
protocolExtra.DownMbps = DownMbps;
|
||||
protocolExtra.HopInterval = HopInterval >= 5 ? HopInterval : Global.Hysteria2DefaultHopInt;
|
||||
protocolExtra.Flow = Flow.IsNullOrEmpty() ? null : Flow;
|
||||
protocolExtra.UpMbps = UpMbps > 0 ? UpMbps : null;
|
||||
protocolExtra.DownMbps = DownMbps > 0 ? DownMbps : null;
|
||||
protocolExtra.HopInterval = HopInterval >= 5 ? HopInterval : null;
|
||||
protocolExtra.VmessSecurity = VmessSecurity.IsNullOrEmpty() ? null : VmessSecurity;
|
||||
protocolExtra.VlessEncryption = VlessEncryption.IsNullOrEmpty() ? null : VlessEncryption;
|
||||
protocolExtra.SsMethod = SsMethod.IsNullOrEmpty() ? null : SsMethod;
|
||||
protocolExtra.Username = Username.IsNullOrEmpty() ? null : Username;
|
||||
protocolExtra.WgPublicKey = WgPublicKey.IsNullOrEmpty() ? null : WgPublicKey;
|
||||
protocolExtra.WgInterfaceAddress = WgInterfaceAddress.IsNullOrEmpty() ? null : WgInterfaceAddress;
|
||||
protocolExtra.WgReserved = WgReserved.IsNullOrEmpty() ? null : WgReserved;
|
||||
protocolExtra.WgMtu = WgMtu >= 576 ? WgMtu : null;
|
||||
SelectedSource.SetProtocolExtra(protocolExtra);
|
||||
|
||||
if (await ConfigHandler.AddServer(_config, SelectedSource) == 0)
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ public class ProfilesSelectViewModel : MyReactiveObject
|
|||
Remarks = t.Remarks,
|
||||
Address = t.Address,
|
||||
Port = t.Port,
|
||||
Security = t.Security,
|
||||
//Security = t.Security,
|
||||
Network = t.Network,
|
||||
StreamSecurity = t.StreamSecurity,
|
||||
Subid = t.Subid,
|
||||
|
|
|
|||
|
|
@ -446,7 +446,7 @@ public class ProfilesViewModel : MyReactiveObject
|
|||
Remarks = t.Remarks,
|
||||
Address = t.Address,
|
||||
Port = t.Port,
|
||||
Security = t.Security,
|
||||
//Security = t.Security,
|
||||
Network = t.Network,
|
||||
StreamSecurity = t.StreamSecurity,
|
||||
Subid = t.Subid,
|
||||
|
|
|
|||
|
|
@ -39,10 +39,6 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||
case EConfigType.VMess:
|
||||
gridVMess.IsVisible = true;
|
||||
cmbSecurity.ItemsSource = Global.VmessSecurities;
|
||||
if (profileItem.Security.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.Security = Global.DefaultSecurity;
|
||||
}
|
||||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
|
|
@ -59,10 +55,6 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||
gridVLESS.IsVisible = true;
|
||||
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||
cmbFlow5.ItemsSource = Global.Flows;
|
||||
if (profileItem.Security.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.Security = Global.None;
|
||||
}
|
||||
break;
|
||||
|
||||
case EConfigType.Trojan:
|
||||
|
|
@ -119,39 +111,39 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||
switch (profileItem.ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.AlterId, v => v.txtAlterId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.cmbSecurity.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.VmessSecurity, v => v.cmbSecurity.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.cmbSecurity3.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.SOCKS:
|
||||
case EConfigType.HTTP:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Username, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow5.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.VlessEncryption, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Trojan:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow6.SelectedValue).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Hysteria2:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Ports, v => v.txtPorts7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.HopInterval, v => v.txtHopInt7.Text).DisposeWith(disposables);
|
||||
|
|
@ -160,21 +152,21 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
|||
break;
|
||||
|
||||
case EConfigType.TUIC:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Username, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType8.SelectedValue).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.WireGuard:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.PublicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.RequestHost, v => v.txtRequestHost9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.ShortId, v => v.txtShortId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgPublicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgReserved, v => v.txtPath9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgInterfaceAddress, v => v.txtRequestHost9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgMtu, v => v.txtShortId9.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Anytls:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId10.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId10.Text).DisposeWith(disposables);
|
||||
break;
|
||||
}
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.SelectedValue).DisposeWith(disposables);
|
||||
|
|
|
|||
|
|
@ -34,10 +34,6 @@ public partial class AddServerWindow
|
|||
case EConfigType.VMess:
|
||||
gridVMess.Visibility = Visibility.Visible;
|
||||
cmbSecurity.ItemsSource = Global.VmessSecurities;
|
||||
if (profileItem.Security.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.Security = Global.DefaultSecurity;
|
||||
}
|
||||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
|
|
@ -54,10 +50,6 @@ public partial class AddServerWindow
|
|||
gridVLESS.Visibility = Visibility.Visible;
|
||||
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||
cmbFlow5.ItemsSource = Global.Flows;
|
||||
if (profileItem.Security.IsNullOrEmpty())
|
||||
{
|
||||
profileItem.Security = Global.None;
|
||||
}
|
||||
break;
|
||||
|
||||
case EConfigType.Trojan:
|
||||
|
|
@ -114,39 +106,39 @@ public partial class AddServerWindow
|
|||
switch (profileItem.ConfigType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.AlterId, v => v.txtAlterId.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.cmbSecurity.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.VmessSecurity, v => v.cmbSecurity.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.cmbSecurity3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SsMethod, v => v.cmbSecurity3.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled3.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.SOCKS:
|
||||
case EConfigType.HTTP:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Username, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.VlessEncryption, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled5.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Trojan:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Flow, v => v.cmbFlow6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.MuxEnabled, v => v.togmuxEnabled6.IsChecked).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Hysteria2:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Ports, v => v.txtPorts7.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.HopInterval, v => v.txtHopInt7.Text).DisposeWith(disposables);
|
||||
|
|
@ -155,21 +147,21 @@ public partial class AddServerWindow
|
|||
break;
|
||||
|
||||
case EConfigType.TUIC:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Security, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.Username, v => v.txtSecurity8.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.HeaderType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.WireGuard:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.PublicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Path, v => v.txtPath9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.RequestHost, v => v.txtRequestHost9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.ShortId, v => v.txtShortId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgPublicKey, v => v.txtPublicKey9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgReserved, v => v.txtPath9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgInterfaceAddress, v => v.txtRequestHost9.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.WgMtu, v => v.txtShortId9.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Anytls:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Id, v => v.txtId10.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId10.Text).DisposeWith(disposables);
|
||||
break;
|
||||
}
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.Text).DisposeWith(disposables);
|
||||
|
|
|
|||
Loading…
Reference in a new issue