mirror of https://github.com/2dust/v2rayN
parent
39faccfd0b
commit
9f4718af70
|
@ -1,9 +1,4 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
namespace v2rayN.Common
|
||||
|
@ -60,4 +55,4 @@ namespace v2rayN.Common
|
|||
|
||||
#endregion YAML
|
||||
}
|
||||
}
|
||||
}
|
|
@ -59,6 +59,10 @@ namespace v2rayN.Handler.Fmt
|
|||
{
|
||||
dicQuery.Add("spx", Utils.UrlEncode(item.spiderX));
|
||||
}
|
||||
if (item.allowInsecure.Equals("true"))
|
||||
{
|
||||
dicQuery.Add("allowInsecure", "1");
|
||||
}
|
||||
|
||||
dicQuery.Add("type", !Utils.IsNullOrEmpty(item.network) ? item.network : nameof(ETransport.tcp));
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
|
@ -7,17 +6,13 @@ namespace v2rayN.Handler.Fmt
|
|||
{
|
||||
internal class VmessFmt : BaseFmt
|
||||
{
|
||||
private static readonly Regex StdVmessUserInfo = new(
|
||||
@"^(?<network>[a-z]+)(\+(?<streamSecurity>[a-z]+))?:(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$", RegexOptions.Compiled);
|
||||
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
||||
msg = ResUI.ConfigurationFormatIncorrect;
|
||||
ProfileItem? item;
|
||||
int indexSplit = str.IndexOf("?");
|
||||
if (indexSplit > 0)
|
||||
if (str.IndexOf('?') > 0 && str.IndexOf('&') > 0)
|
||||
{
|
||||
item = ResolveStdVmess(str) ?? ResolveVmess4Kitsunebi(str);
|
||||
item = ResolveStdVmess(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -107,7 +102,7 @@ namespace v2rayN.Handler.Fmt
|
|||
return item;
|
||||
}
|
||||
|
||||
private static ProfileItem? ResolveStdVmess(string result)
|
||||
public static ProfileItem? ResolveStdVmess(string str)
|
||||
{
|
||||
ProfileItem item = new()
|
||||
{
|
||||
|
@ -115,113 +110,15 @@ namespace v2rayN.Handler.Fmt
|
|||
security = "auto"
|
||||
};
|
||||
|
||||
Uri u = new(result);
|
||||
Uri url = new(str);
|
||||
|
||||
item.address = u.IdnHost;
|
||||
item.port = u.Port;
|
||||
item.remarks = u.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
var query = Utils.ParseQueryString(u.Query);
|
||||
item.address = url.IdnHost;
|
||||
item.port = url.Port;
|
||||
item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.id = Utils.UrlDecode(url.UserInfo);
|
||||
|
||||
var m = StdVmessUserInfo.Match(u.UserInfo);
|
||||
if (!m.Success) return null;
|
||||
|
||||
item.id = m.Groups["id"].Value;
|
||||
|
||||
if (m.Groups["streamSecurity"].Success)
|
||||
{
|
||||
item.streamSecurity = m.Groups["streamSecurity"].Value;
|
||||
}
|
||||
switch (item.streamSecurity)
|
||||
{
|
||||
case Global.StreamSecurity:
|
||||
break;
|
||||
|
||||
default:
|
||||
if (!Utils.IsNullOrEmpty(item.streamSecurity))
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
|
||||
item.network = m.Groups["network"].Value;
|
||||
switch (item.network)
|
||||
{
|
||||
case nameof(ETransport.tcp):
|
||||
string t1 = query["type"] ?? Global.None;
|
||||
item.headerType = t1;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.kcp):
|
||||
item.headerType = query["type"] ?? Global.None;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.ws):
|
||||
case nameof(ETransport.httpupgrade):
|
||||
case nameof(ETransport.splithttp):
|
||||
string p1 = query["path"] ?? "/";
|
||||
string h1 = query["host"] ?? "";
|
||||
item.requestHost = Utils.UrlDecode(h1);
|
||||
item.path = p1;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.http):
|
||||
case nameof(ETransport.h2):
|
||||
item.network = nameof(ETransport.h2);
|
||||
string p2 = query["path"] ?? "/";
|
||||
string h2 = query["host"] ?? "";
|
||||
item.requestHost = Utils.UrlDecode(h2);
|
||||
item.path = p2;
|
||||
break;
|
||||
|
||||
case nameof(ETransport.quic):
|
||||
string s = query["security"] ?? Global.None;
|
||||
string k = query["key"] ?? "";
|
||||
string t3 = query["type"] ?? Global.None;
|
||||
item.headerType = t3;
|
||||
item.requestHost = Utils.UrlDecode(s);
|
||||
item.path = k;
|
||||
break;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static ProfileItem? ResolveVmess4Kitsunebi(string result)
|
||||
{
|
||||
ProfileItem item = new()
|
||||
{
|
||||
configType = EConfigType.VMess
|
||||
};
|
||||
result = result[Global.ProtocolShares[EConfigType.VMess].Length..];
|
||||
int indexSplit = result.IndexOf("?");
|
||||
if (indexSplit > 0)
|
||||
{
|
||||
result = result[..indexSplit];
|
||||
}
|
||||
result = Utils.Base64Decode(result);
|
||||
|
||||
string[] arr1 = result.Split('@');
|
||||
if (arr1.Length != 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string[] arr21 = arr1[0].Split(':');
|
||||
string[] arr22 = arr1[1].Split(':');
|
||||
if (arr21.Length != 2 || arr22.Length != 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
item.address = arr22[0];
|
||||
item.port = Utils.ToInt(arr22[1]);
|
||||
item.security = arr21[0];
|
||||
item.id = arr21[1];
|
||||
|
||||
item.network = Global.DefaultNetwork;
|
||||
item.headerType = Global.None;
|
||||
item.remarks = "Alien";
|
||||
var query = Utils.ParseQueryString(url.Query);
|
||||
ResolveStdTransport(query, ref item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
|
||||
|
||||
using static v2rayN.Models.ClashProxies;
|
||||
using static v2rayN.Models.ClashProxies;
|
||||
|
||||
namespace v2rayN.Models
|
||||
{
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace v2rayN.ViewModels
|
|||
public void ProxiesDelayTest()
|
||||
{
|
||||
ProxiesDelayTest(true);
|
||||
}
|
||||
}
|
||||
|
||||
#region proxy function
|
||||
|
||||
|
@ -337,7 +337,7 @@ namespace v2rayN.ViewModels
|
|||
|
||||
private ProxiesItem? TryGetProxy(string name)
|
||||
{
|
||||
if(proxies is null)
|
||||
if (proxies is null)
|
||||
return null;
|
||||
proxies.TryGetValue(name, out ProxiesItem proxy2);
|
||||
if (proxy2 != null)
|
||||
|
@ -479,7 +479,7 @@ namespace v2rayN.ViewModels
|
|||
}
|
||||
Thread.Sleep(1000);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#endregion task
|
||||
|
|
|
@ -151,6 +151,7 @@ namespace v2rayN.ViewModels
|
|||
|
||||
//CheckUpdate
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
||||
|
@ -1519,11 +1520,11 @@ namespace v2rayN.ViewModels
|
|||
{
|
||||
BlReloadEnabled = true;
|
||||
ShowCalshUI = (_config.runningCoreType is ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo);
|
||||
if (ShowCalshUI) {
|
||||
if (ShowCalshUI)
|
||||
{
|
||||
Locator.Current.GetService<ClashProxiesViewModel>()?.ProxiesReload();
|
||||
}
|
||||
}));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
using v2rayN.ViewModels;
|
||||
using ReactiveUI;
|
||||
using System.Reactive.Disposables;
|
||||
using v2rayN.ViewModels;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
<reactiveui:ReactiveUserControl
|
||||
x:Class="v2rayN.Views.ClashProxiesView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:converters="clr-namespace:v2rayN.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:v2rayN.Views"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="clr-namespace:v2rayN.Converters"
|
||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
d:DesignHeight="450"
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
using v2rayN.ViewModels;
|
||||
using ReactiveUI;
|
||||
using Splat;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Windows.Input;
|
||||
using v2rayN.ViewModels;
|
||||
|
||||
namespace v2rayN.Views
|
||||
{
|
||||
|
|
|
@ -38,7 +38,6 @@ namespace v2rayN.Views
|
|||
{
|
||||
cmbdomainStrategy4Out.Items.Add(it);
|
||||
});
|
||||
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.RoutingRuleDetailsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
Title="{x:Static resx:ResUI.menuRoutingRuleDetailsSetting}"
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.RoutingRuleSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
Title="{x:Static resx:ResUI.menuRoutingRuleSetting}"
|
||||
|
|
Loading…
Reference in New Issue