Compare commits
108 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
559ffcbab5 | ||
|
|
80ed8346be | ||
|
|
a49455f330 | ||
|
|
c3de6f6d02 | ||
|
|
ee416b1bf2 | ||
|
|
784928ffc8 | ||
|
|
609360a1d0 | ||
|
|
18ce2f7b1c | ||
|
|
78625d82ae | ||
|
|
2ca34fb9ad | ||
|
|
f5f944aa50 | ||
|
|
83b4ab83d1 | ||
|
|
34f63f9006 | ||
|
|
b74188d904 | ||
|
|
51576b54c3 | ||
|
|
0d5a9fcf4a | ||
|
|
b0c5f74edb | ||
|
|
1ac7661593 | ||
|
|
caa2c523f4 | ||
|
|
7b9f1e6788 | ||
|
|
86f3ed29f9 | ||
|
|
655d411afe | ||
|
|
f5deb8e168 | ||
|
|
fcdb61bfbf | ||
|
|
bd9a4ca094 | ||
|
|
e2657e746d | ||
|
|
6f5a174231 | ||
|
|
91e9c0b02b | ||
|
|
658ea26ab7 | ||
|
|
77b736541e | ||
|
|
843b881da6 | ||
|
|
3ca8acc805 | ||
|
|
63809d4f16 | ||
|
|
557660b16b | ||
|
|
12be8bda52 | ||
|
|
81efd25e0a | ||
|
|
7037009ce4 | ||
|
|
4a0902d4c8 | ||
|
|
ed25ac1748 | ||
|
|
55e09ed062 | ||
|
|
babb548c22 | ||
|
|
1d0e8434ad | ||
|
|
e7b2deb941 | ||
|
|
2a37a6a28e | ||
|
|
735ebbe92a | ||
|
|
2031729656 | ||
|
|
f39fdc38cb | ||
|
|
6b62623615 | ||
|
|
f3f3dc1951 | ||
|
|
f4dd970f5e | ||
|
|
74332c58c5 | ||
|
|
f7ce49020f | ||
|
|
aaba1f7209 | ||
|
|
a9c7916b3d | ||
|
|
e3c8ccfafe | ||
|
|
2a22b65b2d | ||
|
|
ce5728e2df | ||
|
|
cba82e0e8e | ||
|
|
be30064f9a | ||
|
|
1798981380 | ||
|
|
06586d3405 | ||
|
|
31bcbd0e13 | ||
|
|
2652beed88 | ||
|
|
a2b87b862f | ||
|
|
85e8d9479e | ||
|
|
119508a4e3 | ||
|
|
3c2da0a225 | ||
|
|
ef79e6adf9 | ||
|
|
528400579a | ||
|
|
521ce1a487 | ||
|
|
014cc9bc16 | ||
|
|
34c6c953ac | ||
|
|
40fbbc7c58 | ||
|
|
534c329970 | ||
|
|
328d728257 | ||
|
|
fae6d42758 | ||
|
|
27693f6d23 | ||
|
|
89c4bab5b9 | ||
|
|
9d2ff04838 | ||
|
|
cf00243107 | ||
|
|
e8019ba7a5 | ||
|
|
4f30e3f0e3 | ||
|
|
047d08470f | ||
|
|
9643695389 | ||
|
|
5cabec86e7 | ||
|
|
f2d0e37255 | ||
|
|
9560851a3f | ||
|
|
4aeec1caa1 | ||
|
|
ae45b1ef44 | ||
|
|
aad1b087c9 | ||
|
|
b69c581fa1 | ||
|
|
9eb4d90cd6 | ||
|
|
958567c2c5 | ||
|
|
f1fc4583ed | ||
|
|
f7bfd5f766 | ||
|
|
aadc3c216a | ||
|
|
6fd2499daf | ||
|
|
f0405f1c5d | ||
|
|
1914cb3994 | ||
|
|
ab38fb572d | ||
|
|
46d7128a6e | ||
|
|
0821884ff3 | ||
|
|
62233281ef | ||
|
|
39504502af | ||
|
|
f97530a671 | ||
|
|
0fe7d5e598 | ||
|
|
527362dc9f | ||
|
|
1023426c8d |
61
.github/workflows/build.yml
vendored
Normal file
61
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ "master" ]
|
||||
pull_request:
|
||||
branches: [ "master" ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
configuration: [Release]
|
||||
|
||||
runs-on: windows-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# - name: 删除工作流运行
|
||||
# uses: Mattraks/delete-workflow-runs@v2
|
||||
# with:
|
||||
# token: ${{ github.token }}
|
||||
# repository: ${{ github.repository }}
|
||||
# retain_days: 0
|
||||
# keep_minimum_runs: 1
|
||||
|
||||
- name: Build
|
||||
run: cd v2rayN &&
|
||||
.\build.ps1
|
||||
|
||||
# - name: Package
|
||||
# shell: pwsh
|
||||
# run: |
|
||||
# 7z a -mx9 ..\v2rayN.7z $env:Wap_Project_Directory
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: v2rayN
|
||||
path:
|
||||
.\v2rayN\v2rayN.zip
|
||||
|
||||
|
||||
# - name: Release
|
||||
# uses: softprops/action-gh-release@v1
|
||||
# env:
|
||||
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}
|
||||
# with:
|
||||
# prerelease: ${{ contains(github.ref, '-') }}
|
||||
# draft: false
|
||||
# files: |
|
||||
# .\v2rayN\v2rayN.zip
|
||||
# body: |
|
||||
# [](https://t.me/netch_channel) [](https://t.me/netch_group)
|
||||
# ## Changelogs
|
||||
# * This is an automated deployment of GitHub Actions, the change log should be updated manually soon
|
||||
|
||||
# ## 更新日志
|
||||
# * 这是 GitHub Actions 自动化部署,更新日志应该很快会手动更新
|
||||
@@ -9,9 +9,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Protobuf" Version="3.23.3" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.54.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.54.0">
|
||||
<PackageReference Include="Google.Protobuf" Version="3.25.1" />
|
||||
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.60.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
39
v2rayN/build.ps1
Normal file
39
v2rayN/build.ps1
Normal file
@@ -0,0 +1,39 @@
|
||||
param (
|
||||
[Parameter()]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$OutputPath = '.\bin\v2rayN'
|
||||
)
|
||||
|
||||
Write-Host 'Building'
|
||||
|
||||
dotnet publish `
|
||||
.\v2rayN\v2rayN.csproj `
|
||||
-c Release `
|
||||
--self-contained false `
|
||||
-p:PublishReadyToRun=true `
|
||||
-p:PublishSingleFile=true `
|
||||
-o $OutputPath
|
||||
|
||||
dotnet publish `
|
||||
.\v2rayUpgrade\v2rayUpgrade.csproj `
|
||||
-c Release `
|
||||
--self-contained false `
|
||||
-p:PublishReadyToRun=true `
|
||||
-p:PublishSingleFile=true `
|
||||
-o $OutputPath
|
||||
|
||||
if ( -Not $? ) {
|
||||
exit $lastExitCode
|
||||
}
|
||||
|
||||
if ( Test-Path -Path .\bin\v2rayN ) {
|
||||
rm -Force "$OutputPath\*.pdb"
|
||||
rm -Force "$OutputPath\*.xml"
|
||||
}
|
||||
|
||||
Write-Host 'Build done'
|
||||
|
||||
ls $OutputPath
|
||||
7z a v2rayN.zip $OutputPath
|
||||
exit 0
|
||||
@@ -34,6 +34,12 @@
|
||||
Left="8"
|
||||
Right="8"
|
||||
Top="8" />
|
||||
<Thickness
|
||||
x:Key="OutlinedTextBoxDefaultPadding"
|
||||
Bottom="12"
|
||||
Left="16"
|
||||
Right="12"
|
||||
Top="12" />
|
||||
<Style
|
||||
x:Key="ModuleTitle"
|
||||
BasedOn="{StaticResource MaterialDesignTextBlock}"
|
||||
@@ -129,6 +135,7 @@
|
||||
BasedOn="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
TargetType="{x:Type TextBox}">
|
||||
<Setter Property="FontSize" Value="{DynamicResource StdFontSize}" />
|
||||
<Setter Property="Padding" Value="{StaticResource OutlinedTextBoxDefaultPadding}" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="MyGroupBox"
|
||||
@@ -142,6 +149,13 @@
|
||||
TargetType="{x:Type ListBoxItem}">
|
||||
<Setter Property="Margin" Value="-2,0" />
|
||||
</Style>
|
||||
<Style
|
||||
x:Key="MyOutlinedTextComboBox"
|
||||
BasedOn="{StaticResource MaterialDesignOutlinedComboBox}"
|
||||
TargetType="{x:Type ComboBox}">
|
||||
<Setter Property="FontSize" Value="{DynamicResource StdFontSize}" />
|
||||
<Setter Property="Padding" Value="{StaticResource OutlinedTextBoxDefaultPadding}" />
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -40,7 +40,7 @@ namespace v2rayN
|
||||
return;
|
||||
}
|
||||
|
||||
Global.processJob = new Job();
|
||||
Global.ProcessJob = new Job();
|
||||
|
||||
Logging.Setup();
|
||||
Init();
|
||||
|
||||
@@ -1,46 +1,50 @@
|
||||
namespace v2rayN
|
||||
using v2rayN.Mode;
|
||||
|
||||
namespace v2rayN
|
||||
{
|
||||
internal class Global
|
||||
{
|
||||
#region const
|
||||
|
||||
public const string githubUrl = "https://github.com";
|
||||
public const string githubApiUrl = "https://api.github.com/repos";
|
||||
public const string v2rayWebsiteUrl = @"https://www.v2fly.org/";
|
||||
public const string GithubUrl = "https://github.com";
|
||||
public const string GithubApiUrl = "https://api.github.com/repos";
|
||||
public const string V2rayWebsiteUrl = @"https://www.v2fly.org/";
|
||||
public const string AboutUrl = @"https://github.com/2dust/v2rayN";
|
||||
public const string UpdateUrl = AboutUrl + @"/releases";
|
||||
public const string v2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases";
|
||||
public const string xrayCoreUrl = "https://github.com/XTLS/Xray-core/releases";
|
||||
public const string V2flyCoreUrl = "https://github.com/v2fly/v2ray-core/releases";
|
||||
public const string XrayCoreUrl = "https://github.com/XTLS/Xray-core/releases";
|
||||
public const string SagerNetCoreUrl = "https://github.com/SagerNet/v2ray-core/releases";
|
||||
public const string NUrl = @"https://github.com/2dust/v2rayN/releases";
|
||||
public const string clashCoreUrl = "https://github.com/Dreamacro/clash/releases";
|
||||
public const string clashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases";
|
||||
public const string hysteriaCoreUrl = "https://github.com/apernet/hysteria/releases";
|
||||
public const string naiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases";
|
||||
public const string tuicCoreUrl = "https://github.com/EAimTY/tuic/releases";
|
||||
public const string singboxCoreUrl = "https://github.com/SagerNet/sing-box/releases";
|
||||
public const string geoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
|
||||
public const string singboxGeoUrl = "https://github.com/soffchen/sing-{0}/releases/latest/download/{0}.db";
|
||||
public const string ClashCoreUrl = "https://github.com/Dreamacro/clash/releases";
|
||||
public const string ClashMetaCoreUrl = "https://github.com/MetaCubeX/Clash.Meta/releases";
|
||||
public const string MihomoCoreUrl = "https://github.com/MetaCubeX/mihomo/releases";
|
||||
public const string HysteriaCoreUrl = "https://github.com/apernet/hysteria/releases";
|
||||
public const string NaiveproxyCoreUrl = "https://github.com/klzgrad/naiveproxy/releases";
|
||||
public const string TuicCoreUrl = "https://github.com/EAimTY/tuic/releases";
|
||||
public const string SingboxCoreUrl = "https://github.com/SagerNet/sing-box/releases";
|
||||
public const string GeoUrl = "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/{0}.dat";
|
||||
public const string SingboxGeoUrl = "https://github.com/soffchen/sing-{0}/releases/latest/download/{0}.db";
|
||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
||||
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
|
||||
|
||||
public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
|
||||
public const string ConfigFileName = "guiNConfig.json";
|
||||
public const string ConfigDB = "guiNDB.db";
|
||||
public const string coreConfigFileName = "config.json";
|
||||
public const string corePreConfigFileName = "configPre.json";
|
||||
|
||||
public const string v2raySampleClient = "v2rayN.Sample.SampleClientConfig";
|
||||
public const string CoreConfigFileName = "config.json";
|
||||
public const string CorePreConfigFileName = "configPre.json";
|
||||
public const string CoreSpeedtestConfigFileName = "configSpeedtest.json";
|
||||
public const string V2raySampleClient = "v2rayN.Sample.SampleClientConfig";
|
||||
public const string SingboxSampleClient = "v2rayN.Sample.SingboxSampleClientConfig";
|
||||
public const string v2raySampleHttprequestFileName = "v2rayN.Sample.SampleHttprequest";
|
||||
public const string v2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse";
|
||||
public const string v2raySampleInbound = "v2rayN.Sample.SampleInbound";
|
||||
public const string V2raySampleHttprequestFileName = "v2rayN.Sample.SampleHttprequest";
|
||||
public const string V2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse";
|
||||
public const string V2raySampleInbound = "v2rayN.Sample.SampleInbound";
|
||||
public const string V2raySampleOutbound = "v2rayN.Sample.SampleOutbound";
|
||||
public const string SingboxSampleOutbound = "v2rayN.Sample.SingboxSampleOutbound";
|
||||
public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_";
|
||||
|
||||
public const string TunSingboxDNSFileName = "v2rayN.Sample.tun_singbox_dns";
|
||||
public const string TunSingboxInboundFileName = "v2rayN.Sample.tun_singbox_inbound";
|
||||
public const string TunSingboxRulesFileName = "v2rayN.Sample.tun_singbox_rules";
|
||||
|
||||
public const string DNSV2rayNormalFileName = "v2rayN.Sample.dns_v2ray_normal";
|
||||
public const string DNSSingboxNormalFileName = "v2rayN.Sample.dns_singbox_normal";
|
||||
|
||||
@@ -48,9 +52,9 @@
|
||||
public const string DefaultNetwork = "tcp";
|
||||
public const string TcpHeaderHttp = "http";
|
||||
public const string None = "none";
|
||||
public const string agentTag = "proxy";
|
||||
public const string directTag = "direct";
|
||||
public const string blockTag = "block";
|
||||
public const string ProxyTag = "proxy";
|
||||
public const string DirectTag = "direct";
|
||||
public const string BlockTag = "block";
|
||||
public const string StreamSecurity = "tls";
|
||||
public const string StreamSecurityReality = "reality";
|
||||
public const string InboundSocks = "socks";
|
||||
@@ -60,21 +64,10 @@
|
||||
public const string Loopback = "127.0.0.1";
|
||||
public const string InboundAPITagName = "api";
|
||||
public const string InboundAPIProtocal = "dokodemo-door";
|
||||
public const string HttpProtocol = "http://";
|
||||
public const string HttpsProtocol = "https://";
|
||||
|
||||
public const string vmessProtocol = "vmess://";
|
||||
public const string vmessProtocolLite = "vmess";
|
||||
public const string ssProtocol = "ss://";
|
||||
public const string ssProtocolLite = "shadowsocks";
|
||||
public const string socksProtocol = "socks://";
|
||||
public const string socksProtocolLite = "socks";
|
||||
public const string httpProtocol = "http://";
|
||||
public const string httpsProtocol = "https://";
|
||||
public const string vlessProtocol = "vless://";
|
||||
public const string vlessProtocolLite = "vless";
|
||||
public const string trojanProtocol = "trojan://";
|
||||
public const string trojanProtocolLite = "trojan";
|
||||
|
||||
public const string userEMail = "t@t.tt";
|
||||
public const string UserEMail = "t@t.tt";
|
||||
public const string MyRegPath = "Software\\v2rayNGUI";
|
||||
public const string AutoRunRegPath = @"Software\Microsoft\Windows\CurrentVersion\Run";
|
||||
public const string AutoRunName = "v2rayNAutoRun";
|
||||
@@ -119,11 +112,14 @@
|
||||
};
|
||||
|
||||
public static readonly List<string> SpeedTestUrls = new() {
|
||||
@"https://speed.cloudflare.com/__down?bytes=100000000",
|
||||
@"https://speed.cloudflare.com/__down?bytes=10000000",
|
||||
@"http://cachefly.cachefly.net/50mb.test",
|
||||
@"http://cachefly.cachefly.net/100mb.test",
|
||||
@"http://cachefly.cachefly.net/10mb.test"
|
||||
};
|
||||
|
||||
public static readonly Dictionary<string, string> userAgentTxt = new()
|
||||
public static readonly Dictionary<string, string> UserAgentTxts = new()
|
||||
{
|
||||
{"chrome","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" },
|
||||
{"firefox","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" },
|
||||
@@ -132,39 +128,64 @@
|
||||
{"none",""}
|
||||
};
|
||||
|
||||
public static readonly List<string> vmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
||||
public static readonly List<string> ssSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
|
||||
public static readonly List<string> ssSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" };
|
||||
public static readonly List<string> ssSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
|
||||
public static readonly List<string> flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
|
||||
public static readonly List<string> networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
|
||||
public static readonly List<string> kcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
|
||||
public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5", "sing_box" };
|
||||
public static readonly List<string> coreTypes4VLESS = new() { "Xray", "sing_box" };
|
||||
public static readonly List<string> domainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
|
||||
public static readonly List<string> domainStrategys4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
|
||||
public static readonly List<string> domainMatchers = new() { "linear", "mph", "" };
|
||||
public static readonly List<string> fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
||||
public static readonly List<string> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
||||
public const string Hysteria2ProtocolShare = "hy2://";
|
||||
|
||||
public static readonly List<string> allowInsecures = new() { "true", "false", "" };
|
||||
public static readonly List<string> domainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||
public static readonly List<string> Languages = new() { "zh-Hans", "en", "fa-Ir", "ru" };
|
||||
public static readonly List<string> alpns = new() { "h2", "http/1.1", "h2,http/1.1", "" };
|
||||
public static readonly List<string> LogLevel = new() { "debug", "info", "warning", "error", "none" };
|
||||
public static readonly Dictionary<EConfigType, string> ProtocolShares = new()
|
||||
{
|
||||
{EConfigType.VMess,"vmess://"},
|
||||
{EConfigType.Shadowsocks,"ss://"},
|
||||
{EConfigType.Socks,"socks://"},
|
||||
{EConfigType.VLESS,"vless://"},
|
||||
{EConfigType.Trojan,"trojan://"},
|
||||
{EConfigType.Hysteria2,"hysteria2://"},
|
||||
{EConfigType.Tuic,"tuic://"}
|
||||
};
|
||||
|
||||
public static readonly Dictionary<EConfigType, string> ProtocolTypes = new()
|
||||
{
|
||||
{EConfigType.VMess,"vmess"},
|
||||
{EConfigType.Shadowsocks,"shadowsocks"},
|
||||
{EConfigType.Socks,"socks"},
|
||||
{EConfigType.VLESS,"vless"},
|
||||
{EConfigType.Trojan,"trojan"},
|
||||
{EConfigType.Hysteria2,"hysteria2"},
|
||||
{EConfigType.Tuic,"tuic"}
|
||||
};
|
||||
|
||||
public static readonly List<string> VmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
||||
public static readonly List<string> SsSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
|
||||
public static readonly List<string> SsSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" };
|
||||
public static readonly List<string> SsSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
|
||||
public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
|
||||
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
|
||||
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
|
||||
public static readonly List<string> CoreTypes = new() { "v2fly", "SagerNet", "Xray", "sing_box" };
|
||||
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };
|
||||
public static readonly List<string> DomainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
|
||||
public static readonly List<string> DomainStrategys4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
|
||||
public static readonly List<string> DomainMatchers = new() { "linear", "mph", "" };
|
||||
public static readonly List<string> Fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
||||
public static readonly List<string> UserAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
||||
|
||||
public static readonly List<string> AllowInsecures = new() { "true", "false", "" };
|
||||
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
|
||||
public static readonly List<string> Alpns = new() { "h2", "http/1.1", "h2,http/1.1", "h3", "" };
|
||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
||||
public static readonly List<string> Protocols = new() { "http", "tls", "bittorrent" };
|
||||
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
||||
public static readonly List<string> TunMtus = new() { "9000", "1500" };
|
||||
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||
public static readonly List<string> SingboxMuxs = new() { "h2mux", "smux", "yamux", "" };
|
||||
public static readonly List<string> TuicCongestionControls = new() { "cubic", "new_reno", "bbr" };
|
||||
|
||||
#endregion const
|
||||
|
||||
#region global variable
|
||||
|
||||
public static int statePort { get; set; }
|
||||
public static Job processJob { get; set; }
|
||||
public static int StatePort { get; set; }
|
||||
public static Job ProcessJob { get; set; }
|
||||
public static bool ShowInTaskbar { get; set; }
|
||||
public static string ExePathKey { get; set; }
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ namespace v2rayN.Handler
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <returns></returns>
|
||||
public static int LoadConfig(ref Config config)
|
||||
public static int LoadConfig(ref Config? config)
|
||||
{
|
||||
//载入配置文件
|
||||
string result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
||||
var result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
||||
if (!Utils.IsNullOrEmpty(result))
|
||||
{
|
||||
//转成Json
|
||||
@@ -96,7 +96,7 @@ namespace v2rayN.Handler
|
||||
//路由规则
|
||||
if (Utils.IsNullOrEmpty(config.routingBasicItem.domainStrategy))
|
||||
{
|
||||
config.routingBasicItem.domainStrategy = Global.domainStrategys[0];//"IPIfNonMatch";
|
||||
config.routingBasicItem.domainStrategy = Global.DomainStrategys[0];//"IPIfNonMatch";
|
||||
}
|
||||
//if (Utils.IsNullOrEmpty(config.domainMatcher))
|
||||
//{
|
||||
@@ -184,9 +184,9 @@ namespace v2rayN.Handler
|
||||
config.speedTestItem.speedPingTestUrl = Global.SpeedPingTestUrl;
|
||||
}
|
||||
|
||||
if (config.mux4Sbox == null)
|
||||
if (config.mux4SboxItem == null)
|
||||
{
|
||||
config.mux4Sbox = new()
|
||||
config.mux4SboxItem = new()
|
||||
{
|
||||
protocol = Global.SingboxMuxs[0],
|
||||
max_connections = 4,
|
||||
@@ -196,6 +196,15 @@ namespace v2rayN.Handler
|
||||
};
|
||||
}
|
||||
|
||||
if (config.hysteriaItem == null)
|
||||
{
|
||||
config.hysteriaItem = new()
|
||||
{
|
||||
up_mbps = 100,
|
||||
down_mbps = 100
|
||||
};
|
||||
}
|
||||
|
||||
LazyConfig.Instance.SetConfig(config);
|
||||
return 0;
|
||||
}
|
||||
@@ -205,7 +214,7 @@ namespace v2rayN.Handler
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <returns></returns>
|
||||
public static int SaveConfig(ref Config config, bool reload = true)
|
||||
public static int SaveConfig(Config config, bool reload = true)
|
||||
{
|
||||
ToJsonFile(config);
|
||||
|
||||
@@ -244,7 +253,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
public static int ImportOldGuiConfig(ref Config config, string fileName)
|
||||
public static int ImportOldGuiConfig(Config config, string fileName)
|
||||
{
|
||||
string result = Utils.LoadResource(fileName);
|
||||
if (Utils.IsNullOrEmpty(result))
|
||||
@@ -334,9 +343,9 @@ namespace v2rayN.Handler
|
||||
};
|
||||
}
|
||||
|
||||
GetDefaultServer(ref config);
|
||||
GetDefaultRouting(ref config);
|
||||
SaveConfig(ref config);
|
||||
GetDefaultServer(config);
|
||||
GetDefaultRouting(config);
|
||||
SaveConfig(config);
|
||||
LoadConfig(ref config);
|
||||
|
||||
return 0;
|
||||
@@ -347,12 +356,12 @@ namespace v2rayN.Handler
|
||||
#region Server
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddServer(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.VMess;
|
||||
|
||||
@@ -365,7 +374,7 @@ namespace v2rayN.Handler
|
||||
profileItem.path = profileItem.path.TrimEx();
|
||||
profileItem.streamSecurity = profileItem.streamSecurity.TrimEx();
|
||||
|
||||
if (!Global.vmessSecuritys.Contains(profileItem.security))
|
||||
if (!Global.VmessSecuritys.Contains(profileItem.security))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -374,7 +383,7 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(ref config, profileItem, toFile);
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -394,7 +403,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
|
||||
SqliteHelper.Instance.UpdateAll(indexs);
|
||||
RemoveServerViaSubid(ref config, subid, false);
|
||||
RemoveServerViaSubid(config, subid, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -405,7 +414,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static int CopyServer(ref Config config, List<ProfileItem> indexs)
|
||||
public static int CopyServer(Config config, List<ProfileItem> indexs)
|
||||
{
|
||||
foreach (var it in indexs)
|
||||
{
|
||||
@@ -422,13 +431,13 @@ namespace v2rayN.Handler
|
||||
if (profileItem.configType == EConfigType.Custom)
|
||||
{
|
||||
profileItem.address = Utils.GetConfigPath(profileItem.address);
|
||||
if (AddCustomServer(ref config, profileItem, false) == 0)
|
||||
if (AddCustomServer(config, profileItem, false) == 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddServerCommon(ref config, profileItem, true);
|
||||
AddServerCommon(config, profileItem, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,7 +450,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public static int SetDefaultServerIndex(ref Config config, string? indexId)
|
||||
public static int SetDefaultServerIndex(Config config, string? indexId)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(indexId))
|
||||
{
|
||||
@@ -467,18 +476,18 @@ namespace v2rayN.Handler
|
||||
}
|
||||
if (lstProfile.Count > 0)
|
||||
{
|
||||
return SetDefaultServerIndex(ref config, lstProfile.Where(t => t.port > 0).FirstOrDefault()?.indexId);
|
||||
return SetDefaultServerIndex(config, lstProfile.Where(t => t.port > 0).FirstOrDefault()?.indexId);
|
||||
}
|
||||
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.port > 0).Select(t => t.indexId).FirstOrDefault());
|
||||
return SetDefaultServerIndex(config, SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.port > 0).Select(t => t.indexId).FirstOrDefault());
|
||||
}
|
||||
|
||||
public static ProfileItem? GetDefaultServer(ref Config config)
|
||||
public static ProfileItem? GetDefaultServer(Config config)
|
||||
{
|
||||
var item = LazyConfig.Instance.GetProfileItem(config.indexId);
|
||||
if (item is null)
|
||||
{
|
||||
var item2 = SqliteHelper.Instance.Table<ProfileItem>().FirstOrDefault();
|
||||
SetDefaultServerIndex(ref config, item2?.indexId);
|
||||
SetDefaultServerIndex(config, item2?.indexId);
|
||||
return item2;
|
||||
}
|
||||
|
||||
@@ -493,7 +502,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="index"></param>
|
||||
/// <param name="eMove"></param>
|
||||
/// <returns></returns>
|
||||
public static int MoveServer(ref Config config, ref List<ProfileItem> lstProfile, int index, EMove eMove, int pos = -1)
|
||||
public static int MoveServer(Config config, ref List<ProfileItem> lstProfile, int index, EMove eMove, int pos = -1)
|
||||
{
|
||||
int count = lstProfile.Count;
|
||||
if (index < 0 || index > lstProfile.Count - 1)
|
||||
@@ -565,7 +574,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddCustomServer(ref Config config, ProfileItem profileItem, bool blDelete)
|
||||
public static int AddCustomServer(Config config, ProfileItem profileItem, bool blDelete)
|
||||
{
|
||||
var fileName = profileItem.address;
|
||||
if (!File.Exists(fileName))
|
||||
@@ -594,21 +603,21 @@ namespace v2rayN.Handler
|
||||
profileItem.configType = EConfigType.Custom;
|
||||
if (Utils.IsNullOrEmpty(profileItem.remarks))
|
||||
{
|
||||
profileItem.remarks = $"import custom@{DateTime.Now.ToShortDateString()}";
|
||||
profileItem.remarks = $"import custom@{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")}";
|
||||
}
|
||||
|
||||
AddServerCommon(ref config, profileItem, true);
|
||||
AddServerCommon(config, profileItem, true);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int EditCustomServer(ref Config config, ProfileItem profileItem)
|
||||
public static int EditCustomServer(Config config, ProfileItem profileItem)
|
||||
{
|
||||
if (SqliteHelper.Instance.Update(profileItem) > 0)
|
||||
{
|
||||
@@ -623,12 +632,12 @@ namespace v2rayN.Handler
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddShadowsocksServer(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddShadowsocksServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.Shadowsocks;
|
||||
|
||||
@@ -645,35 +654,35 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(ref config, profileItem, toFile);
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddSocksServer(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddSocksServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.Socks;
|
||||
|
||||
profileItem.address = profileItem.address.TrimEx();
|
||||
|
||||
AddServerCommon(ref config, profileItem, toFile);
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddTrojanServer(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddTrojanServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.Trojan;
|
||||
|
||||
@@ -688,12 +697,80 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(ref config, profileItem, toFile);
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SortServers(ref Config config, string subId, string colName, bool asc)
|
||||
/// <summary>
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddHysteria2Server(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.Hysteria2;
|
||||
profileItem.coreType = ECoreType.sing_box;
|
||||
|
||||
profileItem.address = profileItem.address.TrimEx();
|
||||
profileItem.id = profileItem.id.TrimEx();
|
||||
profileItem.network = string.Empty;
|
||||
|
||||
if (Utils.IsNullOrEmpty(profileItem.streamSecurity))
|
||||
{
|
||||
profileItem.streamSecurity = Global.StreamSecurity;
|
||||
}
|
||||
if (profileItem.id.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddTuicServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.Tuic;
|
||||
profileItem.coreType = ECoreType.sing_box;
|
||||
|
||||
profileItem.address = profileItem.address.TrimEx();
|
||||
profileItem.id = profileItem.id.TrimEx();
|
||||
profileItem.security = profileItem.security.TrimEx();
|
||||
profileItem.network = string.Empty;
|
||||
|
||||
if (!Global.TuicCongestionControls.Contains(profileItem.headerType))
|
||||
{
|
||||
profileItem.headerType = Global.TuicCongestionControls.FirstOrDefault()!;
|
||||
}
|
||||
|
||||
if (Utils.IsNullOrEmpty(profileItem.streamSecurity))
|
||||
{
|
||||
profileItem.streamSecurity = Global.StreamSecurity;
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(profileItem.alpn))
|
||||
{
|
||||
profileItem.alpn = "h3";
|
||||
}
|
||||
if (profileItem.id.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SortServers(Config config, string subId, string colName, bool asc)
|
||||
{
|
||||
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
|
||||
if (lstModel.Count <= 0)
|
||||
@@ -790,12 +867,12 @@ namespace v2rayN.Handler
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加服务器或编辑
|
||||
/// Add or edit server
|
||||
/// </summary>
|
||||
/// <param name="config"></param>
|
||||
/// <param name="profileItem"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddVlessServer(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddVlessServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configType = EConfigType.VLESS;
|
||||
|
||||
@@ -808,16 +885,16 @@ namespace v2rayN.Handler
|
||||
profileItem.path = profileItem.path.TrimEx();
|
||||
profileItem.streamSecurity = profileItem.streamSecurity.TrimEx();
|
||||
|
||||
if (!Global.flows.Contains(profileItem.flow))
|
||||
if (!Global.Flows.Contains(profileItem.flow))
|
||||
{
|
||||
profileItem.flow = Global.flows.First();
|
||||
profileItem.flow = Global.Flows.First();
|
||||
}
|
||||
if (profileItem.id.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
AddServerCommon(ref config, profileItem, toFile);
|
||||
AddServerCommon(config, profileItem, toFile);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -846,7 +923,7 @@ namespace v2rayN.Handler
|
||||
return new Tuple<int, int>(lstProfile.Count, lstKeep.Count);
|
||||
}
|
||||
|
||||
public static int AddServerCommon(ref Config config, ProfileItem profileItem, bool toFile = true)
|
||||
public static int AddServerCommon(Config config, ProfileItem profileItem, bool toFile = true)
|
||||
{
|
||||
profileItem.configVersion = 2;
|
||||
|
||||
@@ -856,13 +933,13 @@ namespace v2rayN.Handler
|
||||
{
|
||||
profileItem.allowInsecure = config.coreBasicItem.defAllowInsecure.ToString().ToLower();
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(profileItem.fingerprint))
|
||||
if (Utils.IsNullOrEmpty(profileItem.fingerprint) && profileItem.streamSecurity == Global.StreamSecurityReality)
|
||||
{
|
||||
profileItem.fingerprint = config.coreBasicItem.defFingerprint;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Utils.IsNullOrEmpty(profileItem.network) && !Global.networks.Contains(profileItem.network))
|
||||
if (!Utils.IsNullOrEmpty(profileItem.network) && !Global.Networks.Contains(profileItem.network))
|
||||
{
|
||||
profileItem.network = Global.DefaultNetwork;
|
||||
}
|
||||
@@ -947,7 +1024,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="clipboardData"></param>
|
||||
/// <param name="subid"></param>
|
||||
/// <returns>成功导入的数量</returns>
|
||||
private static int AddBatchServers(ref Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
private static int AddBatchServers(Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(clipboardData))
|
||||
{
|
||||
@@ -958,7 +1035,7 @@ namespace v2rayN.Handler
|
||||
//remove sub items
|
||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
||||
{
|
||||
RemoveServerViaSubid(ref config, subid, isSub);
|
||||
RemoveServerViaSubid(config, subid, isSub);
|
||||
subFilter = LazyConfig.Instance.GetSubItem(subid)?.filter ?? "";
|
||||
}
|
||||
|
||||
@@ -974,9 +1051,9 @@ namespace v2rayN.Handler
|
||||
foreach (string str in arrData)
|
||||
{
|
||||
//maybe sub
|
||||
if (!isSub && (str.StartsWith(Global.httpsProtocol) || str.StartsWith(Global.httpProtocol)))
|
||||
if (!isSub && (str.StartsWith(Global.HttpsProtocol) || str.StartsWith(Global.HttpProtocol)))
|
||||
{
|
||||
if (AddSubItem(ref config, str) == 0)
|
||||
if (AddSubItem(config, str) == 0)
|
||||
{
|
||||
countServers++;
|
||||
}
|
||||
@@ -1024,23 +1101,31 @@ namespace v2rayN.Handler
|
||||
|
||||
if (profileItem.configType == EConfigType.VMess)
|
||||
{
|
||||
addStatus = AddServer(ref config, profileItem, false);
|
||||
addStatus = AddServer(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.Shadowsocks)
|
||||
{
|
||||
addStatus = AddShadowsocksServer(ref config, profileItem, false);
|
||||
addStatus = AddShadowsocksServer(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.Socks)
|
||||
{
|
||||
addStatus = AddSocksServer(ref config, profileItem, false);
|
||||
addStatus = AddSocksServer(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.Trojan)
|
||||
{
|
||||
addStatus = AddTrojanServer(ref config, profileItem, false);
|
||||
addStatus = AddTrojanServer(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.VLESS)
|
||||
{
|
||||
addStatus = AddVlessServer(ref config, profileItem, false);
|
||||
addStatus = AddVlessServer(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.Hysteria2)
|
||||
{
|
||||
addStatus = AddHysteria2Server(config, profileItem, false);
|
||||
}
|
||||
else if (profileItem.configType == EConfigType.Tuic)
|
||||
{
|
||||
addStatus = AddTuicServer(config, profileItem, false);
|
||||
}
|
||||
|
||||
if (addStatus == 0)
|
||||
@@ -1059,7 +1144,7 @@ namespace v2rayN.Handler
|
||||
return countServers;
|
||||
}
|
||||
|
||||
private static int AddBatchServers4Custom(ref Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
private static int AddBatchServers4Custom(Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(clipboardData))
|
||||
{
|
||||
@@ -1095,7 +1180,7 @@ namespace v2rayN.Handler
|
||||
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.yaml");
|
||||
File.WriteAllText(fileName, clipboardData);
|
||||
|
||||
profileItem.coreType = ECoreType.clash;
|
||||
profileItem.coreType = ECoreType.mihomo;
|
||||
profileItem.address = fileName;
|
||||
profileItem.remarks = "clash_custom";
|
||||
}
|
||||
@@ -1132,7 +1217,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
||||
{
|
||||
RemoveServerViaSubid(ref config, subid, isSub);
|
||||
RemoveServerViaSubid(config, subid, isSub);
|
||||
}
|
||||
if (isSub && lstOriSub?.Count == 1)
|
||||
{
|
||||
@@ -1146,7 +1231,7 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (AddCustomServer(ref config, profileItem, true) == 0)
|
||||
if (AddCustomServer(config, profileItem, true) == 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@@ -1156,7 +1241,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private static int AddBatchServers4SsSIP008(ref Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
private static int AddBatchServers4SsSIP008(Config config, string clipboardData, string subid, bool isSub, List<ProfileItem> lstOriSub)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(clipboardData))
|
||||
{
|
||||
@@ -1165,7 +1250,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
||||
{
|
||||
RemoveServerViaSubid(ref config, subid, isSub);
|
||||
RemoveServerViaSubid(config, subid, isSub);
|
||||
}
|
||||
|
||||
//SsSIP008
|
||||
@@ -1195,7 +1280,7 @@ namespace v2rayN.Handler
|
||||
};
|
||||
ssItem.subid = subid;
|
||||
ssItem.isSub = isSub;
|
||||
if (AddShadowsocksServer(ref config, ssItem) == 0)
|
||||
if (AddShadowsocksServer(config, ssItem) == 0)
|
||||
{
|
||||
counter++;
|
||||
}
|
||||
@@ -1207,7 +1292,7 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static int AddBatchServers(ref Config config, string clipboardData, string subid, bool isSub)
|
||||
public static int AddBatchServers(Config config, string clipboardData, string subid, bool isSub)
|
||||
{
|
||||
List<ProfileItem>? lstOriSub = null;
|
||||
if (isSub && !Utils.IsNullOrEmpty(subid))
|
||||
@@ -1218,26 +1303,26 @@ namespace v2rayN.Handler
|
||||
var counter = 0;
|
||||
if (Utils.IsBase64String(clipboardData))
|
||||
{
|
||||
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
|
||||
counter = AddBatchServers(config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
|
||||
}
|
||||
if (counter < 1)
|
||||
{
|
||||
counter = AddBatchServers(ref config, clipboardData, subid, isSub, lstOriSub);
|
||||
counter = AddBatchServers(config, clipboardData, subid, isSub, lstOriSub);
|
||||
}
|
||||
if (counter < 1)
|
||||
{
|
||||
counter = AddBatchServers(ref config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
|
||||
counter = AddBatchServers(config, Utils.Base64Decode(clipboardData), subid, isSub, lstOriSub);
|
||||
}
|
||||
|
||||
if (counter < 1)
|
||||
{
|
||||
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, isSub, lstOriSub);
|
||||
counter = AddBatchServers4SsSIP008(config, clipboardData, subid, isSub, lstOriSub);
|
||||
}
|
||||
|
||||
//maybe other sub
|
||||
if (counter < 1)
|
||||
{
|
||||
counter = AddBatchServers4Custom(ref config, clipboardData, subid, isSub, lstOriSub);
|
||||
counter = AddBatchServers4Custom(config, clipboardData, subid, isSub, lstOriSub);
|
||||
}
|
||||
|
||||
return counter;
|
||||
@@ -1253,7 +1338,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="url"></param>
|
||||
/// <returns></returns>
|
||||
public static int AddSubItem(ref Config config, string url)
|
||||
public static int AddSubItem(Config config, string url)
|
||||
{
|
||||
//already exists
|
||||
if (SqliteHelper.Instance.Table<SubItem>().Where(e => e.url == url).Count() > 0)
|
||||
@@ -1268,10 +1353,10 @@ namespace v2rayN.Handler
|
||||
url = url
|
||||
};
|
||||
|
||||
return AddSubItem(ref config, subItem);
|
||||
return AddSubItem(config, subItem);
|
||||
}
|
||||
|
||||
public static int AddSubItem(ref Config config, SubItem subItem)
|
||||
public static int AddSubItem(Config config, SubItem subItem)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(subItem.id))
|
||||
{
|
||||
@@ -1303,7 +1388,7 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="subid"></param>
|
||||
/// <returns></returns>
|
||||
public static int RemoveServerViaSubid(ref Config config, string subid, bool isSub)
|
||||
public static int RemoveServerViaSubid(Config config, string subid, bool isSub)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(subid))
|
||||
{
|
||||
@@ -1326,7 +1411,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int DeleteSubItem(ref Config config, string id)
|
||||
public static int DeleteSubItem(Config config, string id)
|
||||
{
|
||||
var item = LazyConfig.Instance.GetSubItem(id);
|
||||
if (item is null)
|
||||
@@ -1334,7 +1419,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
SqliteHelper.Instance.Delete(item);
|
||||
RemoveServerViaSubid(ref config, id, false);
|
||||
RemoveServerViaSubid(config, id, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1354,7 +1439,7 @@ namespace v2rayN.Handler
|
||||
|
||||
#region Routing
|
||||
|
||||
public static int SaveRoutingItem(ref Config config, RoutingItem item)
|
||||
public static int SaveRoutingItem(Config config, RoutingItem item)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(item.id))
|
||||
{
|
||||
@@ -1489,7 +1574,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int SetDefaultRouting(ref Config config, RoutingItem routingItem)
|
||||
public static int SetDefaultRouting(Config config, RoutingItem routingItem)
|
||||
{
|
||||
if (SqliteHelper.Instance.Table<RoutingItem>().Where(t => t.id == routingItem.id).Count() > 0)
|
||||
{
|
||||
@@ -1501,20 +1586,20 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static RoutingItem GetDefaultRouting(ref Config config)
|
||||
public static RoutingItem GetDefaultRouting(Config config)
|
||||
{
|
||||
var item = LazyConfig.Instance.GetRoutingItem(config.routingBasicItem.routingIndexId);
|
||||
if (item is null)
|
||||
{
|
||||
var item2 = SqliteHelper.Instance.Table<RoutingItem>().FirstOrDefault(t => t.locked == false);
|
||||
SetDefaultRouting(ref config, item2);
|
||||
SetDefaultRouting(config, item2);
|
||||
return item2;
|
||||
}
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public static int InitBuiltinRouting(ref Config config, bool blImportAdvancedRules = false)
|
||||
public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
|
||||
{
|
||||
var items = LazyConfig.Instance.RoutingItems();
|
||||
if (blImportAdvancedRules || items.Count <= 0)
|
||||
@@ -1549,11 +1634,11 @@ namespace v2rayN.Handler
|
||||
|
||||
if (!blImportAdvancedRules)
|
||||
{
|
||||
SetDefaultRouting(ref config, item2);
|
||||
SetDefaultRouting(config, item2);
|
||||
}
|
||||
}
|
||||
|
||||
if (GetLockedRoutingItem(ref config) == null)
|
||||
if (GetLockedRoutingItem(config) == null)
|
||||
{
|
||||
var item1 = new RoutingItem()
|
||||
{
|
||||
@@ -1566,7 +1651,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static RoutingItem GetLockedRoutingItem(ref Config config)
|
||||
public static RoutingItem GetLockedRoutingItem(Config config)
|
||||
{
|
||||
return SqliteHelper.Instance.Table<RoutingItem>().FirstOrDefault(it => it.locked == true);
|
||||
}
|
||||
|
||||
@@ -80,6 +80,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
File.SetAttributes(fileName, FileAttributes.Normal); //If the file has a read-only attribute, direct deletion will fail
|
||||
File.Delete(fileName);
|
||||
}
|
||||
|
||||
@@ -94,6 +95,7 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
File.Copy(addressFileName, fileName);
|
||||
File.SetAttributes(fileName, FileAttributes.Normal); //Copy will keep the attributes of addressFileName, so we need to add write permissions to fileName just in case of addressFileName is a read-only file.
|
||||
|
||||
//check again
|
||||
if (!File.Exists(fileName))
|
||||
@@ -117,6 +119,7 @@ namespace v2rayN.Handler
|
||||
|
||||
case ECoreType.clash:
|
||||
case ECoreType.clash_meta:
|
||||
case ECoreType.mihomo:
|
||||
//remove the original
|
||||
var indexPort = fileContent.FindIndex(t => t.Contains("port:"));
|
||||
if (indexPort >= 0)
|
||||
@@ -147,10 +150,26 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static string GenerateClientSpeedtestConfigString(Config config, List<ServerTestItem> selecteds, out string msg)
|
||||
public static int GenerateClientSpeedtestConfig(Config config, string fileName, List<ServerTestItem> selecteds, ECoreType coreType, out string msg)
|
||||
{
|
||||
var coreConfigV2ray = new CoreConfigV2ray(config);
|
||||
return coreConfigV2ray.GenerateClientSpeedtestConfigString(selecteds, out msg);
|
||||
if (coreType == ECoreType.sing_box)
|
||||
{
|
||||
if ((new CoreConfigSingbox(config)).GenerateClientSpeedtestConfig(selecteds, out SingboxConfig? singboxConfig, out msg) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Utils.ToJsonFile(singboxConfig, fileName, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((new CoreConfigV2ray(config)).GenerateClientSpeedtestConfig(selecteds, out V2rayConfig? v2rayConfig, out msg) != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
Utils.ToJsonFile(v2rayConfig, fileName, false);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using v2rayN.Base;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using v2rayN.Base;
|
||||
using v2rayN.Mode;
|
||||
using v2rayN.Resx;
|
||||
|
||||
@@ -6,7 +8,6 @@ namespace v2rayN.Handler
|
||||
{
|
||||
internal class CoreConfigSingbox
|
||||
{
|
||||
private string SampleClient = Global.SingboxSampleClient;
|
||||
private Config _config;
|
||||
|
||||
public CoreConfigSingbox(Config config)
|
||||
@@ -28,7 +29,7 @@ namespace v2rayN.Handler
|
||||
|
||||
msg = ResUI.InitialConfiguration;
|
||||
|
||||
string result = Utils.GetEmbedText(SampleClient);
|
||||
string result = Utils.GetEmbedText(Global.SingboxSampleClient);
|
||||
if (Utils.IsNullOrEmpty(result))
|
||||
{
|
||||
msg = ResUI.FailedGetDefaultConfiguration;
|
||||
@@ -42,17 +43,19 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
log(singboxConfig);
|
||||
GenLog(singboxConfig);
|
||||
|
||||
inbound(singboxConfig);
|
||||
GenInbounds(singboxConfig);
|
||||
|
||||
outbound(node, singboxConfig);
|
||||
GenOutbound(node, singboxConfig.outbounds[0]);
|
||||
|
||||
routing(singboxConfig);
|
||||
GenMoreOutbounds(node, singboxConfig);
|
||||
|
||||
dns(node, singboxConfig);
|
||||
GenRouting(singboxConfig);
|
||||
|
||||
statistic(singboxConfig);
|
||||
GenDns(node, singboxConfig);
|
||||
|
||||
GenStatistic(singboxConfig);
|
||||
|
||||
msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
}
|
||||
@@ -65,7 +68,9 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int log(SingboxConfig singboxConfig)
|
||||
#region private gen function
|
||||
|
||||
private int GenLog(SingboxConfig singboxConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -101,9 +106,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
#region inbound private
|
||||
|
||||
private int inbound(SingboxConfig singboxConfig)
|
||||
private int GenInbounds(SingboxConfig singboxConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -126,7 +129,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
{
|
||||
var routing = ConfigHandler.GetDefaultRouting(ref _config);
|
||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||
if (!Utils.IsNullOrEmpty(routing.domainStrategy4Singbox))
|
||||
{
|
||||
inbound.domain_strategy = routing.domainStrategy4Singbox;
|
||||
@@ -179,6 +182,10 @@ namespace v2rayN.Handler
|
||||
tunInbound.mtu = _config.tunModeItem.mtu;
|
||||
tunInbound.strict_route = _config.tunModeItem.strictRoute;
|
||||
tunInbound.stack = _config.tunModeItem.stack;
|
||||
if (_config.tunModeItem.enableIPv6Address == false)
|
||||
{
|
||||
tunInbound.inet6_address = null;
|
||||
}
|
||||
|
||||
singboxConfig.inbounds.Add(tunInbound);
|
||||
}
|
||||
@@ -199,34 +206,20 @@ namespace v2rayN.Handler
|
||||
return inbound;
|
||||
}
|
||||
|
||||
#endregion inbound private
|
||||
|
||||
#region outbound private
|
||||
|
||||
private int outbound(ProfileItem node, SingboxConfig singboxConfig)
|
||||
private int GenOutbound(ProfileItem node, Outbound4Sbox outbound)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_config.tunModeItem.enableTun)
|
||||
{
|
||||
singboxConfig.outbounds.Add(new()
|
||||
{
|
||||
type = "dns",
|
||||
tag = "dns_out"
|
||||
});
|
||||
}
|
||||
|
||||
var outbound = singboxConfig.outbounds[0];
|
||||
outbound.server = node.address;
|
||||
outbound.server_port = node.port;
|
||||
|
||||
if (node.configType == EConfigType.VMess)
|
||||
{
|
||||
outbound.type = Global.vmessProtocolLite;
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.VMess];
|
||||
|
||||
outbound.uuid = node.id;
|
||||
outbound.alter_id = node.alterId;
|
||||
if (Global.vmessSecuritys.Contains(node.security))
|
||||
if (Global.VmessSecuritys.Contains(node.security))
|
||||
{
|
||||
outbound.security = node.security;
|
||||
}
|
||||
@@ -235,20 +228,20 @@ namespace v2rayN.Handler
|
||||
outbound.security = Global.DefaultSecurity;
|
||||
}
|
||||
|
||||
outboundMux(node, outbound);
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
else if (node.configType == EConfigType.Shadowsocks)
|
||||
{
|
||||
outbound.type = Global.ssProtocolLite;
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.Shadowsocks];
|
||||
|
||||
outbound.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none";
|
||||
outbound.password = node.id;
|
||||
|
||||
outboundMux(node, outbound);
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
else if (node.configType == EConfigType.Socks)
|
||||
{
|
||||
outbound.type = Global.socksProtocolLite;
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.Socks];
|
||||
|
||||
outbound.version = "5";
|
||||
if (!Utils.IsNullOrEmpty(node.security)
|
||||
@@ -260,7 +253,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
else if (node.configType == EConfigType.VLESS)
|
||||
{
|
||||
outbound.type = Global.vlessProtocolLite;
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.VLESS];
|
||||
|
||||
outbound.uuid = node.id;
|
||||
|
||||
@@ -268,7 +261,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (Utils.IsNullOrEmpty(node.flow))
|
||||
{
|
||||
outboundMux(node, outbound);
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -277,16 +270,37 @@ namespace v2rayN.Handler
|
||||
}
|
||||
else if (node.configType == EConfigType.Trojan)
|
||||
{
|
||||
outbound.type = Global.trojanProtocolLite;
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.Trojan];
|
||||
|
||||
outbound.password = node.id;
|
||||
|
||||
outboundMux(node, outbound);
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
else if (node.configType == EConfigType.Hysteria2)
|
||||
{
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.Hysteria2];
|
||||
|
||||
outbound.password = node.id;
|
||||
|
||||
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
||||
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
||||
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
else if (node.configType == EConfigType.Tuic)
|
||||
{
|
||||
outbound.type = Global.ProtocolTypes[EConfigType.Tuic];
|
||||
|
||||
outbound.uuid = node.id;
|
||||
outbound.password = node.security;
|
||||
outbound.congestion_control = node.headerType;
|
||||
|
||||
GenOutboundMux(node, outbound);
|
||||
}
|
||||
|
||||
outboundTls(node, outbound);
|
||||
GenOutboundTls(node, outbound);
|
||||
|
||||
outboundTransport(node, outbound);
|
||||
GenOutboundTransport(node, outbound);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -295,7 +309,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int outboundMux(ProfileItem node, Outbound4Sbox outbound)
|
||||
private int GenOutboundMux(ProfileItem node, Outbound4Sbox outbound)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -320,7 +334,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int outboundTls(ProfileItem node, Outbound4Sbox outbound)
|
||||
private int GenOutboundTls(ProfileItem node, Outbound4Sbox outbound)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -370,7 +384,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int outboundTransport(ProfileItem node, Outbound4Sbox outbound)
|
||||
private int GenOutboundTransport(ProfileItem node, Outbound4Sbox outbound)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -422,11 +436,60 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion outbound private
|
||||
private int GenMoreOutbounds(ProfileItem node, SingboxConfig singboxConfig)
|
||||
{
|
||||
if (node.subid.IsNullOrEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{
|
||||
var subItem = LazyConfig.Instance.GetSubItem(node.subid);
|
||||
if (subItem is null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#region routing rule private
|
||||
//current proxy
|
||||
var outbound = singboxConfig.outbounds[0];
|
||||
var txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound);
|
||||
|
||||
private int routing(SingboxConfig singboxConfig)
|
||||
//Previous proxy
|
||||
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
|
||||
if (prevNode is not null
|
||||
&& prevNode.configType != EConfigType.Custom)
|
||||
{
|
||||
var prevOutbound = Utils.FromJson<Outbound4Sbox>(txtOutbound);
|
||||
GenOutbound(prevNode, prevOutbound);
|
||||
prevOutbound.tag = $"{Global.ProxyTag}2";
|
||||
singboxConfig.outbounds.Add(prevOutbound);
|
||||
|
||||
outbound.detour = prevOutbound.tag;
|
||||
}
|
||||
|
||||
//Next proxy
|
||||
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
|
||||
if (nextNode is not null
|
||||
&& nextNode.configType != EConfigType.Custom)
|
||||
{
|
||||
var nextOutbound = Utils.FromJson<Outbound4Sbox>(txtOutbound);
|
||||
GenOutbound(nextNode, nextOutbound);
|
||||
nextOutbound.tag = Global.ProxyTag;
|
||||
singboxConfig.outbounds.Insert(0, nextOutbound);
|
||||
|
||||
outbound.tag = $"{Global.ProxyTag}1";
|
||||
nextOutbound.detour = outbound.tag;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GenRouting(SingboxConfig singboxConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -437,7 +500,7 @@ namespace v2rayN.Handler
|
||||
var tunRules = Utils.FromJson<List<Rule4Sbox>>(Utils.GetEmbedText(Global.TunSingboxRulesFileName));
|
||||
singboxConfig.route.rules.AddRange(tunRules);
|
||||
|
||||
routingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe);
|
||||
GenRoutingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe);
|
||||
singboxConfig.route.rules.Add(new()
|
||||
{
|
||||
port = new() { 53 },
|
||||
@@ -454,7 +517,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
{
|
||||
var routing = ConfigHandler.GetDefaultRouting(ref _config);
|
||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||
if (routing != null)
|
||||
{
|
||||
var rules = Utils.FromJson<List<RulesItem>>(routing.ruleSet);
|
||||
@@ -462,20 +525,20 @@ namespace v2rayN.Handler
|
||||
{
|
||||
if (item.enabled)
|
||||
{
|
||||
routingUserRule(item, singboxConfig.route.rules);
|
||||
GenRoutingUserRule(item, singboxConfig.route.rules);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
|
||||
var lockedItem = ConfigHandler.GetLockedRoutingItem(_config);
|
||||
if (lockedItem != null)
|
||||
{
|
||||
var rules = Utils.FromJson<List<RulesItem>>(lockedItem.ruleSet);
|
||||
foreach (var item in rules!)
|
||||
{
|
||||
routingUserRule(item, singboxConfig.route.rules);
|
||||
GenRoutingUserRule(item, singboxConfig.route.rules);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -487,7 +550,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void routingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe)
|
||||
private void GenRoutingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe)
|
||||
{
|
||||
lstDnsExe = new();
|
||||
lstDirectExe = new();
|
||||
@@ -513,7 +576,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private int routingUserRule(RulesItem item, List<Rule4Sbox> rules)
|
||||
private int GenRoutingUserRule(RulesItem item, List<Rule4Sbox> rules)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -554,7 +617,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
foreach (var it in item.domain)
|
||||
{
|
||||
parseV2Domain(it, rule);
|
||||
ParseV2Domain(it, rule);
|
||||
}
|
||||
rules.Add(rule);
|
||||
hasDomainIp = true;
|
||||
@@ -564,7 +627,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
foreach (var it in item.ip)
|
||||
{
|
||||
parseV2Address(it, rule2);
|
||||
ParseV2Address(it, rule2);
|
||||
}
|
||||
rules.Add(rule2);
|
||||
hasDomainIp = true;
|
||||
@@ -589,7 +652,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void parseV2Domain(string domain, Rule4Sbox rule)
|
||||
private void ParseV2Domain(string domain, Rule4Sbox rule)
|
||||
{
|
||||
if (domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
|
||||
{
|
||||
@@ -629,7 +692,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private void parseV2Address(string address, Rule4Sbox rule)
|
||||
private void ParseV2Address(string address, Rule4Sbox rule)
|
||||
{
|
||||
if (address.StartsWith("ext:") || address.StartsWith("ext-ip:"))
|
||||
{
|
||||
@@ -651,11 +714,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
#endregion routing rule private
|
||||
|
||||
#region dns private
|
||||
|
||||
private int dns(ProfileItem node, SingboxConfig singboxConfig)
|
||||
private int GenDns(ProfileItem node, SingboxConfig singboxConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -711,30 +770,181 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion dns private
|
||||
|
||||
private int statistic(SingboxConfig singboxConfig)
|
||||
private int GenStatistic(SingboxConfig singboxConfig)
|
||||
{
|
||||
if (_config.guiItem.enableStatistics)
|
||||
{
|
||||
singboxConfig.experimental = new Experimental4Sbox()
|
||||
{
|
||||
//cache_file = new CacheFile4Sbox()
|
||||
//{
|
||||
// enabled = true
|
||||
//},
|
||||
//v2ray_api = new V2ray_Api4Sbox()
|
||||
//{
|
||||
// listen = $"{Global.Loopback}:{Global.statePort}",
|
||||
// listen = $"{Global.Loopback}:{Global.StatePort}",
|
||||
// stats = new Stats4Sbox()
|
||||
// {
|
||||
// enabled = true,
|
||||
// }
|
||||
//}
|
||||
//},
|
||||
clash_api = new Clash_Api4Sbox()
|
||||
{
|
||||
external_controller = $"{Global.Loopback}:{Global.statePort}",
|
||||
store_selected = true
|
||||
external_controller = $"{Global.Loopback}:{Global.StatePort}",
|
||||
}
|
||||
};
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion private gen function
|
||||
|
||||
#region Gen speedtest config
|
||||
|
||||
public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out SingboxConfig? singboxConfig, out string msg)
|
||||
{
|
||||
singboxConfig = null;
|
||||
try
|
||||
{
|
||||
if (_config == null)
|
||||
{
|
||||
msg = ResUI.CheckServerSettings;
|
||||
return -1;
|
||||
}
|
||||
|
||||
msg = ResUI.InitialConfiguration;
|
||||
|
||||
string result = Utils.GetEmbedText(Global.SingboxSampleClient);
|
||||
string txtOutbound = Utils.GetEmbedText(Global.SingboxSampleOutbound);
|
||||
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
|
||||
{
|
||||
msg = ResUI.FailedGetDefaultConfiguration;
|
||||
return -1;
|
||||
}
|
||||
|
||||
singboxConfig = Utils.FromJson<SingboxConfig>(result);
|
||||
if (singboxConfig == null)
|
||||
{
|
||||
msg = ResUI.FailedGenDefaultConfiguration;
|
||||
return -1;
|
||||
}
|
||||
List<IPEndPoint> lstIpEndPoints = new();
|
||||
List<TcpConnectionInformation> lstTcpConns = new();
|
||||
try
|
||||
{
|
||||
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpListeners());
|
||||
lstIpEndPoints.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveUdpListeners());
|
||||
lstTcpConns.AddRange(IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
|
||||
GenLog(singboxConfig);
|
||||
GenDns(new(), singboxConfig);
|
||||
singboxConfig.inbounds.Clear(); // Remove "proxy" service for speedtest, avoiding port conflicts.
|
||||
singboxConfig.outbounds.RemoveAt(0);
|
||||
|
||||
int httpPort = LazyConfig.Instance.GetLocalPort("speedtest");
|
||||
|
||||
foreach (var it in selecteds)
|
||||
{
|
||||
if (it.configType == EConfigType.Custom)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (it.port <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (it.configType is EConfigType.VMess or EConfigType.VLESS)
|
||||
{
|
||||
var item2 = LazyConfig.Instance.GetProfileItem(it.indexId);
|
||||
if (item2 is null || Utils.IsNullOrEmpty(item2.id) || !Utils.IsGuidByParse(item2.id))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//find unuse port
|
||||
var port = httpPort;
|
||||
for (int k = httpPort; k < Global.MaxPort; k++)
|
||||
{
|
||||
if (lstIpEndPoints?.FindIndex(_it => _it.Port == k) >= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (lstTcpConns?.FindIndex(_it => _it.LocalEndPoint.Port == k) >= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
//found
|
||||
port = k;
|
||||
httpPort = port + 1;
|
||||
break;
|
||||
}
|
||||
|
||||
//Port In Used
|
||||
if (lstIpEndPoints?.FindIndex(_it => _it.Port == port) >= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
it.port = port;
|
||||
it.allowTest = true;
|
||||
|
||||
//inbound
|
||||
Inbound4Sbox inbound = new()
|
||||
{
|
||||
listen = Global.Loopback,
|
||||
listen_port = port,
|
||||
type = Global.InboundHttp
|
||||
};
|
||||
inbound.tag = Global.InboundHttp + inbound.listen_port.ToString();
|
||||
singboxConfig.inbounds.Add(inbound);
|
||||
|
||||
//outbound
|
||||
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
|
||||
if (item is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.configType == EConfigType.Shadowsocks
|
||||
&& !Global.SsSecuritysInXray.Contains(item.security))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.configType == EConfigType.VLESS
|
||||
&& !Global.Flows.Contains(item.flow))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var outbound = Utils.FromJson<Outbound4Sbox>(txtOutbound);
|
||||
GenOutbound(item, outbound);
|
||||
outbound.tag = Global.ProxyTag + inbound.listen_port.ToString();
|
||||
singboxConfig.outbounds.Add(outbound);
|
||||
|
||||
//rule
|
||||
Rule4Sbox rule = new()
|
||||
{
|
||||
inbound = new List<string> { inbound.tag },
|
||||
outbound = outbound.tag
|
||||
};
|
||||
singboxConfig.route.rules.Add(rule);
|
||||
}
|
||||
|
||||
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
msg = ResUI.FailedGenDefaultConfiguration;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Gen speedtest config
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Net;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using v2rayN.Base;
|
||||
using v2rayN.Mode;
|
||||
@@ -8,7 +10,6 @@ namespace v2rayN.Handler
|
||||
{
|
||||
internal class CoreConfigV2ray
|
||||
{
|
||||
private string SampleClient = Global.v2raySampleClient;
|
||||
private Config _config;
|
||||
|
||||
public CoreConfigV2ray(Config config)
|
||||
@@ -30,7 +31,7 @@ namespace v2rayN.Handler
|
||||
|
||||
msg = ResUI.InitialConfiguration;
|
||||
|
||||
string result = Utils.GetEmbedText(SampleClient);
|
||||
string result = Utils.GetEmbedText(Global.V2raySampleClient);
|
||||
if (Utils.IsNullOrEmpty(result))
|
||||
{
|
||||
msg = ResUI.FailedGetDefaultConfiguration;
|
||||
@@ -44,17 +45,19 @@ namespace v2rayN.Handler
|
||||
return -1;
|
||||
}
|
||||
|
||||
log(v2rayConfig);
|
||||
GenLog(v2rayConfig);
|
||||
|
||||
inbound(v2rayConfig);
|
||||
GenInbounds(v2rayConfig);
|
||||
|
||||
routing(v2rayConfig);
|
||||
GenRouting(v2rayConfig);
|
||||
|
||||
outbound(node, v2rayConfig);
|
||||
GenOutbound(node, v2rayConfig.outbounds[0]);
|
||||
|
||||
dns(v2rayConfig);
|
||||
GenMoreOutbounds(node, v2rayConfig);
|
||||
|
||||
statistic(v2rayConfig);
|
||||
GenDns(v2rayConfig);
|
||||
|
||||
GenStatistic(v2rayConfig);
|
||||
|
||||
msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
}
|
||||
@@ -67,7 +70,9 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int log(V2rayConfig v2rayConfig)
|
||||
#region private gen function
|
||||
|
||||
private int GenLog(V2rayConfig v2rayConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -92,7 +97,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int inbound(V2rayConfig v2rayConfig)
|
||||
private int GenInbounds(V2rayConfig v2rayConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -143,7 +148,7 @@ namespace v2rayN.Handler
|
||||
|
||||
private Inbounds4Ray? GetInbound(InItem inItem, string tag, int offset, bool bSocks)
|
||||
{
|
||||
string result = Utils.GetEmbedText(Global.v2raySampleInbound);
|
||||
string result = Utils.GetEmbedText(Global.V2raySampleInbound);
|
||||
if (Utils.IsNullOrEmpty(result))
|
||||
{
|
||||
return null;
|
||||
@@ -164,7 +169,7 @@ namespace v2rayN.Handler
|
||||
return inbound;
|
||||
}
|
||||
|
||||
private int routing(V2rayConfig v2rayConfig)
|
||||
private int GenRouting(V2rayConfig v2rayConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -175,7 +180,7 @@ namespace v2rayN.Handler
|
||||
|
||||
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||
{
|
||||
var routing = ConfigHandler.GetDefaultRouting(ref _config);
|
||||
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||
if (routing != null)
|
||||
{
|
||||
if (!Utils.IsNullOrEmpty(routing.domainStrategy))
|
||||
@@ -188,21 +193,21 @@ namespace v2rayN.Handler
|
||||
if (item.enabled)
|
||||
{
|
||||
var item2 = Utils.FromJson<RulesItem4Ray>(Utils.ToJson(item));
|
||||
routingUserRule(item2, v2rayConfig);
|
||||
GenRoutingUserRule(item2, v2rayConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
|
||||
var lockedItem = ConfigHandler.GetLockedRoutingItem(_config);
|
||||
if (lockedItem != null)
|
||||
{
|
||||
var rules = Utils.FromJson<List<RulesItem>>(lockedItem.ruleSet);
|
||||
foreach (var item in rules)
|
||||
{
|
||||
var item2 = Utils.FromJson<RulesItem4Ray>(Utils.ToJson(item));
|
||||
routingUserRule(item2, v2rayConfig);
|
||||
GenRoutingUserRule(item2, v2rayConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -215,7 +220,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int routingUserRule(RulesItem4Ray rules, V2rayConfig v2rayConfig)
|
||||
private int GenRoutingUserRule(RulesItem4Ray rules, V2rayConfig v2rayConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -289,11 +294,10 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int outbound(ProfileItem node, V2rayConfig v2rayConfig)
|
||||
private int GenOutbound(ProfileItem node, Outbounds4Ray outbound)
|
||||
{
|
||||
try
|
||||
{
|
||||
Outbounds4Ray outbound = v2rayConfig.outbounds[0];
|
||||
if (node.configType == EConfigType.VMess)
|
||||
{
|
||||
VnextItem4Ray vnextItem;
|
||||
@@ -322,8 +326,8 @@ namespace v2rayN.Handler
|
||||
//远程服务器用户ID
|
||||
usersItem.id = node.id;
|
||||
usersItem.alterId = node.alterId;
|
||||
usersItem.email = Global.userEMail;
|
||||
if (Global.vmessSecuritys.Contains(node.security))
|
||||
usersItem.email = Global.UserEMail;
|
||||
if (Global.VmessSecuritys.Contains(node.security))
|
||||
{
|
||||
usersItem.security = node.security;
|
||||
}
|
||||
@@ -332,9 +336,9 @@ namespace v2rayN.Handler
|
||||
usersItem.security = Global.DefaultSecurity;
|
||||
}
|
||||
|
||||
outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
|
||||
outbound.protocol = Global.vmessProtocolLite;
|
||||
outbound.protocol = Global.ProtocolTypes[EConfigType.VMess];
|
||||
outbound.settings.servers = null;
|
||||
}
|
||||
else if (node.configType == EConfigType.Shadowsocks)
|
||||
@@ -357,9 +361,9 @@ namespace v2rayN.Handler
|
||||
serversItem.ota = false;
|
||||
serversItem.level = 1;
|
||||
|
||||
outboundMux(node, outbound, false);
|
||||
GenOutboundMux(node, outbound, false);
|
||||
|
||||
outbound.protocol = Global.ssProtocolLite;
|
||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Shadowsocks];
|
||||
outbound.settings.vnext = null;
|
||||
}
|
||||
else if (node.configType == EConfigType.Socks)
|
||||
@@ -392,9 +396,9 @@ namespace v2rayN.Handler
|
||||
serversItem.users = new List<SocksUsersItem4Ray>() { socksUsersItem };
|
||||
}
|
||||
|
||||
outboundMux(node, outbound, false);
|
||||
GenOutboundMux(node, outbound, false);
|
||||
|
||||
outbound.protocol = Global.socksProtocolLite;
|
||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Socks];
|
||||
outbound.settings.vnext = null;
|
||||
}
|
||||
else if (node.configType == EConfigType.VLESS)
|
||||
@@ -423,10 +427,10 @@ namespace v2rayN.Handler
|
||||
usersItem = vnextItem.users[0];
|
||||
}
|
||||
usersItem.id = node.id;
|
||||
usersItem.email = Global.userEMail;
|
||||
usersItem.email = Global.UserEMail;
|
||||
usersItem.encryption = node.security;
|
||||
|
||||
outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
|
||||
if (node.streamSecurity == Global.StreamSecurityReality
|
||||
|| node.streamSecurity == Global.StreamSecurity)
|
||||
@@ -435,15 +439,15 @@ namespace v2rayN.Handler
|
||||
{
|
||||
usersItem.flow = node.flow;
|
||||
|
||||
outboundMux(node, outbound, false);
|
||||
GenOutboundMux(node, outbound, false);
|
||||
}
|
||||
}
|
||||
if (node.streamSecurity == Global.StreamSecurityReality && Utils.IsNullOrEmpty(node.flow))
|
||||
{
|
||||
outboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||
}
|
||||
|
||||
outbound.protocol = Global.vlessProtocolLite;
|
||||
outbound.protocol = Global.ProtocolTypes[EConfigType.VLESS];
|
||||
outbound.settings.servers = null;
|
||||
}
|
||||
else if (node.configType == EConfigType.Trojan)
|
||||
@@ -465,12 +469,12 @@ namespace v2rayN.Handler
|
||||
serversItem.ota = false;
|
||||
serversItem.level = 1;
|
||||
|
||||
outboundMux(node, outbound, false);
|
||||
GenOutboundMux(node, outbound, false);
|
||||
|
||||
outbound.protocol = Global.trojanProtocolLite;
|
||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Trojan];
|
||||
outbound.settings.vnext = null;
|
||||
}
|
||||
boundStreamSettings(node, outbound.streamSettings);
|
||||
GenBoundStreamSettings(node, outbound.streamSettings);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -479,7 +483,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int outboundMux(ProfileItem node, Outbounds4Ray outbound, bool enabled)
|
||||
private int GenOutboundMux(ProfileItem node, Outbounds4Ray outbound, bool enabled)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -501,7 +505,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int boundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings)
|
||||
private int GenBoundStreamSettings(ProfileItem node, StreamSettings4Ray streamSettings)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -513,7 +517,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
try
|
||||
{
|
||||
useragent = Global.userAgentTxt[_config.coreBasicItem.defUserAgent];
|
||||
useragent = Global.UserAgentTxts[_config.coreBasicItem.defUserAgent];
|
||||
}
|
||||
catch (KeyNotFoundException)
|
||||
{
|
||||
@@ -670,7 +674,7 @@ namespace v2rayN.Handler
|
||||
};
|
||||
|
||||
//request Host
|
||||
string request = Utils.GetEmbedText(Global.v2raySampleHttprequestFileName);
|
||||
string request = Utils.GetEmbedText(Global.V2raySampleHttprequestFileName);
|
||||
string[] arrHost = host.Split(',');
|
||||
string host2 = string.Join("\",\"", arrHost);
|
||||
request = request.Replace("$requestHost$", $"\"{host2}\"");
|
||||
@@ -698,7 +702,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int dns(V2rayConfig v2rayConfig)
|
||||
private int GenDns(V2rayConfig v2rayConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -718,29 +722,50 @@ namespace v2rayN.Handler
|
||||
outbound.settings.userLevel = 0;
|
||||
}
|
||||
|
||||
var obj = Utils.ParseJson(normalDNS);
|
||||
if (obj?.ContainsKey("servers") == true)
|
||||
{
|
||||
v2rayConfig.dns = obj;
|
||||
}
|
||||
else
|
||||
var obj = Utils.ParseJson(normalDNS) ?? new JObject();
|
||||
|
||||
if (!obj.ContainsKey("servers"))
|
||||
{
|
||||
List<string> servers = new();
|
||||
|
||||
string[] arrDNS = normalDNS.Split(',');
|
||||
foreach (string str in arrDNS)
|
||||
{
|
||||
//if (Utils.IsIP(str))
|
||||
//{
|
||||
servers.Add(str);
|
||||
//}
|
||||
}
|
||||
//servers.Add("localhost");
|
||||
v2rayConfig.dns = new Mode.Dns4Ray
|
||||
{
|
||||
servers = servers
|
||||
};
|
||||
obj["servers"] = JArray.FromObject(servers);
|
||||
}
|
||||
|
||||
if (item.useSystemHosts)
|
||||
{
|
||||
var hostfile = @"C:\Windows\System32\drivers\etc\hosts";
|
||||
|
||||
if (File.Exists(hostfile))
|
||||
{
|
||||
var hosts = File.ReadAllText(hostfile).Replace("\r", "");
|
||||
var hostsList = hosts.Split(new[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
// 获取系统hosts
|
||||
var systemHosts = new Dictionary<string, string>();
|
||||
foreach (var host in hostsList)
|
||||
{
|
||||
if (host.StartsWith("#")) continue;
|
||||
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (hostItem.Length < 2) continue;
|
||||
systemHosts.Add(hostItem[1], hostItem[0]);
|
||||
}
|
||||
|
||||
// 追加至 dns 设置
|
||||
var normalHost = obj["hosts"] ?? new JObject();
|
||||
foreach (var host in systemHosts)
|
||||
{
|
||||
if (normalHost[host.Key] != null) continue;
|
||||
normalHost[host.Key] = host.Value;
|
||||
}
|
||||
obj["hosts"] = normalHost;
|
||||
}
|
||||
}
|
||||
|
||||
v2rayConfig.dns = obj;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -749,7 +774,7 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int statistic(V2rayConfig v2rayConfig)
|
||||
private int GenStatistic(V2rayConfig v2rayConfig)
|
||||
{
|
||||
if (_config.guiItem.enableStatistics)
|
||||
{
|
||||
@@ -777,7 +802,7 @@ namespace v2rayN.Handler
|
||||
Inboundsettings4Ray apiInboundSettings = new();
|
||||
apiInbound.tag = tag;
|
||||
apiInbound.listen = Global.Loopback;
|
||||
apiInbound.port = Global.statePort;
|
||||
apiInbound.port = Global.StatePort;
|
||||
apiInbound.protocol = Global.InboundAPIProtocal;
|
||||
apiInboundSettings.address = Global.Loopback;
|
||||
apiInbound.settings = apiInboundSettings;
|
||||
@@ -799,34 +824,99 @@ namespace v2rayN.Handler
|
||||
return 0;
|
||||
}
|
||||
|
||||
private int GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
||||
{
|
||||
if (node.subid.IsNullOrEmpty())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
try
|
||||
{
|
||||
var subItem = LazyConfig.Instance.GetSubItem(node.subid);
|
||||
if (subItem is null)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
//current proxy
|
||||
var outbound = v2rayConfig.outbounds[0];
|
||||
var txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound);
|
||||
|
||||
//Previous proxy
|
||||
var prevNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.prevProfile!);
|
||||
if (prevNode is not null
|
||||
&& prevNode.configType != EConfigType.Custom
|
||||
&& prevNode.configType != EConfigType.Hysteria2
|
||||
&& prevNode.configType != EConfigType.Tuic)
|
||||
{
|
||||
var prevOutbound = Utils.FromJson<Outbounds4Ray>(txtOutbound);
|
||||
GenOutbound(prevNode, prevOutbound);
|
||||
prevOutbound.tag = $"{Global.ProxyTag}2";
|
||||
v2rayConfig.outbounds.Add(prevOutbound);
|
||||
|
||||
outbound.streamSettings.sockopt = new()
|
||||
{
|
||||
dialerProxy = prevOutbound.tag
|
||||
};
|
||||
}
|
||||
|
||||
//Next proxy
|
||||
var nextNode = LazyConfig.Instance.GetProfileItemViaRemarks(subItem.nextProfile!);
|
||||
if (nextNode is not null
|
||||
&& nextNode.configType != EConfigType.Custom
|
||||
&& nextNode.configType != EConfigType.Hysteria2
|
||||
&& nextNode.configType != EConfigType.Tuic)
|
||||
{
|
||||
var nextOutbound = Utils.FromJson<Outbounds4Ray>(txtOutbound);
|
||||
GenOutbound(nextNode, nextOutbound);
|
||||
nextOutbound.tag = Global.ProxyTag;
|
||||
v2rayConfig.outbounds.Insert(0, nextOutbound);
|
||||
|
||||
outbound.tag = $"{Global.ProxyTag}1";
|
||||
nextOutbound.streamSettings.sockopt = new()
|
||||
{
|
||||
dialerProxy = outbound.tag
|
||||
};
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion private gen function
|
||||
|
||||
#region Gen speedtest config
|
||||
|
||||
public string GenerateClientSpeedtestConfigString(List<ServerTestItem> selecteds, out string msg)
|
||||
public int GenerateClientSpeedtestConfig(List<ServerTestItem> selecteds, out V2rayConfig? v2rayConfig, out string msg)
|
||||
{
|
||||
v2rayConfig = null;
|
||||
try
|
||||
{
|
||||
if (_config == null)
|
||||
{
|
||||
msg = ResUI.CheckServerSettings;
|
||||
return "";
|
||||
return -1;
|
||||
}
|
||||
|
||||
msg = ResUI.InitialConfiguration;
|
||||
|
||||
Config configCopy = Utils.DeepCopy(_config);
|
||||
|
||||
string result = Utils.GetEmbedText(SampleClient);
|
||||
if (Utils.IsNullOrEmpty(result))
|
||||
string result = Utils.GetEmbedText(Global.V2raySampleClient);
|
||||
string txtOutbound = Utils.GetEmbedText(Global.V2raySampleOutbound);
|
||||
if (Utils.IsNullOrEmpty(result) || txtOutbound.IsNullOrEmpty())
|
||||
{
|
||||
msg = ResUI.FailedGetDefaultConfiguration;
|
||||
return "";
|
||||
return -1;
|
||||
}
|
||||
|
||||
V2rayConfig? v2rayConfig = Utils.FromJson<V2rayConfig>(result);
|
||||
v2rayConfig = Utils.FromJson<V2rayConfig>(result);
|
||||
if (v2rayConfig == null)
|
||||
{
|
||||
msg = ResUI.FailedGenDefaultConfiguration;
|
||||
return "";
|
||||
return -1;
|
||||
}
|
||||
List<IPEndPoint> lstIpEndPoints = new();
|
||||
List<TcpConnectionInformation> lstTcpConns = new();
|
||||
@@ -841,8 +931,9 @@ namespace v2rayN.Handler
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
|
||||
log(v2rayConfig);
|
||||
GenLog(v2rayConfig);
|
||||
v2rayConfig.inbounds.Clear(); // Remove "proxy" service for speedtest, avoiding port conflicts.
|
||||
v2rayConfig.outbounds.RemoveAt(0);
|
||||
|
||||
int httpPort = LazyConfig.Instance.GetLocalPort("speedtest");
|
||||
|
||||
@@ -902,45 +993,45 @@ namespace v2rayN.Handler
|
||||
v2rayConfig.inbounds.Add(inbound);
|
||||
|
||||
//outbound
|
||||
V2rayConfig? v2rayConfigCopy = Utils.FromJson<V2rayConfig>(result);
|
||||
var item = LazyConfig.Instance.GetProfileItem(it.indexId);
|
||||
if (item is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.configType == EConfigType.Shadowsocks
|
||||
&& !Global.ssSecuritysInXray.Contains(item.security))
|
||||
&& !Global.SsSecuritysInXray.Contains(item.security))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (item.configType == EConfigType.VLESS
|
||||
&& !Global.flows.Contains(item.flow))
|
||||
&& !Global.Flows.Contains(item.flow))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
outbound(item, v2rayConfigCopy);
|
||||
v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();
|
||||
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
|
||||
var outbound = Utils.FromJson<Outbounds4Ray>(txtOutbound);
|
||||
GenOutbound(item, outbound);
|
||||
outbound.tag = Global.ProxyTag + inbound.port.ToString();
|
||||
v2rayConfig.outbounds.Add(outbound);
|
||||
|
||||
//rule
|
||||
RulesItem4Ray rule = new()
|
||||
{
|
||||
inboundTag = new List<string> { inbound.tag },
|
||||
outboundTag = v2rayConfigCopy.outbounds[0].tag,
|
||||
outboundTag = outbound.tag,
|
||||
type = "field"
|
||||
};
|
||||
v2rayConfig.routing.rules.Add(rule);
|
||||
}
|
||||
|
||||
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
||||
return Utils.ToJson(v2rayConfig);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
msg = ResUI.FailedGenDefaultConfiguration;
|
||||
return "";
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reactive.Linq;
|
||||
using System.Text;
|
||||
using v2rayN.Mode;
|
||||
using v2rayN.Resx;
|
||||
@@ -27,14 +28,14 @@ namespace v2rayN.Handler
|
||||
|
||||
public void LoadCore()
|
||||
{
|
||||
var node = ConfigHandler.GetDefaultServer(ref _config);
|
||||
var node = ConfigHandler.GetDefaultServer(_config);
|
||||
if (node == null)
|
||||
{
|
||||
ShowMsg(false, ResUI.CheckServerSettings);
|
||||
return;
|
||||
}
|
||||
|
||||
string fileName = Utils.GetConfigPath(Global.coreConfigFileName);
|
||||
string fileName = Utils.GetConfigPath(Global.CoreConfigFileName);
|
||||
if (CoreConfigHandler.GenerateClientConfig(node, fileName, out string msg, out string content) != 0)
|
||||
{
|
||||
ShowMsg(false, msg);
|
||||
@@ -45,21 +46,40 @@ namespace v2rayN.Handler
|
||||
ShowMsg(true, $"{node.GetSummary()}");
|
||||
CoreStop();
|
||||
CoreStart(node);
|
||||
|
||||
//In tun mode, do a delay check and restart the core
|
||||
if (_config.tunModeItem.enableTun)
|
||||
{
|
||||
Observable.Range(1, 1)
|
||||
.Delay(TimeSpan.FromSeconds(15))
|
||||
.Subscribe(x =>
|
||||
{
|
||||
{
|
||||
if (_process == null || _process.HasExited)
|
||||
{
|
||||
CoreStart(node);
|
||||
ShowMsg(false, "Tun mode restart the core once");
|
||||
Utils.SaveLog("Tun mode restart the core once");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int LoadCoreConfigString(List<ServerTestItem> _selecteds)
|
||||
public int LoadCoreConfigSpeedtest(List<ServerTestItem> selecteds)
|
||||
{
|
||||
int pid = -1;
|
||||
string configStr = CoreConfigHandler.GenerateClientSpeedtestConfigString(_config, _selecteds, out string msg);
|
||||
if (configStr == "")
|
||||
var coreType = selecteds.Exists(t => t.configType == EConfigType.Hysteria2 || t.configType == EConfigType.Tuic) ? ECoreType.sing_box : ECoreType.Xray;
|
||||
string configPath = Utils.GetConfigPath(Global.CoreSpeedtestConfigFileName);
|
||||
if (CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType, out string msg) != 0)
|
||||
{
|
||||
ShowMsg(false, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowMsg(false, msg);
|
||||
pid = CoreStartViaString(configStr);
|
||||
pid = CoreStartSpeedtest(configPath, coreType);
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
@@ -96,7 +116,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
foreach (string vName in it.coreExes)
|
||||
{
|
||||
Process[] existing = Process.GetProcessesByName(vName);
|
||||
var existing = Process.GetProcessesByName(vName);
|
||||
foreach (Process p in existing)
|
||||
{
|
||||
string? path = p.MainModule?.FileName;
|
||||
@@ -119,7 +139,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
try
|
||||
{
|
||||
Process _p = Process.GetProcessById(pid);
|
||||
var _p = Process.GetProcessById(pid);
|
||||
KillProcess(_p);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -152,7 +172,7 @@ namespace v2rayN.Handler
|
||||
|
||||
private void CoreStart(ProfileItem node)
|
||||
{
|
||||
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
|
||||
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
||||
|
||||
ECoreType coreType;
|
||||
if (node.configType != EConfigType.Custom && _config.tunModeItem.enableTun)
|
||||
@@ -185,11 +205,11 @@ namespace v2rayN.Handler
|
||||
address = Global.Loopback,
|
||||
port = node.preSocksPort
|
||||
};
|
||||
string fileName2 = Utils.GetConfigPath(Global.corePreConfigFileName);
|
||||
string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName);
|
||||
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
|
||||
{
|
||||
var coreInfo2 = LazyConfig.Instance.GetCoreInfo(ECoreType.sing_box);
|
||||
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.corePreConfigFileName}", true, ShowMsg);
|
||||
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true, ShowMsg);
|
||||
if (proc2 is not null)
|
||||
{
|
||||
_processPre = proc2;
|
||||
@@ -199,62 +219,21 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private int CoreStartViaString(string configStr)
|
||||
private int CoreStartSpeedtest(string configPath, ECoreType coreType)
|
||||
{
|
||||
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString()));
|
||||
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
|
||||
|
||||
ShowMsg(false, configPath);
|
||||
try
|
||||
{
|
||||
var coreInfo = LazyConfig.Instance.GetCoreInfo(ECoreType.Xray);
|
||||
string fileName = CoreFindexe(coreInfo);
|
||||
if (fileName == "") return -1;
|
||||
|
||||
Process p = new()
|
||||
var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
|
||||
var proc = RunProcess(new(), coreInfo, $" -c {Global.CoreSpeedtestConfigFileName}", true, ShowMsg);
|
||||
if (proc is null)
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = "-config stdin:",
|
||||
WorkingDirectory = Utils.GetConfigPath(),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
RedirectStandardError = true,
|
||||
CreateNoWindow = true,
|
||||
StandardOutputEncoding = Encoding.UTF8,
|
||||
StandardErrorEncoding = Encoding.UTF8
|
||||
}
|
||||
};
|
||||
p.OutputDataReceived += (sender, e) =>
|
||||
{
|
||||
if (!String.IsNullOrEmpty(e.Data))
|
||||
{
|
||||
string msg = e.Data + Environment.NewLine;
|
||||
ShowMsg(false, msg);
|
||||
}
|
||||
};
|
||||
p.ErrorDataReceived += (sender, e) =>
|
||||
{
|
||||
if (!string.IsNullOrEmpty(e.Data))
|
||||
{
|
||||
string msg = e.Data + Environment.NewLine;
|
||||
ShowMsg(false, msg);
|
||||
}
|
||||
};
|
||||
p.Start();
|
||||
p.BeginOutputReadLine();
|
||||
p.BeginErrorReadLine();
|
||||
|
||||
p.StandardInput.Write(configStr);
|
||||
p.StandardInput.Close();
|
||||
|
||||
if (p.WaitForExit(1000))
|
||||
{
|
||||
throw new Exception(p.StandardError.ReadToEnd());
|
||||
return -1;
|
||||
}
|
||||
|
||||
Global.processJob.AddProcess(p.Handle);
|
||||
return p.Id;
|
||||
return proc.Id;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -283,7 +262,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
Process proc = new()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
StartInfo = new()
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = string.Format(coreInfo.arguments, configPath),
|
||||
@@ -327,7 +306,7 @@ namespace v2rayN.Handler
|
||||
throw new Exception(displayLog ? proc.StandardError.ReadToEnd() : "启动进程失败并退出 (Failed to start the process and exited)");
|
||||
}
|
||||
|
||||
Global.processJob.AddProcess(proc.Handle);
|
||||
Global.ProcessJob.AddProcess(proc.Handle);
|
||||
return proc;
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -339,16 +318,20 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private void KillProcess(Process p)
|
||||
private void KillProcess(Process? proc)
|
||||
{
|
||||
if (proc is null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
p.CloseMainWindow();
|
||||
p.WaitForExit(100);
|
||||
if (!p.HasExited)
|
||||
proc.CloseMainWindow();
|
||||
proc.WaitForExit(100);
|
||||
if (!proc.HasExited)
|
||||
{
|
||||
p.Kill();
|
||||
p.WaitForExit(100);
|
||||
proc.Kill();
|
||||
proc.WaitForExit(100);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@@ -177,4 +177,4 @@ namespace v2rayN.Handler
|
||||
NoRepeat = 0x4000
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using v2rayN.Base;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
using v2rayN.Base;
|
||||
using v2rayN.Mode;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
@@ -129,6 +130,15 @@ namespace v2rayN.Handler
|
||||
return SqliteHelper.Instance.Table<ProfileItem>().FirstOrDefault(it => it.indexId == indexId);
|
||||
}
|
||||
|
||||
public ProfileItem? GetProfileItemViaRemarks(string remarks)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(remarks))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return SqliteHelper.Instance.Table<ProfileItem>().FirstOrDefault(it => it.remarks == remarks);
|
||||
}
|
||||
|
||||
public List<RoutingItem> RoutingItems()
|
||||
{
|
||||
return SqliteHelper.Instance.Table<RoutingItem>().Where(it => it.locked == false).OrderBy(t => t.sort).ToList();
|
||||
@@ -157,14 +167,14 @@ namespace v2rayN.Handler
|
||||
{
|
||||
if (GetCoreType(profileItem, EConfigType.Shadowsocks) == ECoreType.v2fly)
|
||||
{
|
||||
return Global.ssSecuritys;
|
||||
return Global.SsSecuritys;
|
||||
}
|
||||
if (GetCoreType(profileItem, EConfigType.Shadowsocks) == ECoreType.Xray)
|
||||
{
|
||||
return Global.ssSecuritysInXray;
|
||||
return Global.SsSecuritysInXray;
|
||||
}
|
||||
|
||||
return Global.ssSecuritysInSagerNet;
|
||||
return Global.SsSecuritysInSagerNet;
|
||||
}
|
||||
|
||||
public ECoreType GetCoreType(ProfileItem profileItem, EConfigType eConfigType)
|
||||
@@ -195,13 +205,13 @@ namespace v2rayN.Handler
|
||||
return coreInfos!.FirstOrDefault(t => t.coreType == coreType);
|
||||
}
|
||||
|
||||
public List<CoreInfo>? GetCoreInfos()
|
||||
public List<CoreInfo> GetCoreInfos()
|
||||
{
|
||||
if (coreInfos == null)
|
||||
{
|
||||
InitCoreInfo();
|
||||
}
|
||||
return coreInfos;
|
||||
return coreInfos!;
|
||||
}
|
||||
|
||||
private void InitCoreInfo()
|
||||
@@ -212,7 +222,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
coreType = ECoreType.v2rayN,
|
||||
coreUrl = Global.NUrl,
|
||||
coreReleaseApiUrl = Global.NUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN-32.zip",
|
||||
coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip",
|
||||
coreDownloadUrlArm64 = Global.NUrl + "/download/{0}/v2rayN-arm64.zip"
|
||||
@@ -223,11 +233,11 @@ namespace v2rayN.Handler
|
||||
coreType = ECoreType.v2fly,
|
||||
coreExes = new List<string> { "wv2ray", "v2ray" },
|
||||
arguments = "",
|
||||
coreUrl = Global.v2flyCoreUrl,
|
||||
coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreUrl = Global.V2flyCoreUrl,
|
||||
coreReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
match = "V2Ray",
|
||||
versionArg = "-version",
|
||||
redirectInfo = true,
|
||||
@@ -239,7 +249,7 @@ namespace v2rayN.Handler
|
||||
coreExes = new List<string> { "SagerNet", "v2ray" },
|
||||
arguments = "run",
|
||||
coreUrl = Global.SagerNetCoreUrl,
|
||||
coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
@@ -252,12 +262,12 @@ namespace v2rayN.Handler
|
||||
{
|
||||
coreType = ECoreType.v2fly_v5,
|
||||
coreExes = new List<string> { "v2ray" },
|
||||
arguments = "run",
|
||||
coreUrl = Global.v2flyCoreUrl,
|
||||
coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
arguments = "run -c config.json -format jsonv5",
|
||||
coreUrl = Global.V2flyCoreUrl,
|
||||
coreReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.V2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
|
||||
match = "V2Ray",
|
||||
versionArg = "version",
|
||||
redirectInfo = true,
|
||||
@@ -267,12 +277,12 @@ namespace v2rayN.Handler
|
||||
{
|
||||
coreType = ECoreType.Xray,
|
||||
coreExes = new List<string> { "xray", "wxray" },
|
||||
arguments = "",
|
||||
coreUrl = Global.xrayCoreUrl,
|
||||
coreReleaseApiUrl = Global.xrayCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
arguments = "run {0}",
|
||||
coreUrl = Global.XrayCoreUrl,
|
||||
coreReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
coreDownloadUrl64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
coreDownloadUrlArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
|
||||
match = "Xray",
|
||||
versionArg = "-version",
|
||||
redirectInfo = true,
|
||||
@@ -283,11 +293,11 @@ namespace v2rayN.Handler
|
||||
coreType = ECoreType.clash,
|
||||
coreExes = new List<string> { "clash-windows-amd64-v3", "clash-windows-amd64", "clash-windows-386", "clash" },
|
||||
arguments = "-f config.json",
|
||||
coreUrl = Global.clashCoreUrl,
|
||||
coreReleaseApiUrl = Global.clashCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip",
|
||||
coreDownloadUrlArm64 = Global.clashCoreUrl + "/download/{0}/clash-windows-arm64-{0}.zip",
|
||||
coreUrl = Global.ClashCoreUrl,
|
||||
coreReleaseApiUrl = Global.ClashCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.ClashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.ClashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip",
|
||||
coreDownloadUrlArm64 = Global.ClashCoreUrl + "/download/{0}/clash-windows-arm64-{0}.zip",
|
||||
match = "v",
|
||||
versionArg = "-v",
|
||||
redirectInfo = true,
|
||||
@@ -298,26 +308,37 @@ namespace v2rayN.Handler
|
||||
coreType = ECoreType.clash_meta,
|
||||
coreExes = new List<string> { "Clash.Meta-windows-amd64-compatible", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" },
|
||||
arguments = "-f config.json",
|
||||
coreUrl = Global.clashMetaCoreUrl,
|
||||
coreReleaseApiUrl = Global.clashMetaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip",
|
||||
coreDownloadUrlArm64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-arm64-{0}.zip",
|
||||
coreUrl = Global.ClashMetaCoreUrl,
|
||||
coreReleaseApiUrl = Global.ClashMetaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.ClashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip",
|
||||
coreDownloadUrl64 = Global.ClashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip",
|
||||
coreDownloadUrlArm64 = Global.ClashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-arm64-{0}.zip",
|
||||
match = "v",
|
||||
versionArg = "-v",
|
||||
redirectInfo = true,
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
{
|
||||
coreType = ECoreType.mihomo,
|
||||
coreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
|
||||
arguments = "-f config.yaml",
|
||||
coreUrl = Global.MihomoCoreUrl,
|
||||
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
match = "Mihomo",
|
||||
redirectInfo = true,
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
{
|
||||
coreType = ECoreType.hysteria,
|
||||
coreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
||||
arguments = "",
|
||||
coreUrl = Global.hysteriaCoreUrl,
|
||||
coreReleaseApiUrl = Global.hysteriaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-386.exe",
|
||||
coreDownloadUrl64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-amd64.exe",
|
||||
coreDownloadUrlArm64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-arm64.exe",
|
||||
coreUrl = Global.HysteriaCoreUrl,
|
||||
coreReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-386.exe",
|
||||
coreDownloadUrl64 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-amd64.exe",
|
||||
coreDownloadUrlArm64 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-arm64.exe",
|
||||
redirectInfo = true,
|
||||
});
|
||||
|
||||
@@ -326,7 +347,7 @@ namespace v2rayN.Handler
|
||||
coreType = ECoreType.naiveproxy,
|
||||
coreExes = new List<string> { "naiveproxy", "naive" },
|
||||
arguments = "config.json",
|
||||
coreUrl = Global.naiveproxyCoreUrl,
|
||||
coreUrl = Global.NaiveproxyCoreUrl,
|
||||
redirectInfo = false,
|
||||
});
|
||||
|
||||
@@ -335,7 +356,7 @@ namespace v2rayN.Handler
|
||||
coreType = ECoreType.tuic,
|
||||
coreExes = new List<string> { "tuic-client", "tuic" },
|
||||
arguments = "-c config.json",
|
||||
coreUrl = Global.tuicCoreUrl,
|
||||
coreUrl = Global.TuicCoreUrl,
|
||||
redirectInfo = true,
|
||||
});
|
||||
|
||||
@@ -343,16 +364,37 @@ namespace v2rayN.Handler
|
||||
{
|
||||
coreType = ECoreType.sing_box,
|
||||
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
||||
arguments = "run{0}",
|
||||
coreUrl = Global.singboxCoreUrl,
|
||||
arguments = "run {0} --disable-color",
|
||||
coreUrl = Global.SingboxCoreUrl,
|
||||
redirectInfo = true,
|
||||
coreReleaseApiUrl = Global.singboxCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||
coreDownloadUrl32 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
||||
coreDownloadUrl64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
||||
coreDownloadUrlArm64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
||||
coreReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
||||
coreDownloadUrl64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
||||
coreDownloadUrlArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
||||
match = "sing-box",
|
||||
versionArg = "version",
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
{
|
||||
coreType = ECoreType.juicity,
|
||||
coreExes = new List<string> { "juicity-client", "juicity" },
|
||||
arguments = "run -c config.json",
|
||||
coreUrl = Global.JuicityCoreUrl
|
||||
});
|
||||
|
||||
coreInfos.Add(new CoreInfo
|
||||
{
|
||||
coreType = ECoreType.hysteria2,
|
||||
coreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
||||
arguments = "",
|
||||
coreUrl = Global.HysteriaCoreUrl,
|
||||
coreReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||
coreDownloadUrl32 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-386.exe",
|
||||
coreDownloadUrl64 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-amd64.exe",
|
||||
coreDownloadUrlArm64 = Global.HysteriaCoreUrl + "/download/{0}/hysteria-windows-arm64.exe",
|
||||
redirectInfo = true,
|
||||
});
|
||||
}
|
||||
|
||||
#endregion Core Type
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace v2rayN.Handler
|
||||
return null;
|
||||
}
|
||||
|
||||
var item = ConfigHandler.GetDefaultRouting(ref config);
|
||||
var item = ConfigHandler.GetDefaultRouting(config);
|
||||
if (item == null || Utils.IsNullOrEmpty(item.customIcon) || !File.Exists(item.customIcon))
|
||||
{
|
||||
return null;
|
||||
@@ -183,7 +183,7 @@ namespace v2rayN.Handler
|
||||
Utils.SaveLog("subscription" + msg);
|
||||
});
|
||||
item.updateTime = updateTime;
|
||||
ConfigHandler.AddSubItem(ref config, item);
|
||||
ConfigHandler.AddSubItem(config, item);
|
||||
|
||||
await Task.Delay(5000);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace v2rayN.Handler
|
||||
|
||||
public void SendMessage(string msg, bool time)
|
||||
{
|
||||
msg = $"{DateTime.Now} {msg}";
|
||||
msg = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {msg}";
|
||||
MessageBus.Current.SendMessage(msg, "MsgView");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private void AddProfileEx(string indexId, ref ProfileExItem profileEx)
|
||||
private void AddProfileEx(string indexId, ref ProfileExItem? profileEx)
|
||||
{
|
||||
profileEx = new()
|
||||
{
|
||||
|
||||
@@ -1,37 +1,68 @@
|
||||
using Microsoft.Win32;
|
||||
using System.Runtime.InteropServices;
|
||||
using static v2rayN.Handler.ProxySetting.InternetConnectionOption;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
{
|
||||
internal class ProxySetting
|
||||
{
|
||||
/// <summary>
|
||||
// set to use no proxy
|
||||
/// </summary>
|
||||
/// <exception cref="ApplicationException">Error message with win32 error code</exception>
|
||||
public static bool UnsetProxy()
|
||||
{
|
||||
return SetProxy(null, null, 1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set system proxy settings
|
||||
/// </summary>
|
||||
/// <param name="strProxy"> proxy address</param>
|
||||
/// <param name="exceptions">exception addresses that do not use proxy</param>
|
||||
/// <param name="type">type of proxy defined in PerConnFlags
|
||||
/// PROXY_TYPE_DIRECT = 0x00000001, // direct connection (no proxy)
|
||||
/// PROXY_TYPE_PROXY = 0x00000002, // via named proxy
|
||||
/// PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy script URL
|
||||
/// PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
|
||||
/// </param>
|
||||
/// <exception cref="ApplicationException">Error message with win32 error code</exception>
|
||||
/// <returns>true: one of connnection is successfully updated proxy settings</returns>
|
||||
public static bool SetProxy(string? strProxy, string? exceptions, int type)
|
||||
{
|
||||
// set proxy for LAN
|
||||
bool result = SetConnectionProxy(null, strProxy, exceptions, type);
|
||||
// set proxy for dial up connections
|
||||
var connections = EnumerateRasEntries();
|
||||
foreach (var connection in connections)
|
||||
{
|
||||
result |= SetConnectionProxy(connection, strProxy, exceptions, type);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool SetConnectionProxy(string? connectionName, string? strProxy, string? exceptions, int type)
|
||||
{
|
||||
InternetPerConnOptionList list = new();
|
||||
|
||||
int optionCount = 1;
|
||||
if (type == 1)
|
||||
if (type == 1) // No proxy
|
||||
{
|
||||
optionCount = 1;
|
||||
}
|
||||
else if (type is 2 or 4)
|
||||
else if (type is 2 or 4) // named proxy or autoproxy script URL
|
||||
{
|
||||
optionCount = Utils.IsNullOrEmpty(exceptions) ? 2 : 3;
|
||||
}
|
||||
|
||||
int m_Int = (int)PerConnFlags.PROXY_TYPE_DIRECT;
|
||||
PerConnOption m_Option = PerConnOption.INTERNET_PER_CONN_FLAGS;
|
||||
if (type == 2)
|
||||
if (type == 2) // named proxy
|
||||
{
|
||||
m_Int = (int)(PerConnFlags.PROXY_TYPE_DIRECT | PerConnFlags.PROXY_TYPE_PROXY);
|
||||
m_Option = PerConnOption.INTERNET_PER_CONN_PROXY_SERVER;
|
||||
}
|
||||
else if (type == 4)
|
||||
else if (type == 4) // autoproxy script url
|
||||
{
|
||||
m_Int = (int)(PerConnFlags.PROXY_TYPE_DIRECT | PerConnFlags.PROXY_TYPE_AUTO_PROXY_URL);
|
||||
m_Option = PerConnOption.INTERNET_PER_CONN_AUTOCONFIG_URL;
|
||||
@@ -47,24 +78,31 @@ namespace v2rayN.Handler
|
||||
if (optionCount > 1)
|
||||
{
|
||||
options[1].m_Option = m_Option;
|
||||
options[1].m_Value.m_StringPtr = Marshal.StringToHGlobalAuto(strProxy);
|
||||
options[1].m_Value.m_StringPtr = Marshal.StringToHGlobalAuto(strProxy); // !! remember to deallocate memory 1
|
||||
// except for these addresses ...
|
||||
if (optionCount > 2)
|
||||
{
|
||||
options[2].m_Option = PerConnOption.INTERNET_PER_CONN_PROXY_BYPASS;
|
||||
options[2].m_Value.m_StringPtr = Marshal.StringToHGlobalAuto(exceptions);
|
||||
options[2].m_Value.m_StringPtr = Marshal.StringToHGlobalAuto(exceptions); // !! remember to deallocate memory 2
|
||||
}
|
||||
}
|
||||
|
||||
// default stuff
|
||||
list.dwSize = Marshal.SizeOf(list);
|
||||
list.szConnection = IntPtr.Zero;
|
||||
if (connectionName != null)
|
||||
{
|
||||
list.szConnection = Marshal.StringToHGlobalAuto(connectionName); // !! remember to deallocate memory 3
|
||||
}
|
||||
else
|
||||
{
|
||||
list.szConnection = IntPtr.Zero;
|
||||
}
|
||||
list.dwOptionCount = options.Length;
|
||||
list.dwOptionError = 0;
|
||||
|
||||
int optSize = Marshal.SizeOf(typeof(InternetConnectionOption));
|
||||
// make a pointer out of all that ...
|
||||
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length);
|
||||
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length); // !! remember to deallocate memory 4
|
||||
// copy the array over into that spot in memory ...
|
||||
for (int i = 0; i < options.Length; ++i)
|
||||
{
|
||||
@@ -83,26 +121,82 @@ namespace v2rayN.Handler
|
||||
list.options = optionsPtr;
|
||||
|
||||
// and then make a pointer out of the whole list
|
||||
IntPtr ipcoListPtr = Marshal.AllocCoTaskMem(list.dwSize);
|
||||
IntPtr ipcoListPtr = Marshal.AllocCoTaskMem(list.dwSize); // !! remember to deallocate memory 5
|
||||
Marshal.StructureToPtr(list, ipcoListPtr, false);
|
||||
|
||||
// and finally, call the API method!
|
||||
int returnvalue = NativeMethods.InternetSetOption(IntPtr.Zero,
|
||||
bool isSuccess = NativeMethods.InternetSetOption(IntPtr.Zero,
|
||||
InternetOption.INTERNET_OPTION_PER_CONNECTION_OPTION,
|
||||
ipcoListPtr, list.dwSize) ? -1 : 0;
|
||||
if (returnvalue == 0)
|
||||
ipcoListPtr, list.dwSize);
|
||||
int returnvalue = 0; // ERROR_SUCCESS
|
||||
if (!isSuccess)
|
||||
{ // get the error codes, they might be helpful
|
||||
returnvalue = Marshal.GetLastWin32Error();
|
||||
returnvalue = Marshal.GetLastPInvokeError();
|
||||
}
|
||||
// FREE the data ASAP
|
||||
Marshal.FreeCoTaskMem(optionsPtr);
|
||||
Marshal.FreeCoTaskMem(ipcoListPtr);
|
||||
if (returnvalue > 0)
|
||||
{ // throw the error codes, they might be helpful
|
||||
//throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
else
|
||||
{
|
||||
// Notify the system that the registry settings have been changed and cause them to be refreshed
|
||||
NativeMethods.InternetSetOption(IntPtr.Zero, InternetOption.INTERNET_OPTION_SETTINGS_CHANGED, IntPtr.Zero, 0);
|
||||
NativeMethods.InternetSetOption(IntPtr.Zero, InternetOption.INTERNET_OPTION_REFRESH, IntPtr.Zero, 0);
|
||||
}
|
||||
|
||||
return (returnvalue < 0);
|
||||
// FREE the data ASAP
|
||||
if (list.szConnection != IntPtr.Zero) Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (optionCount > 1)
|
||||
{
|
||||
Marshal.FreeHGlobal(options[1].m_Value.m_StringPtr); // release mem 1
|
||||
if (optionCount > 2)
|
||||
{
|
||||
Marshal.FreeHGlobal(options[2].m_Value.m_StringPtr); // release mem 2
|
||||
}
|
||||
}
|
||||
Marshal.FreeCoTaskMem(optionsPtr); // release mem 4
|
||||
Marshal.FreeCoTaskMem(ipcoListPtr); // release mem 5
|
||||
if (returnvalue != 0)
|
||||
{
|
||||
// throw the error codes, they might be helpful
|
||||
throw new ApplicationException($"Set Internet Proxy failed with error code: {Marshal.GetLastWin32Error()}");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve list of connections including LAN and WAN to support PPPoE connection
|
||||
/// </summary>
|
||||
/// <returns>A list of RAS connection names. May be empty list if no dial up connection.</returns>
|
||||
/// <exception cref="ApplicationException">Error message with win32 error code</exception>
|
||||
private static IEnumerable<string> EnumerateRasEntries()
|
||||
{
|
||||
int entries = 0;
|
||||
// attempt to query with 1 entry buffer
|
||||
RASENTRYNAME[] rasEntryNames = new RASENTRYNAME[1];
|
||||
int bufferSize = Marshal.SizeOf(typeof(RASENTRYNAME));
|
||||
rasEntryNames[0].dwSize = Marshal.SizeOf(typeof(RASENTRYNAME));
|
||||
|
||||
uint result = NativeMethods.RasEnumEntries(null, null, rasEntryNames, ref bufferSize, ref entries);
|
||||
// increase buffer if the buffer is not large enough
|
||||
if (result == (uint)ErrorCode.ERROR_BUFFER_TOO_SMALL)
|
||||
{
|
||||
rasEntryNames = new RASENTRYNAME[bufferSize / Marshal.SizeOf(typeof(RASENTRYNAME))];
|
||||
for (int i = 0; i < rasEntryNames.Length; i++)
|
||||
{
|
||||
rasEntryNames[i].dwSize = Marshal.SizeOf(typeof(RASENTRYNAME));
|
||||
}
|
||||
|
||||
result = NativeMethods.RasEnumEntries(null, null, rasEntryNames, ref bufferSize, ref entries);
|
||||
}
|
||||
if (result == 0)
|
||||
{
|
||||
var entryNames = new List<string>();
|
||||
for (int i = 0; i < entries; i++)
|
||||
{
|
||||
entryNames.Add(rasEntryNames[i].szEntryName);
|
||||
}
|
||||
|
||||
return entryNames;
|
||||
}
|
||||
throw new ApplicationException($"RasEnumEntries failed with error code: {result}");
|
||||
}
|
||||
|
||||
#region WinInet structures
|
||||
@@ -145,6 +239,25 @@ namespace v2rayN.Handler
|
||||
[FieldOffset(0)]
|
||||
public IntPtr m_StringPtr;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
public struct RASENTRYNAME
|
||||
{
|
||||
public int dwSize;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = RAS_MaxEntryName + 1)]
|
||||
public string szEntryName;
|
||||
|
||||
public int dwFlags;
|
||||
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = MAX_PATH + 1)]
|
||||
public string szPhonebookPath;
|
||||
}
|
||||
|
||||
// Constants
|
||||
public const int RAS_MaxEntryName = 256;
|
||||
|
||||
public const int MAX_PATH = 260; // Standard MAX_PATH value in Windows
|
||||
}
|
||||
|
||||
#endregion WinInet structures
|
||||
@@ -156,7 +269,9 @@ namespace v2rayN.Handler
|
||||
//
|
||||
public enum InternetOption : uint
|
||||
{
|
||||
INTERNET_OPTION_PER_CONNECTION_OPTION = 75
|
||||
INTERNET_OPTION_PER_CONNECTION_OPTION = 75,
|
||||
INTERNET_OPTION_REFRESH = 37,
|
||||
INTERNET_OPTION_SETTINGS_CHANGED = 39
|
||||
}
|
||||
|
||||
//
|
||||
@@ -182,6 +297,12 @@ namespace v2rayN.Handler
|
||||
PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
|
||||
}
|
||||
|
||||
public enum ErrorCode : uint
|
||||
{
|
||||
ERROR_BUFFER_TOO_SMALL = 603,
|
||||
ERROR_INVALID_SIZE = 632
|
||||
}
|
||||
|
||||
#endregion WinInet enums
|
||||
|
||||
internal static class NativeMethods
|
||||
@@ -189,6 +310,15 @@ namespace v2rayN.Handler
|
||||
[DllImport("WinInet.dll", SetLastError = true, CharSet = CharSet.Auto)]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
public static extern bool InternetSetOption(IntPtr hInternet, InternetOption dwOption, IntPtr lpBuffer, int dwBufferLength);
|
||||
|
||||
[DllImport("Rasapi32.dll", CharSet = CharSet.Auto)]
|
||||
public static extern uint RasEnumEntries(
|
||||
string? reserved, // Reserved, must be null
|
||||
string? lpszPhonebook, // Pointer to full path and filename of phone-book file. If this parameter is NULL, the entries are enumerated from all the remote access phone-book files
|
||||
[In, Out] RASENTRYNAME[]? lprasentryname, // Buffer to receive RAS entry names
|
||||
ref int lpcb, // Size of the buffer
|
||||
ref int lpcEntries // Number of entries written to the buffer
|
||||
);
|
||||
}
|
||||
|
||||
//判断是否使用代理
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace v2rayN.Handler
|
||||
EConfigType.Socks => ShareSocks(item),
|
||||
EConfigType.Trojan => ShareTrojan(item),
|
||||
EConfigType.VLESS => ShareVLESS(item),
|
||||
EConfigType.Hysteria2 => ShareHysteria2(item),
|
||||
EConfigType.Tuic => ShareTuic(item),
|
||||
_ => null,
|
||||
};
|
||||
|
||||
@@ -66,7 +68,7 @@ namespace v2rayN.Handler
|
||||
|
||||
url = Utils.ToJson(vmessQRCode);
|
||||
url = Utils.Base64Encode(url);
|
||||
url = $"{Global.vmessProtocol}{url}";
|
||||
url = $"{Global.ProtocolShares[EConfigType.VMess]}{url}";
|
||||
|
||||
return url;
|
||||
}
|
||||
@@ -89,7 +91,7 @@ namespace v2rayN.Handler
|
||||
//new Sip002
|
||||
var pw = Utils.Base64Encode($"{item.security}:{item.id}");
|
||||
url = $"{pw}@{GetIpv6(item.address)}:{item.port}";
|
||||
url = $"{Global.ssProtocol}{url}{remark}";
|
||||
url = $"{Global.ProtocolShares[EConfigType.Shadowsocks]}{url}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -110,7 +112,7 @@ namespace v2rayN.Handler
|
||||
//new
|
||||
var pw = Utils.Base64Encode($"{item.security}:{item.id}");
|
||||
url = $"{pw}@{GetIpv6(item.address)}:{item.port}";
|
||||
url = $"{Global.socksProtocol}{url}{remark}";
|
||||
url = $"{Global.ProtocolShares[EConfigType.Socks]}{url}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -130,7 +132,7 @@ namespace v2rayN.Handler
|
||||
item.id,
|
||||
GetIpv6(item.address),
|
||||
item.port);
|
||||
url = $"{Global.trojanProtocol}{url}{query}{remark}";
|
||||
url = $"{Global.ProtocolShares[EConfigType.Trojan]}{url}{query}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -158,7 +160,65 @@ namespace v2rayN.Handler
|
||||
item.id,
|
||||
GetIpv6(item.address),
|
||||
item.port);
|
||||
url = $"{Global.vlessProtocol}{url}{query}{remark}";
|
||||
url = $"{Global.ProtocolShares[EConfigType.VLESS]}{url}{query}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
private static string ShareHysteria2(ProfileItem item)
|
||||
{
|
||||
string url = string.Empty;
|
||||
string remark = string.Empty;
|
||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
||||
{
|
||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||
}
|
||||
var dicQuery = new Dictionary<string, string>();
|
||||
if (!Utils.IsNullOrEmpty(item.sni))
|
||||
{
|
||||
dicQuery.Add("sni", item.sni);
|
||||
}
|
||||
if (!Utils.IsNullOrEmpty(item.alpn))
|
||||
{
|
||||
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
||||
}
|
||||
dicQuery.Add("insecure", item.allowInsecure.ToLower() == "true" ? "1" : "0");
|
||||
|
||||
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
|
||||
|
||||
url = string.Format("{0}@{1}:{2}",
|
||||
item.id,
|
||||
GetIpv6(item.address),
|
||||
item.port);
|
||||
url = $"{Global.ProtocolShares[EConfigType.Hysteria2]}{url}{query}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
private static string ShareTuic(ProfileItem item)
|
||||
{
|
||||
string url = string.Empty;
|
||||
string remark = string.Empty;
|
||||
if (!Utils.IsNullOrEmpty(item.remarks))
|
||||
{
|
||||
remark = "#" + Utils.UrlEncode(item.remarks);
|
||||
}
|
||||
var dicQuery = new Dictionary<string, string>();
|
||||
if (!Utils.IsNullOrEmpty(item.sni))
|
||||
{
|
||||
dicQuery.Add("sni", item.sni);
|
||||
}
|
||||
if (!Utils.IsNullOrEmpty(item.alpn))
|
||||
{
|
||||
dicQuery.Add("alpn", Utils.UrlEncode(item.alpn));
|
||||
}
|
||||
dicQuery.Add("congestion_control", item.headerType);
|
||||
|
||||
string query = "?" + string.Join("&", dicQuery.Select(x => x.Key + "=" + x.Value).ToArray());
|
||||
|
||||
url = string.Format("{0}@{1}:{2}",
|
||||
$"{item.id}:{item.security}",
|
||||
GetIpv6(item.address),
|
||||
item.port);
|
||||
url = $"{Global.ProtocolShares[EConfigType.Tuic]}{url}{query}{remark}";
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -299,7 +359,7 @@ namespace v2rayN.Handler
|
||||
return null;
|
||||
}
|
||||
|
||||
if (result.StartsWith(Global.vmessProtocol))
|
||||
if (result.StartsWith(Global.ProtocolShares[EConfigType.VMess]))
|
||||
{
|
||||
int indexSplit = result.IndexOf("?");
|
||||
if (indexSplit > 0)
|
||||
@@ -311,7 +371,7 @@ namespace v2rayN.Handler
|
||||
profileItem = ResolveVmess(result, out msg);
|
||||
}
|
||||
}
|
||||
else if (result.StartsWith(Global.ssProtocol))
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.Shadowsocks]))
|
||||
{
|
||||
msg = ResUI.ConfigurationFormatIncorrect;
|
||||
|
||||
@@ -327,7 +387,7 @@ namespace v2rayN.Handler
|
||||
|
||||
profileItem.configType = EConfigType.Shadowsocks;
|
||||
}
|
||||
else if (result.StartsWith(Global.socksProtocol))
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.Socks]))
|
||||
{
|
||||
msg = ResUI.ConfigurationFormatIncorrect;
|
||||
|
||||
@@ -343,16 +403,26 @@ namespace v2rayN.Handler
|
||||
|
||||
profileItem.configType = EConfigType.Socks;
|
||||
}
|
||||
else if (result.StartsWith(Global.trojanProtocol))
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.Trojan]))
|
||||
{
|
||||
msg = ResUI.ConfigurationFormatIncorrect;
|
||||
|
||||
profileItem = ResolveTrojan(result);
|
||||
}
|
||||
else if (result.StartsWith(Global.vlessProtocol))
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.VLESS]))
|
||||
{
|
||||
profileItem = ResolveStdVLESS(result);
|
||||
}
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.Hysteria2]) || result.StartsWith(Global.Hysteria2ProtocolShare))
|
||||
{
|
||||
msg = ResUI.ConfigurationFormatIncorrect;
|
||||
|
||||
profileItem = ResolveHysteria2(result);
|
||||
}
|
||||
else if (result.StartsWith(Global.ProtocolShares[EConfigType.Tuic]))
|
||||
{
|
||||
profileItem = ResolveTuic(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = ResUI.NonvmessOrssProtocol;
|
||||
@@ -377,7 +447,7 @@ namespace v2rayN.Handler
|
||||
configType = EConfigType.VMess
|
||||
};
|
||||
|
||||
result = result[Global.vmessProtocol.Length..];
|
||||
result = result[Global.ProtocolShares[EConfigType.VMess].Length..];
|
||||
result = Utils.Base64Decode(result);
|
||||
|
||||
//转成Json
|
||||
@@ -425,7 +495,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
configType = EConfigType.VMess
|
||||
};
|
||||
result = result[Global.vmessProtocol.Length..];
|
||||
result = result[Global.ProtocolShares[EConfigType.VMess].Length..];
|
||||
int indexSplit = result.IndexOf("?");
|
||||
if (indexSplit > 0)
|
||||
{
|
||||
@@ -642,7 +712,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
configType = EConfigType.Socks
|
||||
};
|
||||
result = result[Global.socksProtocol.Length..];
|
||||
result = result[Global.ProtocolShares[EConfigType.Socks].Length..];
|
||||
//remark
|
||||
int indexRemark = result.IndexOf("#");
|
||||
if (indexRemark > 0)
|
||||
@@ -758,6 +828,53 @@ namespace v2rayN.Handler
|
||||
return item;
|
||||
}
|
||||
|
||||
private static ProfileItem ResolveHysteria2(string result)
|
||||
{
|
||||
ProfileItem item = new()
|
||||
{
|
||||
configType = EConfigType.Hysteria2
|
||||
};
|
||||
|
||||
Uri url = new(result);
|
||||
|
||||
item.address = url.IdnHost;
|
||||
item.port = url.Port;
|
||||
item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
item.id = url.UserInfo;
|
||||
|
||||
var query = HttpUtility.ParseQueryString(url.Query);
|
||||
ResolveStdTransport(query, ref item);
|
||||
item.allowInsecure = (query["insecure"] ?? "") == "1" ? "true" : "false";
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static ProfileItem ResolveTuic(string result)
|
||||
{
|
||||
ProfileItem item = new()
|
||||
{
|
||||
configType = EConfigType.Tuic
|
||||
};
|
||||
|
||||
Uri url = new(result);
|
||||
|
||||
item.address = url.IdnHost;
|
||||
item.port = url.Port;
|
||||
item.remarks = url.GetComponents(UriComponents.Fragment, UriFormat.Unescaped);
|
||||
var userInfoParts = url.UserInfo.Split(new[] { ':' }, 2);
|
||||
if (userInfoParts.Length == 2)
|
||||
{
|
||||
item.id = userInfoParts[0];
|
||||
item.security = userInfoParts[1];
|
||||
}
|
||||
|
||||
var query = HttpUtility.ParseQueryString(url.Query);
|
||||
ResolveStdTransport(query, ref item);
|
||||
item.headerType = query["congestion_control"] ?? "";
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
private static int ResolveStdTransport(NameValueCollection query, ref ProfileItem item)
|
||||
{
|
||||
item.flow = query["flow"] ?? "";
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
string msg = string.Empty;
|
||||
|
||||
pid = _coreHandler.LoadCoreConfigString(_selecteds);
|
||||
pid = _coreHandler.LoadCoreConfigSpeedtest(_selecteds);
|
||||
if (pid < 0)
|
||||
{
|
||||
UpdateFunc("", ResUI.FailedToRunCore);
|
||||
@@ -196,7 +196,10 @@ namespace v2rayN.Handler
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (pid > 0) _coreHandler.CoreStopPid(pid);
|
||||
if (pid > 0)
|
||||
{
|
||||
_coreHandler.CoreStopPid(pid);
|
||||
}
|
||||
ProfileExHandler.Instance.SaveTo();
|
||||
}
|
||||
|
||||
@@ -211,7 +214,7 @@ namespace v2rayN.Handler
|
||||
// _selecteds = _selecteds.OrderBy(t => t.delay).ToList();
|
||||
//}
|
||||
|
||||
pid = _coreHandler.LoadCoreConfigString(_selecteds);
|
||||
pid = _coreHandler.LoadCoreConfigSpeedtest(_selecteds);
|
||||
if (pid < 0)
|
||||
{
|
||||
UpdateFunc("", ResUI.FailedToRunCore);
|
||||
@@ -268,7 +271,7 @@ namespace v2rayN.Handler
|
||||
private async Task RunSpeedTestMulti()
|
||||
{
|
||||
int pid = -1;
|
||||
pid = _coreHandler.LoadCoreConfigString(_selecteds);
|
||||
pid = _coreHandler.LoadCoreConfigSpeedtest(_selecteds);
|
||||
if (pid < 0)
|
||||
{
|
||||
UpdateFunc("", ResUI.FailedToRunCore);
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace v2rayN.Handler
|
||||
_updateFunc = update;
|
||||
|
||||
Init();
|
||||
Global.statePort = GetFreePort();
|
||||
Global.StatePort = GetFreePort();
|
||||
|
||||
_statisticsV2Ray = new StatisticsV2ray(config, UpdateServerStat);
|
||||
_statisticsSingbox = new StatisticsSingbox(config, UpdateServerStat);
|
||||
@@ -143,14 +143,12 @@ namespace v2rayN.Handler
|
||||
{
|
||||
return defaultPort;
|
||||
}
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
TcpListener l = new(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int port = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return port;
|
||||
}
|
||||
|
||||
TcpListener l = new(IPAddress.Loopback, 0);
|
||||
l.Start();
|
||||
int port = ((IPEndPoint)l.LocalEndpoint).Port;
|
||||
l.Stop();
|
||||
return port;
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace v2rayN.Handler
|
||||
|
||||
try
|
||||
{
|
||||
url = $"ws://{Global.Loopback}:{Global.statePort}/traffic";
|
||||
url = $"ws://{Global.Loopback}:{Global.StatePort}/traffic";
|
||||
|
||||
if (webSocket == null)
|
||||
{
|
||||
|
||||
@@ -8,8 +8,8 @@ namespace v2rayN.Handler
|
||||
internal class StatisticsV2ray
|
||||
{
|
||||
private Mode.Config _config;
|
||||
private GrpcChannel _channel;
|
||||
private StatsService.StatsServiceClient _client;
|
||||
private GrpcChannel? _channel;
|
||||
private StatsService.StatsServiceClient? _client;
|
||||
private bool _exitFlag;
|
||||
private Action<ServerSpeedItem> _updateFunc;
|
||||
|
||||
@@ -26,10 +26,17 @@ namespace v2rayN.Handler
|
||||
|
||||
private void GrpcInit()
|
||||
{
|
||||
if (_channel == null)
|
||||
if (_channel is null)
|
||||
{
|
||||
_channel = GrpcChannel.ForAddress($"{Global.httpProtocol}{Global.Loopback}:{Global.statePort}");
|
||||
_client = new StatsService.StatsServiceClient(_channel);
|
||||
try
|
||||
{
|
||||
_channel = GrpcChannel.ForAddress($"{Global.HttpProtocol}{Global.Loopback}:{Global.StatePort}");
|
||||
_client = new StatsService.StatsServiceClient(_channel);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,7 +51,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_channel.State == ConnectivityState.Ready)
|
||||
if (_channel?.State == ConnectivityState.Ready)
|
||||
{
|
||||
QueryStatsResponse? res = null;
|
||||
try
|
||||
@@ -87,7 +94,7 @@ namespace v2rayN.Handler
|
||||
name = nStr[1];
|
||||
type = nStr[3];
|
||||
|
||||
if (name == Global.agentTag)
|
||||
if (name == Global.ProxyTag)
|
||||
{
|
||||
if (type == "uplink")
|
||||
{
|
||||
@@ -98,7 +105,7 @@ namespace v2rayN.Handler
|
||||
server.proxyDown = value;
|
||||
}
|
||||
}
|
||||
else if (name == Global.directTag)
|
||||
else if (name == Global.DirectTag)
|
||||
{
|
||||
if (type == "uplink")
|
||||
{
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
using PacLib;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using v2rayN.Mode;
|
||||
using v2rayN.Properties;
|
||||
using v2rayN.Tool;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
{
|
||||
@@ -20,7 +15,6 @@ namespace v2rayN.Handler
|
||||
// <proxy-server><CR-LF>
|
||||
// <bypass-list><CR-LF>
|
||||
// <pac-url>
|
||||
private static SysproxyConfig? _userSettings = null;
|
||||
|
||||
private enum RET_ERRORS : int
|
||||
{
|
||||
@@ -34,15 +28,6 @@ namespace v2rayN.Handler
|
||||
|
||||
static SysProxyHandle()
|
||||
{
|
||||
try
|
||||
{
|
||||
FileManager.UncompressFile(Utils.GetTempPath("sysproxy.exe"),
|
||||
Environment.Is64BitOperatingSystem ? Resources.sysproxy64_exe : Resources.sysproxy_exe);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static bool UpdateSysProxy(Config config, bool forceDisable)
|
||||
@@ -79,13 +64,11 @@ namespace v2rayN.Handler
|
||||
.Replace("{http_port}", port.ToString())
|
||||
.Replace("{socks_port}", portSocks.ToString());
|
||||
}
|
||||
ProxySetting.SetProxy(strProxy, strExceptions, 2);
|
||||
SetIEProxy(true, strProxy, strExceptions);
|
||||
ProxySetting.SetProxy(strProxy, strExceptions, 2); // set a named proxy
|
||||
}
|
||||
else if (type == ESysProxyType.ForcedClear)
|
||||
{
|
||||
ProxySetting.UnsetProxy();
|
||||
ResetIEProxy();
|
||||
ProxySetting.UnsetProxy(); // set to no proxy
|
||||
}
|
||||
else if (type == ESysProxyType.Unchanged)
|
||||
{
|
||||
@@ -93,9 +76,8 @@ namespace v2rayN.Handler
|
||||
else if (type == ESysProxyType.Pac)
|
||||
{
|
||||
PacHandler.Start(Utils.GetConfigPath(), port, portPac);
|
||||
var strProxy = $"{Global.httpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
|
||||
ProxySetting.SetProxy(strProxy, "", 4);
|
||||
SetIEProxy(false, strProxy, "");
|
||||
var strProxy = $"{Global.HttpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
|
||||
ProxySetting.SetProxy(strProxy, "", 4); // use pac script url for auto-config proxy
|
||||
}
|
||||
|
||||
if (type != ESysProxyType.Pac)
|
||||
@@ -121,102 +103,5 @@ namespace v2rayN.Handler
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetIEProxy(bool global, string strProxy, string strExceptions)
|
||||
{
|
||||
string arguments = global
|
||||
? $"global {strProxy} {strExceptions}"
|
||||
: $"pac {strProxy}";
|
||||
|
||||
ExecSysproxy(arguments);
|
||||
}
|
||||
|
||||
// set system proxy to 1 (null) (null) (null)
|
||||
public static void ResetIEProxy()
|
||||
{
|
||||
ExecSysproxy("set 1 - - -");
|
||||
}
|
||||
|
||||
private static void ExecSysproxy(string arguments)
|
||||
{
|
||||
// using event to avoid hanging when redirect standard output/error
|
||||
// ref: https://stackoverflow.com/questions/139593/processstartinfo-hanging-on-waitforexit-why
|
||||
// and http://blog.csdn.net/zhangweixing0/article/details/7356841
|
||||
using AutoResetEvent outputWaitHandle = new(false);
|
||||
using AutoResetEvent errorWaitHandle = new(false);
|
||||
using Process process = new();
|
||||
|
||||
// Configure the process using the StartInfo properties.
|
||||
process.StartInfo.FileName = Utils.GetTempPath("sysproxy.exe");
|
||||
process.StartInfo.Arguments = arguments;
|
||||
process.StartInfo.WorkingDirectory = Utils.GetTempPath();
|
||||
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
process.StartInfo.RedirectStandardError = true;
|
||||
process.StartInfo.RedirectStandardOutput = true;
|
||||
|
||||
// Need to provide encoding info, or output/error strings we got will be wrong.
|
||||
process.StartInfo.StandardOutputEncoding = Encoding.Unicode;
|
||||
process.StartInfo.StandardErrorEncoding = Encoding.Unicode;
|
||||
|
||||
process.StartInfo.CreateNoWindow = true;
|
||||
|
||||
StringBuilder output = new(1024);
|
||||
StringBuilder error = new(1024);
|
||||
|
||||
process.OutputDataReceived += (sender, e) =>
|
||||
{
|
||||
if (e.Data == null)
|
||||
{
|
||||
outputWaitHandle.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
output.AppendLine(e.Data);
|
||||
}
|
||||
};
|
||||
process.ErrorDataReceived += (sender, e) =>
|
||||
{
|
||||
if (e.Data == null)
|
||||
{
|
||||
errorWaitHandle.Set();
|
||||
}
|
||||
else
|
||||
{
|
||||
error.AppendLine(e.Data);
|
||||
}
|
||||
};
|
||||
try
|
||||
{
|
||||
process.Start();
|
||||
|
||||
process.BeginErrorReadLine();
|
||||
process.BeginOutputReadLine();
|
||||
|
||||
process.WaitForExit();
|
||||
}
|
||||
catch (System.ComponentModel.Win32Exception e)
|
||||
{
|
||||
// log the arguments
|
||||
throw new Exception(process.StartInfo.Arguments);
|
||||
}
|
||||
string stderr = error.ToString();
|
||||
string stdout = output.ToString();
|
||||
|
||||
int exitCode = process.ExitCode;
|
||||
if (exitCode != (int)RET_ERRORS.RET_NO_ERROR)
|
||||
{
|
||||
throw new Exception(stderr);
|
||||
}
|
||||
|
||||
//if (arguments == "query")
|
||||
//{
|
||||
// if (stdout.IsNullOrWhiteSpace() || stdout.IsNullOrEmpty())
|
||||
// {
|
||||
// throw new Exception("failed to query wininet settings");
|
||||
// }
|
||||
// _queryStr = stdout;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,13 @@ namespace v2rayN.Handler
|
||||
{
|
||||
public bool Success;
|
||||
public string Msg;
|
||||
public string Url;
|
||||
|
||||
public ResultEventArgs(bool success, string msg)
|
||||
public ResultEventArgs(bool success, string msg, string url = "")
|
||||
{
|
||||
Success = success;
|
||||
Msg = msg;
|
||||
Url = url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,8 +85,9 @@ namespace v2rayN.Handler
|
||||
if (args.Success)
|
||||
{
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "v2rayN"));
|
||||
_updateFunc(false, args.Msg);
|
||||
|
||||
url = args.Msg;
|
||||
url = args.Url;
|
||||
_ = askToDownload(downloadHandle, url, true);
|
||||
}
|
||||
else
|
||||
@@ -135,7 +138,9 @@ namespace v2rayN.Handler
|
||||
if (args.Success)
|
||||
{
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "Core"));
|
||||
url = args.Msg;
|
||||
_updateFunc(false, args.Msg);
|
||||
|
||||
url = args.Url;
|
||||
_ = askToDownload(downloadHandle, url, true);
|
||||
}
|
||||
else
|
||||
@@ -175,7 +180,7 @@ namespace v2rayN.Handler
|
||||
//_updateFunc(false, $"{hashCode}{ResUI.MsgNoValidSubscription}");
|
||||
continue;
|
||||
}
|
||||
if (!url.StartsWith(Global.httpsProtocol) && !url.StartsWith(Global.httpProtocol))
|
||||
if (!url.StartsWith(Global.HttpsProtocol) && !url.StartsWith(Global.HttpProtocol))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -266,7 +271,7 @@ namespace v2rayN.Handler
|
||||
_updateFunc(false, $"{hashCode}{result}");
|
||||
}
|
||||
|
||||
int ret = ConfigHandler.AddBatchServers(ref config, result, id, true);
|
||||
int ret = ConfigHandler.AddBatchServers(config, result, id, true);
|
||||
if (ret <= 0)
|
||||
{
|
||||
Utils.SaveLog("FailedImportSubscription");
|
||||
@@ -291,8 +296,8 @@ namespace v2rayN.Handler
|
||||
await UpdateGeoFile("geosite", _config, update);
|
||||
await UpdateGeoFile("geoip", _config, update);
|
||||
|
||||
await UpdateGeoFile4Singbox("geosite", _config, false, update);
|
||||
await UpdateGeoFile4Singbox("geoip", _config, true, update);
|
||||
//await UpdateGeoFile4Singbox("geosite", _config, false, update);
|
||||
//await UpdateGeoFile4Singbox("geoip", _config, true, update);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -405,15 +410,10 @@ namespace v2rayN.Handler
|
||||
try
|
||||
{
|
||||
var gitHubReleases = Utils.FromJson<List<GitHubRelease>>(gitHubReleaseApi);
|
||||
SemanticVersion version;
|
||||
if (preRelease)
|
||||
{
|
||||
version = new SemanticVersion(gitHubReleases!.First().TagName);
|
||||
}
|
||||
else
|
||||
{
|
||||
version = new SemanticVersion(gitHubReleases!.First(r => r.Prerelease == false).TagName);
|
||||
}
|
||||
var gitHubRelease = preRelease ? gitHubReleases!.First() : gitHubReleases!.First(r => r.Prerelease == false);
|
||||
var version = new SemanticVersion(gitHubRelease!.TagName);
|
||||
var body = gitHubRelease!.Body;
|
||||
|
||||
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
|
||||
|
||||
SemanticVersion curVersion;
|
||||
@@ -427,7 +427,7 @@ namespace v2rayN.Handler
|
||||
case ECoreType.v2fly_v5:
|
||||
{
|
||||
curVersion = getCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, curVersion.ToVersionString("v"));
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||
string osBit = "64";
|
||||
switch (RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
@@ -451,7 +451,7 @@ namespace v2rayN.Handler
|
||||
case ECoreType.clash_meta:
|
||||
{
|
||||
curVersion = getCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, curVersion);
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
||||
switch (RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
case Architecture.Arm64:
|
||||
@@ -472,7 +472,7 @@ namespace v2rayN.Handler
|
||||
case ECoreType.sing_box:
|
||||
{
|
||||
curVersion = getCoreVersion(type);
|
||||
message = string.Format(ResUI.IsLatestCore, curVersion.ToVersionString("v"));
|
||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||
switch (RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
case Architecture.Arm64:
|
||||
@@ -493,7 +493,7 @@ namespace v2rayN.Handler
|
||||
case ECoreType.v2rayN:
|
||||
{
|
||||
curVersion = new SemanticVersion(FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString());
|
||||
message = string.Format(ResUI.IsLatestN, curVersion);
|
||||
message = string.Format(ResUI.IsLatestN, type, curVersion);
|
||||
switch (RuntimeInformation.ProcessArchitecture)
|
||||
{
|
||||
case Architecture.Arm64:
|
||||
@@ -520,7 +520,7 @@ namespace v2rayN.Handler
|
||||
return;
|
||||
}
|
||||
|
||||
AbsoluteCompleted?.Invoke(this, new ResultEventArgs(true, url));
|
||||
AbsoluteCompleted?.Invoke(this, new ResultEventArgs(true, body, url));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -553,7 +553,7 @@ namespace v2rayN.Handler
|
||||
{
|
||||
_config = config;
|
||||
_updateFunc = update;
|
||||
var url = string.Format(Global.geoUrl, geoName);
|
||||
var url = string.Format(Global.GeoUrl, geoName);
|
||||
|
||||
DownloadHandle downloadHandle = new();
|
||||
downloadHandle.UpdateCompleted += (sender2, args) =>
|
||||
@@ -600,10 +600,10 @@ namespace v2rayN.Handler
|
||||
{
|
||||
_config = config;
|
||||
_updateFunc = update;
|
||||
var url = string.Format(Global.singboxGeoUrl, geoName);
|
||||
var url = string.Format(Global.SingboxGeoUrl, geoName);
|
||||
|
||||
DownloadHandle downloadHandle = new();
|
||||
downloadHandle.UpdateCompleted += (sender2, args) =>
|
||||
downloadHandle.UpdateCompleted += async (sender2, args) =>
|
||||
{
|
||||
if (args.Success)
|
||||
{
|
||||
@@ -612,8 +612,11 @@ namespace v2rayN.Handler
|
||||
|
||||
try
|
||||
{
|
||||
if (needStop) coreHandler?.CoreStop();
|
||||
Task.Delay(1000);
|
||||
if (needStop)
|
||||
{
|
||||
coreHandler?.CoreStop();
|
||||
await Task.Delay(3000);
|
||||
}
|
||||
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
|
||||
@@ -27,7 +27,8 @@
|
||||
public UIItem uiItem { get; set; }
|
||||
public ConstItem constItem { get; set; }
|
||||
public SpeedTestItem speedTestItem { get; set; }
|
||||
public Mux4Sbox mux4Sbox { get; set; }
|
||||
public Mux4SboxItem mux4SboxItem { get; set; }
|
||||
public HysteriaItem hysteriaItem { get; set; }
|
||||
public List<InItem> inbound { get; set; }
|
||||
public List<KeyEventItem> globalHotkeys { get; set; }
|
||||
public List<CoreTypeItem> coreTypeItem { get; set; }
|
||||
|
||||
@@ -164,6 +164,7 @@ namespace v2rayN.Mode
|
||||
public string stack { get; set; }
|
||||
public int mtu { get; set; }
|
||||
public bool enableExInbound { get; set; }
|
||||
public bool enableIPv6Address { get; set; } = true;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
@@ -198,7 +199,7 @@ namespace v2rayN.Mode
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Mux4Sbox
|
||||
public class Mux4SboxItem
|
||||
{
|
||||
public string protocol { get; set; }
|
||||
public int max_connections { get; set; }
|
||||
@@ -206,4 +207,11 @@ namespace v2rayN.Mode
|
||||
public int max_streams { get; set; }
|
||||
public bool padding { get; set; }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class HysteriaItem
|
||||
{
|
||||
public int up_mbps { get; set; }
|
||||
public int down_mbps { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ namespace v2rayN.Mode
|
||||
public string remarks { get; set; }
|
||||
public bool enabled { get; set; } = true;
|
||||
public ECoreType coreType { get; set; }
|
||||
public bool useSystemHosts { get; set; }
|
||||
public string? normalDNS { get; set; }
|
||||
public string? tunDNS { get; set; }
|
||||
public string? domainStrategy4Freedom { get; set; }
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
Shadowsocks = 3,
|
||||
Socks = 4,
|
||||
VLESS = 5,
|
||||
Trojan = 6
|
||||
Trojan = 6,
|
||||
Hysteria2 = 7,
|
||||
Tuic = 8
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,13 @@
|
||||
v2fly_v5 = 4,
|
||||
clash = 11,
|
||||
clash_meta = 12,
|
||||
mihomo = 13,
|
||||
hysteria = 21,
|
||||
naiveproxy = 22,
|
||||
tuic = 23,
|
||||
sing_box = 24,
|
||||
juicity = 25,
|
||||
hysteria2 = 26,
|
||||
v2rayN = 99
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,8 @@ namespace v2rayN.Mode
|
||||
case EConfigType.Socks:
|
||||
case EConfigType.VLESS:
|
||||
case EConfigType.Trojan:
|
||||
case EConfigType.Hysteria2:
|
||||
case EConfigType.Tuic:
|
||||
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
|
||||
break;
|
||||
|
||||
@@ -77,7 +79,7 @@ namespace v2rayN.Mode
|
||||
|
||||
public string GetNetwork()
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(network) || !Global.networks.Contains(network))
|
||||
if (Utils.IsNullOrEmpty(network) || !Global.Networks.Contains(network))
|
||||
{
|
||||
return Global.DefaultNetwork;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
public string? domain_strategy { get; set; }
|
||||
public string interface_name { get; set; }
|
||||
public string inet4_address { get; set; }
|
||||
public string inet6_address { get; set; }
|
||||
public string? inet6_address { get; set; }
|
||||
public int? mtu { get; set; }
|
||||
public bool? auto_route { get; set; }
|
||||
public bool? strict_route { get; set; }
|
||||
@@ -105,10 +105,11 @@
|
||||
public int? recv_window_conn { get; set; }
|
||||
public int? recv_window { get; set; }
|
||||
public bool? disable_mtu_discovery { get; set; }
|
||||
public string detour { get; set; }
|
||||
public string? detour { get; set; }
|
||||
public string method { get; set; }
|
||||
public string username { get; set; }
|
||||
public string password { get; set; }
|
||||
public string congestion_control { get; set; }
|
||||
public string? version { get; set; }
|
||||
public string? network { get; set; }
|
||||
public string packet_encoding { get; set; }
|
||||
@@ -179,8 +180,9 @@
|
||||
|
||||
public class Experimental4Sbox
|
||||
{
|
||||
public V2ray_Api4Sbox v2ray_api { get; set; }
|
||||
public Clash_Api4Sbox clash_api { get; set; }
|
||||
public CacheFile4Sbox? cache_file { get; set; }
|
||||
public V2ray_Api4Sbox? v2ray_api { get; set; }
|
||||
public Clash_Api4Sbox? clash_api { get; set; }
|
||||
}
|
||||
|
||||
public class V2ray_Api4Sbox
|
||||
@@ -191,8 +193,8 @@
|
||||
|
||||
public class Clash_Api4Sbox
|
||||
{
|
||||
public string external_controller { get; set; }
|
||||
public bool store_selected { get; set; }
|
||||
public string? external_controller { get; set; }
|
||||
public bool? store_selected { get; set; }
|
||||
}
|
||||
|
||||
public class Stats4Sbox
|
||||
@@ -209,4 +211,12 @@
|
||||
public string inet4_range { get; set; }
|
||||
public string inet6_range { get; set; }
|
||||
}
|
||||
|
||||
public class CacheFile4Sbox
|
||||
{
|
||||
public bool enabled { get; set; }
|
||||
public string? path { get; set; }
|
||||
public string? cache_id { get; set; }
|
||||
public bool? store_fakeip { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -27,5 +27,9 @@ namespace v2rayN.Mode
|
||||
public long updateTime { get; set; }
|
||||
|
||||
public string? convertTarget { get; set; }
|
||||
|
||||
public string? prevProfile { get; set; }
|
||||
|
||||
public string? nextProfile { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -451,6 +451,11 @@ namespace v2rayN.Mode
|
||||
/// grpc
|
||||
/// </summary>
|
||||
public GrpcSettings4Ray grpcSettings { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// sockopt
|
||||
/// </summary>
|
||||
public Sockopt4Ray? sockopt { get; set; }
|
||||
}
|
||||
|
||||
public class TlsSettings4Ray
|
||||
@@ -632,4 +637,9 @@ namespace v2rayN.Mode
|
||||
/// </summary>
|
||||
public string pass { get; set; }
|
||||
}
|
||||
|
||||
public class Sockopt4Ray
|
||||
{
|
||||
public string? dialerProxy { get; set; }
|
||||
}
|
||||
}
|
||||
20
v2rayN/v2rayN/Properties/Resources.Designer.cs
generated
20
v2rayN/v2rayN/Properties/Resources.Designer.cs
generated
@@ -219,25 +219,5 @@ namespace v2rayN.Properties {
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Byte[] 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static byte[] sysproxy_exe {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("sysproxy_exe", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找 System.Byte[] 类型的本地化资源。
|
||||
/// </summary>
|
||||
internal static byte[] sysproxy64_exe {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("sysproxy64_exe", resourceCulture);
|
||||
return ((byte[])(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,12 +118,6 @@
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="sysproxy_exe" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\sysproxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="sysproxy64_exe" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\resources\sysproxy64.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</data>
|
||||
<data name="NotifyIcon1" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\NotifyIcon1.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
122
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
122
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
@@ -169,7 +169,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Failed to get the default configuration 的本地化字符串。
|
||||
/// 查找类似 Failed to get the default configuration 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string FailedGetDefaultConfiguration {
|
||||
get {
|
||||
@@ -286,7 +286,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 is not the correct client configuration file, please check 的本地化字符串。
|
||||
/// 查找类似 Is not the correct client configuration file, please check 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string IncorrectClientConfiguration {
|
||||
get {
|
||||
@@ -295,7 +295,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 is not the correct configuration, please check 的本地化字符串。
|
||||
/// 查找类似 Is not the correct configuration, please check 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Incorrectconfiguration {
|
||||
get {
|
||||
@@ -304,7 +304,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 is not the correct server configuration file, please check 的本地化字符串。
|
||||
/// 查找类似 Is not the correct server configuration file, please check 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string IncorrectServerConfiguration {
|
||||
get {
|
||||
@@ -322,7 +322,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} already up to date. 的本地化字符串。
|
||||
/// 查找类似 {0} {1} already up to date. 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string IsLatestCore {
|
||||
get {
|
||||
@@ -331,7 +331,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} already up to date. 的本地化字符串。
|
||||
/// 查找类似 {0} {1} already up to date. 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string IsLatestN {
|
||||
get {
|
||||
@@ -447,6 +447,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Next proxy remarks 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LvNextProfile {
|
||||
get {
|
||||
return ResourceManager.GetString("LvNextProfile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Port 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -456,6 +465,24 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Previous proxy remakrs 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LvPrevProfile {
|
||||
get {
|
||||
return ResourceManager.GetString("LvPrevProfile", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Please make sure the remarks exists and is unique 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string LvPrevProfileTip {
|
||||
get {
|
||||
return ResourceManager.GetString("LvPrevProfileTip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Remarks 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -591,6 +618,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Add [Trojan] server 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string menuAddHysteria2Server {
|
||||
get {
|
||||
return ResourceManager.GetString("menuAddHysteria2Server", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Import bulk URL from clipboard (Ctrl+V) 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -636,6 +672,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Add [Tuic] server 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string menuAddTuicServer {
|
||||
get {
|
||||
return ResourceManager.GetString("menuAddTuicServer", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Add [VLESS] server 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1474,7 +1519,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 is unpacking... 的本地化字符串。
|
||||
/// 查找类似 Is unpacking...... 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string MsgUnpacking {
|
||||
get {
|
||||
@@ -1528,7 +1573,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 non-standard service, this feature is invalid 的本地化字符串。
|
||||
/// 查找类似 Non-standard service, this feature is invalid 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string NonVmessService {
|
||||
get {
|
||||
@@ -1564,7 +1609,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 operation failed, please check and retry 的本地化字符串。
|
||||
/// 查找类似 Operation failed, please check and retry 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string OperationFailed {
|
||||
get {
|
||||
@@ -1699,7 +1744,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0}:{1}/s↑ | {2}/s↓ 的本地化字符串。
|
||||
/// 查找类似 {0} : {1}/s↑ | {2}/s↓ 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SpeedDisplayText {
|
||||
get {
|
||||
@@ -1735,7 +1780,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Waiting for testing 的本地化字符串。
|
||||
/// 查找类似 Waiting for testing...... 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SpeedtestingWait {
|
||||
get {
|
||||
@@ -1772,7 +1817,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Custom configuration server imported successfully. 的本地化字符串。
|
||||
/// 查找类似 Custom configuration server imported successfully 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SuccessfullyImportedCustomServer {
|
||||
get {
|
||||
@@ -1781,7 +1826,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 {0} servers have been imported from clipboard. 的本地化字符串。
|
||||
/// 查找类似 {0} servers have been imported from clipboard 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SuccessfullyImportedServerViaClipboard {
|
||||
get {
|
||||
@@ -2050,6 +2095,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Congestion control 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbHeaderType8 {
|
||||
get {
|
||||
return ResourceManager.GetString("TbHeaderType8", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 UUID(id) 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -2296,9 +2350,9 @@ namespace v2rayN.Resx {
|
||||
/// <summary>
|
||||
/// 查找类似 Click to import default DNS config 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TBSettingDnsImportDefConfig {
|
||||
public static string TbSettingDnsImportDefConfig {
|
||||
get {
|
||||
return ResourceManager.GetString("TBSettingDnsImportDefConfig", resourceCulture);
|
||||
return ResourceManager.GetString("TbSettingDnsImportDefConfig", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2411,7 +2465,7 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Copy the font TTF file to the directory guiFonts, restart the settings 的本地化字符串。
|
||||
/// 查找类似 Copy the font TTF/TTC file to the directory guiFonts, restart the settings 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsCurrentFontFamilyTip {
|
||||
get {
|
||||
@@ -2500,6 +2554,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Enable additional Inbound 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsEnableExInbound {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsEnableExInbound", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Enable hardware acceleration(Require restart) 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -2509,6 +2572,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Enable IPv6 Address 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsEnableIPv6Address {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsEnableIPv6Address", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Exception 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -2554,6 +2626,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Hysteria Max bandwidth (Up/Dw) 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsHysteriaBandwidth {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsHysteriaBandwidth", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Ignore Geo files when updating core 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -2887,6 +2968,15 @@ namespace v2rayN.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Use System Hosts 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsUseSystemHosts {
|
||||
get {
|
||||
return ResourceManager.GetString("TbSettingsUseSystemHosts", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 ShortId 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -187,10 +187,10 @@
|
||||
<value>پیکربندی اولیه</value>
|
||||
</data>
|
||||
<data name="IsLatestCore" xml:space="preserve">
|
||||
<value>{0} در حال حاضر به روز است.</value>
|
||||
<value>{0} {1} در حال حاضر به روز است.</value>
|
||||
</data>
|
||||
<data name="IsLatestN" xml:space="preserve">
|
||||
<value>{0} در حال حاضر به روز است.</value>
|
||||
<value>{0} {1} در حال حاضر به روز است.</value>
|
||||
</data>
|
||||
<data name="LvAddress" xml:space="preserve">
|
||||
<value>آدرس</value>
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
<value>Failed to generate default configuration file</value>
|
||||
</data>
|
||||
<data name="FailedGetDefaultConfiguration" xml:space="preserve">
|
||||
<value> Failed to get the default configuration</value>
|
||||
<value>Failed to get the default configuration</value>
|
||||
</data>
|
||||
<data name="FailedImportedCustomServer" xml:space="preserve">
|
||||
<value>Failed to import custom configuration server</value>
|
||||
@@ -175,22 +175,22 @@
|
||||
<value>Please fill in the user ID</value>
|
||||
</data>
|
||||
<data name="IncorrectClientConfiguration" xml:space="preserve">
|
||||
<value> is not the correct client configuration file, please check</value>
|
||||
<value>Is not the correct client configuration file, please check</value>
|
||||
</data>
|
||||
<data name="Incorrectconfiguration" xml:space="preserve">
|
||||
<value> is not the correct configuration, please check</value>
|
||||
<value>Is not the correct configuration, please check</value>
|
||||
</data>
|
||||
<data name="IncorrectServerConfiguration" xml:space="preserve">
|
||||
<value> is not the correct server configuration file, please check</value>
|
||||
<value>Is not the correct server configuration file, please check</value>
|
||||
</data>
|
||||
<data name="InitialConfiguration" xml:space="preserve">
|
||||
<value>Initial Configuration</value>
|
||||
</data>
|
||||
<data name="IsLatestCore" xml:space="preserve">
|
||||
<value>{0} already up to date.</value>
|
||||
<value>{0} {1} already up to date.</value>
|
||||
</data>
|
||||
<data name="IsLatestN" xml:space="preserve">
|
||||
<value>{0} already up to date.</value>
|
||||
<value>{0} {1} already up to date.</value>
|
||||
</data>
|
||||
<data name="LvAddress" xml:space="preserve">
|
||||
<value>Address</value>
|
||||
@@ -250,7 +250,7 @@
|
||||
<value>Invalid subscription content</value>
|
||||
</data>
|
||||
<data name="MsgUnpacking" xml:space="preserve">
|
||||
<value>is unpacking...</value>
|
||||
<value>Is unpacking......</value>
|
||||
</data>
|
||||
<data name="MsgUpdateSubscriptionEnd" xml:space="preserve">
|
||||
<value>Update subscription end</value>
|
||||
@@ -268,7 +268,7 @@
|
||||
<value>Non-VMess or ss protocol</value>
|
||||
</data>
|
||||
<data name="NonVmessService" xml:space="preserve">
|
||||
<value> non-standard service, this feature is invalid</value>
|
||||
<value>Non-standard service, this feature is invalid</value>
|
||||
</data>
|
||||
<data name="NotFoundCore" xml:space="preserve">
|
||||
<value>The Core file (file name: {1}) was not found under the folder ({0}), please download and put it in the folder, download address: {2}</value>
|
||||
@@ -277,7 +277,7 @@
|
||||
<value>Scan completed, no valid QR code found</value>
|
||||
</data>
|
||||
<data name="OperationFailed" xml:space="preserve">
|
||||
<value> operation failed, please check and retry</value>
|
||||
<value>Operation failed, please check and retry</value>
|
||||
</data>
|
||||
<data name="PleaseFillRemarks" xml:space="preserve">
|
||||
<value>Please Fill Remarks</value>
|
||||
@@ -308,10 +308,10 @@
|
||||
{0}</value>
|
||||
</data>
|
||||
<data name="SuccessfullyImportedCustomServer" xml:space="preserve">
|
||||
<value>Custom configuration server imported successfully.</value>
|
||||
<value>Custom configuration server imported successfully</value>
|
||||
</data>
|
||||
<data name="SuccessfullyImportedServerViaClipboard" xml:space="preserve">
|
||||
<value>{0} servers have been imported from clipboard.</value>
|
||||
<value>{0} servers have been imported from clipboard</value>
|
||||
</data>
|
||||
<data name="SuccessfullyImportedServerViaScan" xml:space="preserve">
|
||||
<value>Scan import URL successfully</value>
|
||||
@@ -1037,7 +1037,7 @@
|
||||
<value>FontFamily(Require restart)</value>
|
||||
</data>
|
||||
<data name="TbSettingsCurrentFontFamilyTip" xml:space="preserve">
|
||||
<value>Copy the font TTF file to the directory guiFonts, restart the settings</value>
|
||||
<value>Copy the font TTF/TTC file to the directory guiFonts, restart the settings</value>
|
||||
</data>
|
||||
<data name="TbSettingsSocksPortTip" xml:space="preserve">
|
||||
<value>http port=socks port+1</value>
|
||||
@@ -1082,7 +1082,7 @@
|
||||
<value>Enable hardware acceleration(Require restart)</value>
|
||||
</data>
|
||||
<data name="SpeedtestingWait" xml:space="preserve">
|
||||
<value>Waiting for testing</value>
|
||||
<value>Waiting for testing......</value>
|
||||
</data>
|
||||
<data name="TipDisplayLog" xml:space="preserve">
|
||||
<value>Please turn off when there is an abnormal disconnection</value>
|
||||
@@ -1097,7 +1097,7 @@
|
||||
<value>More urls, separated by commas;Subscription conversion will be invalid</value>
|
||||
</data>
|
||||
<data name="SpeedDisplayText" xml:space="preserve">
|
||||
<value>{0}:{1}/s↑ | {2}/s↓</value>
|
||||
<value>{0} : {1}/s↑ | {2}/s↓</value>
|
||||
</data>
|
||||
<data name="LvAutoUpdateInterval" xml:space="preserve">
|
||||
<value>Automatic update interval(minutes)</value>
|
||||
@@ -1120,7 +1120,7 @@
|
||||
<data name="TbDnsSingboxObjectDoc" xml:space="preserve">
|
||||
<value>Please fill in DNS Structure, Click to view the document</value>
|
||||
</data>
|
||||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<data name="TbSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>Click to import default DNS config</value>
|
||||
</data>
|
||||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
@@ -1138,4 +1138,34 @@
|
||||
<data name="TbRoutingRuleDomain" xml:space="preserve">
|
||||
<value>Domain</value>
|
||||
</data>
|
||||
<data name="menuAddHysteria2Server" xml:space="preserve">
|
||||
<value>Add [Trojan] server</value>
|
||||
</data>
|
||||
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
|
||||
<value>Hysteria Max bandwidth (Up/Dw)</value>
|
||||
</data>
|
||||
<data name="TbSettingsUseSystemHosts" xml:space="preserve">
|
||||
<value>Use System Hosts</value>
|
||||
</data>
|
||||
<data name="menuAddTuicServer" xml:space="preserve">
|
||||
<value>Add [Tuic] server</value>
|
||||
</data>
|
||||
<data name="TbHeaderType8" xml:space="preserve">
|
||||
<value>Congestion control</value>
|
||||
</data>
|
||||
<data name="LvPrevProfile" xml:space="preserve">
|
||||
<value>Previous proxy remakrs</value>
|
||||
</data>
|
||||
<data name="LvNextProfile" xml:space="preserve">
|
||||
<value>Next proxy remarks</value>
|
||||
</data>
|
||||
<data name="LvPrevProfileTip" xml:space="preserve">
|
||||
<value>Please make sure the remarks exists and is unique</value>
|
||||
</data>
|
||||
<data name="TbSettingsEnableExInbound" xml:space="preserve">
|
||||
<value>Enable additional Inbound</value>
|
||||
</data>
|
||||
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
||||
<value>Enable IPv6 Address</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -187,10 +187,10 @@
|
||||
<value>Исходная конфигурация</value>
|
||||
</data>
|
||||
<data name="IsLatestCore" xml:space="preserve">
|
||||
<value>{0} является последней версией.</value>
|
||||
<value>{0} {1} является последней версией.</value>
|
||||
</data>
|
||||
<data name="IsLatestN" xml:space="preserve">
|
||||
<value>{0} является последней версией.</value>
|
||||
<value>{0} {1} является последней версией.</value>
|
||||
</data>
|
||||
<data name="LvAddress" xml:space="preserve">
|
||||
<value>Адрес</value>
|
||||
@@ -317,7 +317,7 @@
|
||||
<value>Сканирование URL-адреса импорта успешна.</value>
|
||||
</data>
|
||||
<data name="TestMeOutput" xml:space="preserve">
|
||||
<value>Пинг текущей службы: {0} мс</value>
|
||||
<value>Задержка текущего сервера: {0} мс</value>
|
||||
</data>
|
||||
<data name="OperationSuccess" xml:space="preserve">
|
||||
<value>Операция успешна</value>
|
||||
@@ -335,7 +335,7 @@
|
||||
<value>Примечания</value>
|
||||
</data>
|
||||
<data name="LvUrl" xml:space="preserve">
|
||||
<value>Url(Необязательно)</value>
|
||||
<value>URL (необязательно)</value>
|
||||
</data>
|
||||
<data name="LvCount" xml:space="preserve">
|
||||
<value>Количество</value>
|
||||
@@ -506,7 +506,7 @@
|
||||
<value>Тёмный режим</value>
|
||||
</data>
|
||||
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
|
||||
<value>следить за системной темой</value>
|
||||
<value>Следить за системной темой</value>
|
||||
</data>
|
||||
<data name="TbSettingsLanguage" xml:space="preserve">
|
||||
<value>Язык (требуется перезапуск)</value>
|
||||
@@ -533,19 +533,19 @@
|
||||
<value>Очистить всю статистику</value>
|
||||
</data>
|
||||
<data name="menuPingServer" xml:space="preserve">
|
||||
<value>Проверить пинг серверов (Ctrl+P)</value>
|
||||
<value>Тест на задержку сервера (Ctrl+P)</value>
|
||||
</data>
|
||||
<data name="menuRealPingServer" xml:space="preserve">
|
||||
<value>Тест на реальную задержку серверов (Ctrl+R)</value>
|
||||
<value>Тест на реальную задержку сервера (Ctrl+R)</value>
|
||||
</data>
|
||||
<data name="menuSortServerResult" xml:space="preserve">
|
||||
<value>Сортировать по результату теста</value>
|
||||
</data>
|
||||
<data name="menuSpeedServer" xml:space="preserve">
|
||||
<value>Проверить скорость загрузки серверов (Ctrl+T)</value>
|
||||
<value>Тест на скорость загрузки сервера (Ctrl+T)</value>
|
||||
</data>
|
||||
<data name="menuTcpingServer" xml:space="preserve">
|
||||
<value>Тестировать сервера с tcping (Ctrl+O)</value>
|
||||
<value>Тест задержки с tcping (Ctrl+O)</value>
|
||||
</data>
|
||||
<data name="menuTestMe" xml:space="preserve">
|
||||
<value>Проверить текущий статус службы</value>
|
||||
@@ -644,7 +644,7 @@
|
||||
<value>Тип камуфляжа</value>
|
||||
</data>
|
||||
<data name="TbId" xml:space="preserve">
|
||||
<value>UUID(id)</value>
|
||||
<value>UUID (id)</value>
|
||||
</data>
|
||||
<data name="TbNetwork" xml:space="preserve">
|
||||
<value>Транспортный протокол сети</value>
|
||||
@@ -656,7 +656,7 @@
|
||||
<value>Порт</value>
|
||||
</data>
|
||||
<data name="TbRemarks" xml:space="preserve">
|
||||
<value>Псевдоним (примечания)</value>
|
||||
<value>Примечание</value>
|
||||
</data>
|
||||
<data name="TbRequestHost" xml:space="preserve">
|
||||
<value>Маскирующий домен (хост)</value>
|
||||
@@ -719,16 +719,22 @@
|
||||
<value>Разрешить подключения из локальной сети</value>
|
||||
</data>
|
||||
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
|
||||
<value>Auto hide startup</value>
|
||||
<value>Автоскрытие при автозапуске</value>
|
||||
</data>
|
||||
<data name="TbSettingsAutoUpdateInterval" xml:space="preserve">
|
||||
<value>Интервал автоматического обновления Geo в часах</value>
|
||||
</data>
|
||||
<data name="LvAutoUpdateInterval" xml:space="preserve">
|
||||
<value>Интервал автоматического обновления в минутах</value>
|
||||
</data>
|
||||
<data name="TbSettingsCore" xml:space="preserve">
|
||||
<value>Ядро: базовые настройки</value>
|
||||
</data>
|
||||
<data name="TbSettingsCoreDns" xml:space="preserve">
|
||||
<value>V2ray DNS settings</value>
|
||||
<value>Настройки DNS V2ray</value>
|
||||
</data>
|
||||
<data name="TbSettingsCoreDnsSingbox" xml:space="preserve">
|
||||
<value>Настройки DNS sing-box</value>
|
||||
</data>
|
||||
<data name="TbSettingsCoreKcp" xml:space="preserve">
|
||||
<value>Ядро: настройки KCP</value>
|
||||
@@ -806,7 +812,7 @@
|
||||
<value>Включить протокол безопасности TLS v1.3 (обновление подписки)</value>
|
||||
</data>
|
||||
<data name="TbSettingsTrayMenuServersLimit" xml:space="preserve">
|
||||
<value>Tray right-click menu servers display limit</value>
|
||||
<value>Лимит серверов в меню трея</value>
|
||||
</data>
|
||||
<data name="TbSettingsUdpEnabled" xml:space="preserve">
|
||||
<value>Включить UDP</value>
|
||||
@@ -950,7 +956,7 @@
|
||||
<value>Поддержка DnsObject</value>
|
||||
</data>
|
||||
<data name="SubUrlTips" xml:space="preserve">
|
||||
<value>Group please leave blank here</value>
|
||||
<value>Необязательное поле</value>
|
||||
</data>
|
||||
<data name="TipChangeRouting" xml:space="preserve">
|
||||
<value>Настройки маршрутизации изменены</value>
|
||||
@@ -962,7 +968,7 @@
|
||||
<value>Только маршрут</value>
|
||||
</data>
|
||||
<data name="menuMixedTestServer" xml:space="preserve">
|
||||
<value>Тест задержки и скорости (Ctrl+E)</value>
|
||||
<value>Тест задержки и скорости всех серверов (Ctrl+E)</value>
|
||||
</data>
|
||||
<data name="LvTestDelay" xml:space="preserve">
|
||||
<value>Задержка (ms)</value>
|
||||
@@ -983,7 +989,7 @@
|
||||
<value>Импортировать старый конфиг guiNConfig</value>
|
||||
</data>
|
||||
<data name="TbEnableTunAs" xml:space="preserve">
|
||||
<value>Включить интерфейс</value>
|
||||
<value>Режим VPN</value>
|
||||
</data>
|
||||
<data name="TbSettingsNewPort4LAN" xml:space="preserve">
|
||||
<value>Новый порт для локальной сети</value>
|
||||
@@ -1037,7 +1043,7 @@
|
||||
<value>Шрифт (требуется перезагрузка)</value>
|
||||
</data>
|
||||
<data name="TbSettingsCurrentFontFamilyTip" xml:space="preserve">
|
||||
<value>Скопируйте файл шрифта TTF в каталог guiFonts, перезапустите настройки</value>
|
||||
<value>Скопируйте файл шрифта TTF/TTC в каталог guiFonts, перезапустите настройки</value>
|
||||
</data>
|
||||
<data name="TbSettingsSocksPortTip" xml:space="preserve">
|
||||
<value>HTTP port=socks port+1</value>
|
||||
@@ -1051,4 +1057,19 @@
|
||||
<data name="TbSettingsEnableHWA" xml:space="preserve">
|
||||
<value>Включить аппаратное ускорение (требуется перезагрузка)</value>
|
||||
</data>
|
||||
</root>
|
||||
<data name="menuRebootAsAdmin" xml:space="preserve">
|
||||
<value>Перезагрузить как администратор</value>
|
||||
</data>
|
||||
<data name="menuDNSSetting" xml:space="preserve">
|
||||
<value>Настройки DNS</value>
|
||||
</data>
|
||||
<data name="TbSettingsLogEnabledToFile" xml:space="preserve">
|
||||
<value>Включить логгирование в файл</value>
|
||||
</data>
|
||||
<data name="TbSettingsSpeedTestTimeout" xml:space="preserve">
|
||||
<value>Таймаут одиночного спидтеста</value>
|
||||
</data>
|
||||
<data name="TbSettingsSpeedTestUrl" xml:space="preserve">
|
||||
<value>URL спидтеста</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -187,10 +187,10 @@
|
||||
<value>初始化配置</value>
|
||||
</data>
|
||||
<data name="IsLatestCore" xml:space="preserve">
|
||||
<value>{0} 已是最新版本。</value>
|
||||
<value>{0} {1} 已是最新版本。</value>
|
||||
</data>
|
||||
<data name="IsLatestN" xml:space="preserve">
|
||||
<value>{0} 已是最新版本。</value>
|
||||
<value>{0} {1} 已是最新版本。</value>
|
||||
</data>
|
||||
<data name="LvAddress" xml:space="preserve">
|
||||
<value>地址</value>
|
||||
@@ -1037,7 +1037,7 @@
|
||||
<value>当前字体(需重启)</value>
|
||||
</data>
|
||||
<data name="TbSettingsCurrentFontFamilyTip" xml:space="preserve">
|
||||
<value>拷贝字体TTF文件到目录guiFonts,重启设置</value>
|
||||
<value>拷贝字体TTF/TTC文件到目录guiFonts,重启设置</value>
|
||||
</data>
|
||||
<data name="TbSettingsSocksPortTip" xml:space="preserve">
|
||||
<value>http端口=socks端口+1</value>
|
||||
@@ -1082,7 +1082,7 @@
|
||||
<value>启用硬件加速(需重启)</value>
|
||||
</data>
|
||||
<data name="SpeedtestingWait" xml:space="preserve">
|
||||
<value>等待测试中...</value>
|
||||
<value>等待测试中......</value>
|
||||
</data>
|
||||
<data name="TipDisplayLog" xml:space="preserve">
|
||||
<value>当有异常断流时请关闭</value>
|
||||
@@ -1117,7 +1117,7 @@
|
||||
<data name="TbDnsSingboxObjectDoc" xml:space="preserve">
|
||||
<value>请填写 DNS JSON 结构,点击查看文档</value>
|
||||
</data>
|
||||
<data name="TBSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<data name="TbSettingDnsImportDefConfig" xml:space="preserve">
|
||||
<value>点击导入默认DNS配置</value>
|
||||
</data>
|
||||
<data name="TbdomainStrategy4Singbox" xml:space="preserve">
|
||||
@@ -1135,4 +1135,34 @@
|
||||
<data name="TbRoutingRuleIP" xml:space="preserve">
|
||||
<value>IP 或 IP CIDR</value>
|
||||
</data>
|
||||
<data name="menuAddHysteria2Server" xml:space="preserve">
|
||||
<value>添加[Hysteria2]服务器</value>
|
||||
</data>
|
||||
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
|
||||
<value>Hysteria 最大带宽(Up/Dw)</value>
|
||||
</data>
|
||||
<data name="TbSettingsUseSystemHosts" xml:space="preserve">
|
||||
<value>使用系统hosts</value>
|
||||
</data>
|
||||
<data name="menuAddTuicServer" xml:space="preserve">
|
||||
<value>添加[Tuic]服务器</value>
|
||||
</data>
|
||||
<data name="TbHeaderType8" xml:space="preserve">
|
||||
<value>拥塞控制算法</value>
|
||||
</data>
|
||||
<data name="LvPrevProfile" xml:space="preserve">
|
||||
<value>前置代理别名</value>
|
||||
</data>
|
||||
<data name="LvNextProfile" xml:space="preserve">
|
||||
<value>落地代理別名</value>
|
||||
</data>
|
||||
<data name="LvPrevProfileTip" xml:space="preserve">
|
||||
<value>请确保别名存在并唯一</value>
|
||||
</data>
|
||||
<data name="TbSettingsEnableExInbound" xml:space="preserve">
|
||||
<value>启用额外监听端口</value>
|
||||
</data>
|
||||
<data name="TbSettingsEnableIPv6Address" xml:space="preserve">
|
||||
<value>启用IPv6</value>
|
||||
</data>
|
||||
</root>
|
||||
1156
v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx
Normal file
1156
v2rayN/v2rayN/Resx/ResUI.zh-Hant.resx
Normal file
File diff suppressed because it is too large
Load Diff
34
v2rayN/v2rayN/Sample/SampleOutbound
Normal file
34
v2rayN/v2rayN/Sample/SampleOutbound
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"tag": "proxy",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"vnext": [
|
||||
{
|
||||
"address": "v2ray.cool",
|
||||
"port": 10086,
|
||||
"users": [
|
||||
{
|
||||
"id": "a3482e88-686a-4a58-8126-99c9df64b7bf",
|
||||
"security": "auto"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"servers": [
|
||||
{
|
||||
"address": "v2ray.cool",
|
||||
"method": "chacha20",
|
||||
"ota": false,
|
||||
"password": "123456",
|
||||
"port": 10086,
|
||||
"level": 1
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "tcp"
|
||||
},
|
||||
"mux": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,18 @@
|
||||
{
|
||||
"type": "block",
|
||||
"tag": "block"
|
||||
},
|
||||
{
|
||||
"tag": "dns_out",
|
||||
"type": "dns"
|
||||
}
|
||||
],
|
||||
"route": {
|
||||
"rules": []
|
||||
"rules": [
|
||||
{
|
||||
"protocol": [ "dns" ],
|
||||
"outbound": "dns_out"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
6
v2rayN/v2rayN/Sample/SingboxSampleOutbound
Normal file
6
v2rayN/v2rayN/Sample/SingboxSampleOutbound
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"type": "vless",
|
||||
"tag": "proxy",
|
||||
"server": "",
|
||||
"server_port": 443
|
||||
}
|
||||
@@ -24,5 +24,9 @@
|
||||
"geoip:private",
|
||||
"geoip:cn"
|
||||
]
|
||||
},
|
||||
{
|
||||
"port": "0-65535",
|
||||
"outboundTag": "proxy"
|
||||
}
|
||||
]
|
||||
@@ -1,8 +1,4 @@
|
||||
[
|
||||
{
|
||||
"inbound": [ "dns_in" ],
|
||||
"outbound": "dns_out"
|
||||
},
|
||||
{
|
||||
"protocol": [ "dns" ],
|
||||
"outbound": "dns_out"
|
||||
|
||||
@@ -12,7 +12,6 @@ using System.Net.NetworkInformation;
|
||||
using System.Net.Sockets;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
@@ -881,13 +880,13 @@ namespace v2rayN
|
||||
if (blFull)
|
||||
{
|
||||
return string.Format("v2rayN - V{0} - {1}",
|
||||
FileVersionInfo.GetVersionInfo(location).FileVersion.ToString(),
|
||||
FileVersionInfo.GetVersionInfo(location).FileVersion?.ToString(),
|
||||
File.GetLastWriteTime(location).ToString("yyyy/MM/dd"));
|
||||
}
|
||||
else
|
||||
{
|
||||
return string.Format("v2rayN/{0}",
|
||||
FileVersionInfo.GetVersionInfo(location).FileVersion.ToString());
|
||||
FileVersionInfo.GetVersionInfo(location).FileVersion?.ToString());
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -898,22 +897,26 @@ namespace v2rayN
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 深度拷贝
|
||||
/// DeepCopy
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="obj"></param>
|
||||
/// <returns></returns>
|
||||
public static T DeepCopy<T>(T obj)
|
||||
{
|
||||
object retval;
|
||||
MemoryStream ms = new MemoryStream();
|
||||
BinaryFormatter bf = new BinaryFormatter();
|
||||
//序列化成流
|
||||
bf.Serialize(ms, obj);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
//反序列化成对象
|
||||
retval = bf.Deserialize(ms);
|
||||
return (T)retval;
|
||||
return FromJson<T>(ToJson(obj, false))!;
|
||||
|
||||
// object retval;
|
||||
// MemoryStream ms = new();
|
||||
//#pragma warning disable SYSLIB0011 // 类型或成员已过时
|
||||
// BinaryFormatter bf = new();
|
||||
//#pragma warning restore SYSLIB0011 // 类型或成员已过时
|
||||
// //序列化成流
|
||||
// bf.Serialize(ms, obj);
|
||||
// ms.Seek(0, SeekOrigin.Begin);
|
||||
// //反序列化成对象
|
||||
// retval = bf.Deserialize(ms);
|
||||
// return (T)retval;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -90,7 +90,7 @@ namespace v2rayN.ViewModels
|
||||
item.preSocksPort = SelectedSource.preSocksPort;
|
||||
}
|
||||
|
||||
if (ConfigHandler.EditCustomServer(ref _config, item) == 0)
|
||||
if (ConfigHandler.EditCustomServer(_config, item) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_view.DialogResult = true;
|
||||
@@ -122,7 +122,7 @@ namespace v2rayN.ViewModels
|
||||
var item = LazyConfig.Instance.GetProfileItem(SelectedSource.indexId);
|
||||
item ??= SelectedSource;
|
||||
item.address = fileName;
|
||||
if (ConfigHandler.AddCustomServer(ref _config, item, false) == 0)
|
||||
if (ConfigHandler.AddCustomServer(_config, item, false) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.SuccessfullyImportedCustomServer);
|
||||
if (!Utils.IsNullOrEmpty(item.indexId))
|
||||
|
||||
@@ -127,23 +127,31 @@ namespace v2rayN.ViewModels
|
||||
switch (item.configType)
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
ret = ConfigHandler.AddServer(ref _config, item);
|
||||
ret = ConfigHandler.AddServer(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.Shadowsocks:
|
||||
ret = ConfigHandler.AddShadowsocksServer(ref _config, item);
|
||||
ret = ConfigHandler.AddShadowsocksServer(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.Socks:
|
||||
ret = ConfigHandler.AddSocksServer(ref _config, item);
|
||||
ret = ConfigHandler.AddSocksServer(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
ret = ConfigHandler.AddVlessServer(ref _config, item);
|
||||
ret = ConfigHandler.AddVlessServer(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.Trojan:
|
||||
ret = ConfigHandler.AddTrojanServer(ref _config, item);
|
||||
ret = ConfigHandler.AddTrojanServer(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.Hysteria2:
|
||||
ret = ConfigHandler.AddHysteria2Server(_config, item);
|
||||
break;
|
||||
|
||||
case EConfigType.Tuic:
|
||||
ret = ConfigHandler.AddTuicServer(_config, item);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace v2rayN.ViewModels
|
||||
private NoticeHandler? _noticeHandler;
|
||||
private Window _view;
|
||||
|
||||
[Reactive] public bool useSystemHosts { get; set; }
|
||||
[Reactive] public string domainStrategy4Freedom { get; set; }
|
||||
[Reactive] public string normalDNS { get; set; }
|
||||
[Reactive] public string normalDNS2 { get; set; }
|
||||
@@ -31,6 +32,7 @@ namespace v2rayN.ViewModels
|
||||
_view = view;
|
||||
|
||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.Xray);
|
||||
useSystemHosts = item.useSystemHosts;
|
||||
domainStrategy4Freedom = item?.domainStrategy4Freedom!;
|
||||
normalDNS = item?.normalDNS!;
|
||||
|
||||
@@ -95,6 +97,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.Xray);
|
||||
item.domainStrategy4Freedom = domainStrategy4Freedom;
|
||||
item.useSystemHosts = useSystemHosts;
|
||||
item.normalDNS = normalDNS;
|
||||
ConfigHandler.SaveDNSItems(_config, item);
|
||||
|
||||
|
||||
@@ -89,6 +89,8 @@ namespace v2rayN.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> AddShadowsocksServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddSocksServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddTrojanServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddHysteria2ServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
||||
@@ -146,12 +148,15 @@ namespace v2rayN.ViewModels
|
||||
//CheckUpdate
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
|
||||
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
||||
//public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
|
||||
@@ -210,8 +215,8 @@ namespace v2rayN.ViewModels
|
||||
[Reactive]
|
||||
public string RunningServerDisplay { get; set; }
|
||||
|
||||
//[Reactive]
|
||||
//public string RunningServerToolTipText { get; set; }
|
||||
[Reactive]
|
||||
public string RunningServerToolTipText { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string RunningInfoDisplay { get; set; }
|
||||
@@ -337,6 +342,14 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
EditServer(true, EConfigType.Trojan);
|
||||
});
|
||||
AddHysteria2ServerCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
EditServer(true, EConfigType.Hysteria2);
|
||||
});
|
||||
AddTuicServerCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
EditServer(true, EConfigType.Tuic);
|
||||
});
|
||||
AddCustomServerCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
EditServer(true, EConfigType.Custom);
|
||||
@@ -496,26 +509,26 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
CheckUpdateN();
|
||||
});
|
||||
CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.v2fly_v5);
|
||||
});
|
||||
CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.SagerNet);
|
||||
});
|
||||
//CheckUpdateV2flyCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.v2fly_v5);
|
||||
//});
|
||||
//CheckUpdateSagerNetCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.SagerNet);
|
||||
//});
|
||||
CheckUpdateXrayCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.Xray);
|
||||
});
|
||||
CheckUpdateClashCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.clash);
|
||||
});
|
||||
CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.clash_meta);
|
||||
});
|
||||
//CheckUpdateClashCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.clash);
|
||||
//});
|
||||
//CheckUpdateClashMetaCoreCmd = ReactiveCommand.Create(() =>
|
||||
//{
|
||||
// CheckUpdateCore(ECoreType.clash_meta);
|
||||
//});
|
||||
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
|
||||
{
|
||||
CheckUpdateCore(ECoreType.sing_box);
|
||||
@@ -558,7 +571,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
private void Init()
|
||||
{
|
||||
ConfigHandler.InitBuiltinRouting(ref _config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
ConfigHandler.InitBuiltinDNS(_config);
|
||||
_coreHandler = new CoreHandler(_config, UpdateHandler);
|
||||
Locator.CurrentMutable.RegisterLazySingleton(() => _coreHandler, typeof(CoreHandler));
|
||||
@@ -621,8 +634,8 @@ namespace v2rayN.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.agentTag, Utils.HumanFy(update.proxyUp), Utils.HumanFy(update.proxyDown));
|
||||
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.directTag, Utils.HumanFy(update.directUp), Utils.HumanFy(update.directDown));
|
||||
SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.proxyUp), Utils.HumanFy(update.proxyDown));
|
||||
SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.directUp), Utils.HumanFy(update.directDown));
|
||||
|
||||
if (update.proxyUp + update.proxyDown > 0)
|
||||
{
|
||||
@@ -724,7 +737,7 @@ namespace v2rayN.ViewModels
|
||||
Utils.SaveLog("MyAppExit Begin");
|
||||
|
||||
StorageUI();
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
|
||||
//HttpProxyHandle.CloseHttpAgent(config);
|
||||
if (blWindowsShutDown)
|
||||
@@ -844,17 +857,17 @@ namespace v2rayN.ViewModels
|
||||
RefreshServersMenu();
|
||||
|
||||
//display running server
|
||||
var running = ConfigHandler.GetDefaultServer(ref _config);
|
||||
var running = ConfigHandler.GetDefaultServer(_config);
|
||||
if (running != null)
|
||||
{
|
||||
var runningSummary = running.GetSummary();
|
||||
RunningServerDisplay = $"{ResUI.menuServers}:{runningSummary}";
|
||||
//RunningServerToolTipText = runningSummary;
|
||||
RunningServerToolTipText = runningSummary;
|
||||
}
|
||||
else
|
||||
{
|
||||
RunningServerDisplay = ResUI.CheckServerSettings;
|
||||
//RunningServerToolTipText = ResUI.CheckServerSettings;
|
||||
RunningServerToolTipText = ResUI.CheckServerSettings;
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -982,7 +995,7 @@ namespace v2rayN.ViewModels
|
||||
public void AddServerViaClipboard()
|
||||
{
|
||||
var clipboardData = Utils.GetClipboardData();
|
||||
int ret = ConfigHandler.AddBatchServers(ref _config, clipboardData!, _subId, false);
|
||||
int ret = ConfigHandler.AddBatchServers(_config, clipboardData!, _subId, false);
|
||||
if (ret > 0)
|
||||
{
|
||||
InitSubscriptionView();
|
||||
@@ -1009,7 +1022,7 @@ namespace v2rayN.ViewModels
|
||||
}
|
||||
else
|
||||
{
|
||||
int ret = ConfigHandler.AddBatchServers(ref _config, result, _subId, false);
|
||||
int ret = ConfigHandler.AddBatchServers(_config, result, _subId, false);
|
||||
if (ret > 0)
|
||||
{
|
||||
InitSubscriptionView();
|
||||
@@ -1056,7 +1069,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ConfigHandler.CopyServer(ref _config, lstSelecteds) == 0)
|
||||
if (ConfigHandler.CopyServer(_config, lstSelecteds) == 0)
|
||||
{
|
||||
RefreshServers();
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
@@ -1089,7 +1102,7 @@ namespace v2rayN.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigHandler.SetDefaultServerIndex(ref _config, indexId) == 0)
|
||||
if (ConfigHandler.SetDefaultServerIndex(_config, indexId) == 0)
|
||||
{
|
||||
RefreshServers();
|
||||
Reload();
|
||||
@@ -1145,7 +1158,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
_dicHeaderSort.TryAdd(colName, true);
|
||||
_dicHeaderSort.TryGetValue(colName, out bool asc);
|
||||
if (ConfigHandler.SortServers(ref _config, _subId, colName, asc) != 0)
|
||||
if (ConfigHandler.SortServers(_config, _subId, colName, asc) != 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -1155,7 +1168,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
public void TestServerAvailability()
|
||||
{
|
||||
var item = ConfigHandler.GetDefaultServer(ref _config);
|
||||
var item = ConfigHandler.GetDefaultServer(_config);
|
||||
if (item == null || item.configType == EConfigType.Custom)
|
||||
{
|
||||
return;
|
||||
@@ -1209,7 +1222,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ConfigHandler.MoveServer(ref _config, ref _lstProfile, index, eMove) == 0)
|
||||
if (ConfigHandler.MoveServer(_config, ref _lstProfile, index, eMove) == 0)
|
||||
{
|
||||
RefreshServers();
|
||||
}
|
||||
@@ -1220,7 +1233,7 @@ namespace v2rayN.ViewModels
|
||||
var targetIndex = _profileItems.IndexOf(targetItem);
|
||||
if (startIndex >= 0 && targetIndex >= 0 && startIndex != targetIndex)
|
||||
{
|
||||
if (ConfigHandler.MoveServer(ref _config, ref _lstProfile, startIndex, EMove.Position, targetIndex) == 0)
|
||||
if (ConfigHandler.MoveServer(_config, ref _lstProfile, startIndex, EMove.Position, targetIndex) == 0)
|
||||
{
|
||||
RefreshServers();
|
||||
}
|
||||
@@ -1350,7 +1363,7 @@ namespace v2rayN.ViewModels
|
||||
var ret = (new RoutingSettingWindow()).ShowDialog();
|
||||
if (ret == true)
|
||||
{
|
||||
ConfigHandler.InitBuiltinRouting(ref _config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
RefreshRoutingsMenu();
|
||||
//RefreshServers();
|
||||
Reload();
|
||||
@@ -1401,7 +1414,7 @@ namespace v2rayN.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
var ret = ConfigHandler.ImportOldGuiConfig(ref _config, fileName);
|
||||
var ret = ConfigHandler.ImportOldGuiConfig(_config, fileName);
|
||||
if (ret == 0)
|
||||
{
|
||||
RefreshRoutingsMenu();
|
||||
@@ -1487,7 +1500,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
_coreHandler.LoadCore();
|
||||
|
||||
//ConfigHandler.SaveConfig(ref _config, false);
|
||||
//ConfigHandler.SaveConfig(_config, false);
|
||||
|
||||
ChangeSystemProxyStatus(_config.sysProxyType, false);
|
||||
});
|
||||
@@ -1502,7 +1515,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
private void CloseV2ray()
|
||||
{
|
||||
ConfigHandler.SaveConfig(ref _config, false);
|
||||
ConfigHandler.SaveConfig(_config, false);
|
||||
|
||||
ChangeSystemProxyStatus(ESysProxyType.ForcedClear, false);
|
||||
|
||||
@@ -1523,7 +1536,7 @@ namespace v2rayN.ViewModels
|
||||
ChangeSystemProxyStatus(type, true);
|
||||
|
||||
SystemProxySelected = (int)_config.sysProxyType;
|
||||
ConfigHandler.SaveConfig(ref _config, false);
|
||||
ConfigHandler.SaveConfig(_config, false);
|
||||
}
|
||||
|
||||
private void ChangeSystemProxyStatus(ESysProxyType type, bool blChange)
|
||||
@@ -1591,7 +1604,7 @@ namespace v2rayN.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigHandler.SetDefaultRouting(ref _config, item) == 0)
|
||||
if (ConfigHandler.SetDefaultRouting(_config, item) == 0)
|
||||
{
|
||||
_noticeHandler?.SendMessage(ResUI.TipChangeRouting, true);
|
||||
Reload();
|
||||
@@ -1697,7 +1710,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
_config.uiItem.colorModeDark = ColorModeDark;
|
||||
ModifyTheme(ColorModeDark);
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1708,11 +1721,15 @@ namespace v2rayN.ViewModels
|
||||
if (_config.uiItem.followSystemTheme != FollowSystemTheme)
|
||||
{
|
||||
_config.uiItem.followSystemTheme = FollowSystemTheme;
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
if (FollowSystemTheme)
|
||||
{
|
||||
ModifyTheme(!Utils.IsLightTheme());
|
||||
}
|
||||
else
|
||||
{
|
||||
ModifyTheme(ColorModeDark);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1732,7 +1749,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
_config.uiItem.colorPrimaryName = SelectedSwatch?.Name;
|
||||
ChangePrimaryColor(SelectedSwatch.ExemplarHue.Color);
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1750,7 +1767,7 @@ namespace v2rayN.ViewModels
|
||||
Application.Current.Resources["StdFontSize2"] = size + 2;
|
||||
Application.Current.Resources["StdFontSizeMsg"] = size - 1;
|
||||
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1763,7 +1780,7 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
_config.uiItem.currentLanguage = CurrentLanguage;
|
||||
Thread.CurrentThread.CurrentUICulture = new(CurrentLanguage);
|
||||
ConfigHandler.SaveConfig(ref _config);
|
||||
ConfigHandler.SaveConfig(_config);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ namespace v2rayN.ViewModels
|
||||
[Reactive] public string defFingerprint { get; set; }
|
||||
[Reactive] public string defUserAgent { get; set; }
|
||||
[Reactive] public string mux4SboxProtocol { get; set; }
|
||||
[Reactive] public int hyUpMbps { get; set; }
|
||||
[Reactive] public int hyDownMbps { get; set; }
|
||||
|
||||
#endregion Core
|
||||
|
||||
@@ -81,6 +83,8 @@ namespace v2rayN.ViewModels
|
||||
[Reactive] public bool TunStrictRoute { get; set; }
|
||||
[Reactive] public string TunStack { get; set; }
|
||||
[Reactive] public int TunMtu { get; set; }
|
||||
[Reactive] public bool TunEnableExInbound { get; set; }
|
||||
[Reactive] public bool TunEnableIPv6Address { get; set; }
|
||||
|
||||
#endregion Tun mode
|
||||
|
||||
@@ -120,7 +124,9 @@ namespace v2rayN.ViewModels
|
||||
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
||||
defFingerprint = _config.coreBasicItem.defFingerprint;
|
||||
defUserAgent = _config.coreBasicItem.defUserAgent;
|
||||
mux4SboxProtocol = _config.mux4Sbox.protocol;
|
||||
mux4SboxProtocol = _config.mux4SboxItem.protocol;
|
||||
hyUpMbps = _config.hysteriaItem.up_mbps;
|
||||
hyDownMbps = _config.hysteriaItem.down_mbps;
|
||||
|
||||
#endregion Core
|
||||
|
||||
@@ -170,6 +176,8 @@ namespace v2rayN.ViewModels
|
||||
TunStrictRoute = _config.tunModeItem.strictRoute;
|
||||
TunStack = _config.tunModeItem.stack;
|
||||
TunMtu = _config.tunModeItem.mtu;
|
||||
TunEnableExInbound = _config.tunModeItem.enableExInbound;
|
||||
TunEnableIPv6Address = _config.tunModeItem.enableIPv6Address;
|
||||
|
||||
#endregion Tun mode
|
||||
|
||||
@@ -274,7 +282,9 @@ namespace v2rayN.ViewModels
|
||||
_config.coreBasicItem.defAllowInsecure = defAllowInsecure;
|
||||
_config.coreBasicItem.defFingerprint = defFingerprint;
|
||||
_config.coreBasicItem.defUserAgent = defUserAgent;
|
||||
_config.mux4Sbox.protocol = mux4SboxProtocol;
|
||||
_config.mux4SboxItem.protocol = mux4SboxProtocol;
|
||||
_config.hysteriaItem.up_mbps = hyUpMbps;
|
||||
_config.hysteriaItem.down_mbps = hyDownMbps;
|
||||
|
||||
//Kcp
|
||||
//_config.kcpItem.mtu = Kcpmtu;
|
||||
@@ -313,11 +323,13 @@ namespace v2rayN.ViewModels
|
||||
_config.tunModeItem.strictRoute = TunStrictRoute;
|
||||
_config.tunModeItem.stack = TunStack;
|
||||
_config.tunModeItem.mtu = TunMtu;
|
||||
_config.tunModeItem.enableExInbound = TunEnableExInbound;
|
||||
_config.tunModeItem.enableIPv6Address = TunEnableIPv6Address;
|
||||
|
||||
//coreType
|
||||
SaveCoreType();
|
||||
|
||||
if (ConfigHandler.SaveConfig(ref _config) == 0)
|
||||
if (ConfigHandler.SaveConfig(_config) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_view.DialogResult = true;
|
||||
@@ -359,6 +371,10 @@ namespace v2rayN.ViewModels
|
||||
case 6:
|
||||
type = CoreType6;
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
continue;
|
||||
}
|
||||
item.coreType = (ECoreType)Enum.Parse(typeof(ECoreType), type);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace v2rayN.ViewModels
|
||||
if (rulesItem.id.IsNullOrEmpty())
|
||||
{
|
||||
rulesItem.id = Utils.GetGUID(false);
|
||||
rulesItem.outboundTag = Global.agentTag;
|
||||
rulesItem.outboundTag = Global.ProxyTag;
|
||||
rulesItem.enabled = true;
|
||||
SelectedSource = rulesItem;
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ namespace v2rayN.ViewModels
|
||||
item.ruleNum = _rules.Count;
|
||||
item.ruleSet = Utils.ToJson(_rules, false);
|
||||
|
||||
if (ConfigHandler.SaveRoutingItem(ref _config, item) == 0)
|
||||
if (ConfigHandler.SaveRoutingItem(_config, item) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_view.DialogResult = true;
|
||||
|
||||
@@ -81,7 +81,7 @@ namespace v2rayN.ViewModels
|
||||
_view = view;
|
||||
SelectedSource = new();
|
||||
|
||||
ConfigHandler.InitBuiltinRouting(ref _config);
|
||||
ConfigHandler.InitBuiltinRouting(_config);
|
||||
|
||||
enableRoutingAdvanced = _config.routingBasicItem.enableRoutingAdvanced;
|
||||
domainStrategy = _config.routingBasicItem.domainStrategy;
|
||||
@@ -134,7 +134,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
private void BindingLockedData()
|
||||
{
|
||||
_lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
|
||||
_lockedItem = ConfigHandler.GetLockedRoutingItem(_config);
|
||||
if (_lockedItem != null)
|
||||
{
|
||||
_lockedRules = Utils.FromJson<List<RulesItem>>(_lockedItem.ruleSet);
|
||||
@@ -164,7 +164,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
_lockedItem.ruleSet = Utils.ToJson(_lockedRules, false);
|
||||
|
||||
ConfigHandler.SaveRoutingItem(ref _config, _lockedItem);
|
||||
ConfigHandler.SaveRoutingItem(_config, _lockedItem);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
EndBindingLockedData();
|
||||
|
||||
if (ConfigHandler.SaveConfig(ref _config) == 0)
|
||||
if (ConfigHandler.SaveConfig(_config) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_view.DialogResult = true;
|
||||
@@ -289,7 +289,7 @@ namespace v2rayN.ViewModels
|
||||
return;
|
||||
}
|
||||
|
||||
if (ConfigHandler.SetDefaultRouting(ref _config, item) == 0)
|
||||
if (ConfigHandler.SetDefaultRouting(_config, item) == 0)
|
||||
{
|
||||
RefreshRoutingItems();
|
||||
IsModified = true;
|
||||
@@ -298,7 +298,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
private void RoutingAdvancedImportRules()
|
||||
{
|
||||
if (ConfigHandler.InitBuiltinRouting(ref _config, true) == 0)
|
||||
if (ConfigHandler.InitBuiltinRouting(_config, true) == 0)
|
||||
{
|
||||
RefreshRoutingItems();
|
||||
IsModified = true;
|
||||
|
||||
@@ -69,9 +69,11 @@ namespace v2rayN.ViewModels
|
||||
item.sort = SelectedSource.sort;
|
||||
item.filter = SelectedSource.filter;
|
||||
item.convertTarget = SelectedSource.convertTarget;
|
||||
item.prevProfile = SelectedSource.prevProfile;
|
||||
item.nextProfile = SelectedSource.nextProfile;
|
||||
}
|
||||
|
||||
if (ConfigHandler.AddSubItem(ref _config, item) == 0)
|
||||
if (ConfigHandler.AddSubItem(_config, item) == 0)
|
||||
{
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
_view.DialogResult = true;
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
foreach (var it in SelectedSources)
|
||||
{
|
||||
ConfigHandler.DeleteSubItem(ref _config, it?.id);
|
||||
ConfigHandler.DeleteSubItem(_config, it?.id);
|
||||
}
|
||||
RefreshSubItems();
|
||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||
|
||||
@@ -97,17 +97,17 @@
|
||||
Grid.Row="2"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Vertical">
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="btnBrowse"
|
||||
Width="100"
|
||||
Margin="2,0,8,0"
|
||||
Width="80"
|
||||
Margin="2,0"
|
||||
Content="{x:Static resx:ResUI.TbBrowse}"
|
||||
Style="{StaticResource DefButton}" />
|
||||
<Button
|
||||
x:Name="btnEdit"
|
||||
Width="100"
|
||||
Margin="2,2,8,0"
|
||||
Width="80"
|
||||
Margin="2,0"
|
||||
Content="{x:Static resx:ResUI.TbEdit}"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
@@ -126,9 +126,8 @@
|
||||
Width="200"
|
||||
Margin="4"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
MaxDropDownHeight="1000"
|
||||
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
|
||||
Style="{StaticResource MyOutlinedTextComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
|
||||
@@ -11,6 +11,17 @@ namespace v2rayN.Views
|
||||
public AddServer2Window(ProfileItem profileItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Loaded += Window_Loaded;
|
||||
ViewModel = new AddServer2ViewModel(profileItem, this);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -15,6 +15,17 @@ namespace v2rayN.Views
|
||||
public AddServerWindow(ProfileItem profileItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Loaded += Window_Loaded;
|
||||
cmbNetwork.SelectionChanged += CmbNetwork_SelectionChanged;
|
||||
@@ -24,14 +35,14 @@ namespace v2rayN.Views
|
||||
|
||||
if (profileItem.configType == EConfigType.VLESS)
|
||||
{
|
||||
Global.coreTypes4VLESS.ForEach(it =>
|
||||
Global.CoreTypes4VLESS.ForEach(it =>
|
||||
{
|
||||
cmbCoreType.Items.Add(it);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.coreTypes.ForEach(it =>
|
||||
Global.CoreTypes.ForEach(it =>
|
||||
{
|
||||
cmbCoreType.Items.Add(it);
|
||||
});
|
||||
@@ -41,20 +52,20 @@ namespace v2rayN.Views
|
||||
cmbStreamSecurity.Items.Add(string.Empty);
|
||||
cmbStreamSecurity.Items.Add(Global.StreamSecurity);
|
||||
|
||||
Global.networks.ForEach(it =>
|
||||
Global.Networks.ForEach(it =>
|
||||
{
|
||||
cmbNetwork.Items.Add(it);
|
||||
});
|
||||
Global.fingerprints.ForEach(it =>
|
||||
Global.Fingerprints.ForEach(it =>
|
||||
{
|
||||
cmbFingerprint.Items.Add(it);
|
||||
cmbFingerprint2.Items.Add(it);
|
||||
});
|
||||
Global.allowInsecures.ForEach(it =>
|
||||
Global.AllowInsecures.ForEach(it =>
|
||||
{
|
||||
cmbAllowInsecure.Items.Add(it);
|
||||
});
|
||||
Global.alpns.ForEach(it =>
|
||||
Global.Alpns.ForEach(it =>
|
||||
{
|
||||
cmbAlpn.Items.Add(it);
|
||||
});
|
||||
@@ -63,7 +74,7 @@ namespace v2rayN.Views
|
||||
{
|
||||
case EConfigType.VMess:
|
||||
gridVMess.Visibility = Visibility.Visible;
|
||||
Global.vmessSecuritys.ForEach(it =>
|
||||
Global.VmessSecuritys.ForEach(it =>
|
||||
{
|
||||
cmbSecurity.Items.Add(it);
|
||||
});
|
||||
@@ -88,7 +99,7 @@ namespace v2rayN.Views
|
||||
case EConfigType.VLESS:
|
||||
gridVLESS.Visibility = Visibility.Visible;
|
||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
||||
Global.flows.ForEach(it =>
|
||||
Global.Flows.ForEach(it =>
|
||||
{
|
||||
cmbFlow5.Items.Add(it);
|
||||
});
|
||||
@@ -101,11 +112,34 @@ namespace v2rayN.Views
|
||||
case EConfigType.Trojan:
|
||||
gridTrojan.Visibility = Visibility.Visible;
|
||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
||||
Global.flows.ForEach(it =>
|
||||
Global.Flows.ForEach(it =>
|
||||
{
|
||||
cmbFlow6.Items.Add(it);
|
||||
});
|
||||
break;
|
||||
|
||||
case EConfigType.Hysteria2:
|
||||
gridHysteria2.Visibility = Visibility.Visible;
|
||||
sepa2.Visibility = Visibility.Collapsed;
|
||||
gridTransport.Visibility = Visibility.Collapsed;
|
||||
cmbCoreType.IsEnabled = false;
|
||||
cmbFingerprint.IsEnabled = false;
|
||||
cmbFingerprint.Text = string.Empty;
|
||||
break;
|
||||
|
||||
case EConfigType.Tuic:
|
||||
gridTuic.Visibility = Visibility.Visible;
|
||||
sepa2.Visibility = Visibility.Collapsed;
|
||||
gridTransport.Visibility = Visibility.Collapsed;
|
||||
cmbCoreType.IsEnabled = false;
|
||||
cmbFingerprint.IsEnabled = false;
|
||||
cmbFingerprint.Text = string.Empty;
|
||||
|
||||
Global.TuicCongestionControls.ForEach(it =>
|
||||
{
|
||||
cmbHeaderType8.Items.Add(it);
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
gridTlsMore.Visibility = Visibility.Hidden;
|
||||
@@ -145,6 +179,16 @@ namespace v2rayN.Views
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId6.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.flow, v => v.cmbFlow6.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.Hysteria2:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId7.Text).DisposeWith(disposables);
|
||||
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.headerType, v => v.cmbHeaderType8.Text).DisposeWith(disposables);
|
||||
break;
|
||||
}
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.network, v => v.cmbNetwork.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.headerType, v => v.cmbHeaderType.Text).DisposeWith(disposables);
|
||||
@@ -225,7 +269,7 @@ namespace v2rayN.Views
|
||||
else if (network is "kcp" or "quic")
|
||||
{
|
||||
cmbHeaderType.Items.Add(Global.None);
|
||||
Global.kcpHeaderTypes.ForEach(it =>
|
||||
Global.KcpHeaderTypes.ForEach(it =>
|
||||
{
|
||||
cmbHeaderType.Items.Add(it);
|
||||
});
|
||||
|
||||
@@ -64,6 +64,20 @@
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsUseSystemHosts}" />
|
||||
<ToggleButton
|
||||
x:Name="togUseSystemHosts"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
@@ -81,7 +95,7 @@
|
||||
<Button
|
||||
x:Name="btnImportDefConfig4V2ray"
|
||||
Margin="8,0,0,0"
|
||||
Content="{x:Static resx:ResUI.TBSettingDnsImportDefConfig}"
|
||||
Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
@@ -113,7 +127,7 @@
|
||||
<Button
|
||||
x:Name="btnImportDefConfig4Singbox"
|
||||
Margin="8,0,0,0"
|
||||
Content="{x:Static resx:ResUI.TBSettingDnsImportDefConfig}"
|
||||
Content="{x:Static resx:ResUI.TbSettingDnsImportDefConfig}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</StackPanel>
|
||||
|
||||
@@ -14,18 +14,30 @@ namespace v2rayN.Views
|
||||
public DNSSettingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
_config = LazyConfig.Instance.GetConfig();
|
||||
|
||||
ViewModel = new DNSSettingViewModel(this);
|
||||
|
||||
Global.domainStrategy4Freedoms.ForEach(it =>
|
||||
Global.DomainStrategy4Freedoms.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Freedom.Items.Add(it);
|
||||
});
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.useSystemHosts, v => v.togUseSystemHosts.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS, v => v.txtnormalDNS.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.normalDNS2, v => v.txtnormalDNS2.Text).DisposeWith(disposables);
|
||||
|
||||
@@ -16,6 +16,17 @@ namespace v2rayN.Views
|
||||
public GlobalHotkeySettingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
_config = LazyConfig.Instance.GetConfig();
|
||||
_config.globalHotkeys ??= new List<KeyEventItem>();
|
||||
@@ -101,7 +112,7 @@ namespace v2rayN.Views
|
||||
{
|
||||
_config.globalHotkeys = _TextBoxKeyEventItem.Values.ToList();
|
||||
|
||||
if (ConfigHandler.SaveConfig(ref _config, false) == 0)
|
||||
if (ConfigHandler.SaveConfig(_config, false) == 0)
|
||||
{
|
||||
HotkeyHandler.Instance.ReLoad();
|
||||
this.DialogResult = true;
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
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:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
xmlns:conv="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:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
xmlns:local="clr-namespace:v2rayN.Views"
|
||||
Title="v2rayN"
|
||||
Width="900"
|
||||
Height="700"
|
||||
MinWidth="900"
|
||||
MinHeight="700"
|
||||
x:TypeArguments="vms:MainWindowViewModel"
|
||||
Background="{DynamicResource MaterialDesignPaper}"
|
||||
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
|
||||
@@ -85,6 +83,14 @@
|
||||
x:Name="menuAddTrojanServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuAddTrojanServer}" />
|
||||
<MenuItem
|
||||
x:Name="menuAddHysteria2Server"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuAddHysteria2Server}" />
|
||||
<MenuItem
|
||||
x:Name="menuAddTuicServer"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuAddTuicServer}" />
|
||||
<Separator Margin="-40,5" />
|
||||
<MenuItem
|
||||
x:Name="menuAddServerViaClipboard"
|
||||
@@ -210,19 +216,19 @@
|
||||
x:Name="menuCheckUpdateN"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="V2rayN" />
|
||||
<MenuItem
|
||||
<!--<MenuItem
|
||||
x:Name="menuCheckUpdateV2flyCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="V2fly v5 Core" />
|
||||
<MenuItem
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateSagerNetCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="SagerNet Core" />
|
||||
Header="SagerNet Core" />-->
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateXrayCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="Xray Core" />
|
||||
<Separator Margin="-40,5" />
|
||||
<!--<Separator Margin="-40,5" />
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateClashCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
@@ -231,7 +237,7 @@
|
||||
x:Name="menuCheckUpdateClashMetaCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="Clash.Meta Core" />
|
||||
<Separator Margin="-40,5" />
|
||||
<Separator Margin="-40,5" />-->
|
||||
<MenuItem
|
||||
x:Name="menuCheckUpdateSingBoxCore"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
@@ -386,6 +392,7 @@
|
||||
<WrapPanel Margin="2" DockPanel.Dock="Top">
|
||||
<ListBox
|
||||
x:Name="lstGroup"
|
||||
MaxHeight="120"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
ItemContainerStyle="{StaticResource MyChipListBoxItem}"
|
||||
Style="{StaticResource MaterialDesignChoiceChipPrimaryOutlineListBox}">
|
||||
@@ -748,12 +755,17 @@
|
||||
</DataGrid>
|
||||
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
|
||||
<local:MsgView Grid.Row="2" />
|
||||
<materialDesign:Snackbar
|
||||
x:Name="MainSnackbar"
|
||||
Grid.Row="2"
|
||||
MessageQueue="{materialDesign:MessageQueue}" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
<tb:TaskbarIcon
|
||||
x:Name="tbNotify"
|
||||
IconSource="/v2rayN.ico"
|
||||
NoLeftClickDelay="True">
|
||||
NoLeftClickDelay="True"
|
||||
ToolTipText="v2rayN">
|
||||
<tb:TaskbarIcon.ContextMenu>
|
||||
<ContextMenu Style="{StaticResource DefContextMenu}">
|
||||
<MenuItem x:Name="menuSystemProxyClear" Height="{StaticResource MenuItemHeight}">
|
||||
@@ -857,7 +869,6 @@
|
||||
</ContextMenu>
|
||||
</tb:TaskbarIcon.ContextMenu>
|
||||
</tb:TaskbarIcon>
|
||||
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{materialDesign:MessageQueue}" />
|
||||
</Grid>
|
||||
</materialDesign:DialogHost>
|
||||
</reactiveui:ReactiveWindow>
|
||||
@@ -25,6 +25,19 @@ namespace v2rayN.Views
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
lstGroup.MaxHeight = Math.Floor(SystemParameters.WorkArea.Height * 0.20 / 40) * 40;
|
||||
|
||||
_config = LazyConfig.Instance.GetConfig();
|
||||
|
||||
App.Current.SessionEnding += Current_SessionEnding;
|
||||
@@ -73,6 +86,8 @@ namespace v2rayN.Views
|
||||
this.BindCommand(ViewModel, vm => vm.AddShadowsocksServerCmd, v => v.menuAddShadowsocksServer).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddSocksServerCmd, v => v.menuAddSocksServer).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddTrojanServerCmd, v => v.menuAddTrojanServer).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddHysteria2ServerCmd, v => v.menuAddHysteria2Server).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddCustomServerCmd, v => v.menuAddCustomServer).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddServerViaClipboardCmd, v => v.menuAddServerViaClipboard).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.AddServerViaScanCmd, v => v.menuAddServerViaScan).DisposeWith(disposables);
|
||||
@@ -125,11 +140,11 @@ namespace v2rayN.Views
|
||||
|
||||
//checkupdate
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateV2flyCoreCmd, v => v.menuCheckUpdateV2flyCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateSagerNetCoreCmd, v => v.menuCheckUpdateSagerNetCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
|
||||
//this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
|
||||
|
||||
@@ -163,7 +178,7 @@ namespace v2rayN.Views
|
||||
this.BindCommand(ViewModel, vm => vm.SubUpdateViaProxyCmd, v => v.menuSubUpdateViaProxy2).DisposeWith(disposables);
|
||||
|
||||
this.OneWayBind(ViewModel, vm => vm.NotifyIcon, v => v.tbNotify.Icon).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables);
|
||||
this.OneWayBind(ViewModel, vm => vm.AppIcon, v => v.Icon).DisposeWith(disposables);
|
||||
//this.OneWayBind(ViewModel, vm => vm.BlShowTrayTip, v => v.borTrayToolTip.Visibility).DisposeWith(disposables);
|
||||
@@ -309,33 +324,35 @@ namespace v2rayN.Views
|
||||
{
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
||||
{
|
||||
if (e.Key == Key.V)
|
||||
switch (e.Key)
|
||||
{
|
||||
ViewModel?.AddServerViaClipboard();
|
||||
}
|
||||
else if (e.Key == Key.P)
|
||||
{
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Ping);
|
||||
}
|
||||
else if (e.Key == Key.O)
|
||||
{
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Tcping);
|
||||
}
|
||||
else if (e.Key == Key.R)
|
||||
{
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Realping);
|
||||
}
|
||||
else if (e.Key == Key.S)
|
||||
{
|
||||
_ = ViewModel?.ScanScreenTaskAsync();
|
||||
}
|
||||
else if (e.Key == Key.T)
|
||||
{
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Speedtest);
|
||||
}
|
||||
else if (e.Key == Key.E)
|
||||
{
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Mixedtest);
|
||||
case Key.V:
|
||||
ViewModel?.AddServerViaClipboard();
|
||||
break;
|
||||
|
||||
case Key.P:
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Ping);
|
||||
break;
|
||||
|
||||
case Key.O:
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Tcping);
|
||||
break;
|
||||
|
||||
case Key.R:
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Realping);
|
||||
break;
|
||||
|
||||
case Key.S:
|
||||
_ = ViewModel?.ScanScreenTaskAsync();
|
||||
break;
|
||||
|
||||
case Key.T:
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Speedtest);
|
||||
break;
|
||||
|
||||
case Key.E:
|
||||
ViewModel?.ServerSpeedtest(ESpeedActionType.Mixedtest);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -485,11 +502,18 @@ namespace v2rayN.Views
|
||||
|
||||
if (!_config.guiItem.enableStatistics)
|
||||
{
|
||||
colTodayUp.Visibility = Visibility.Hidden;
|
||||
colTodayDown.Visibility = Visibility.Hidden;
|
||||
colTotalUp.Visibility = Visibility.Hidden;
|
||||
colTodayUp.Visibility =
|
||||
colTodayDown.Visibility =
|
||||
colTotalUp.Visibility =
|
||||
colTotalDown.Visibility = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
colTodayUp.Visibility =
|
||||
colTodayDown.Visibility =
|
||||
colTotalUp.Visibility =
|
||||
colTotalDown.Visibility = Visibility.Visible;
|
||||
}
|
||||
}
|
||||
|
||||
private void StorageUI()
|
||||
@@ -517,12 +541,12 @@ namespace v2rayN.Views
|
||||
private void AddHelpMenuItem()
|
||||
{
|
||||
var coreInfos = LazyConfig.Instance.GetCoreInfos();
|
||||
foreach (var it in coreInfos)
|
||||
foreach (var it in coreInfos
|
||||
.Where(t => t.coreType != ECoreType.v2fly
|
||||
&& t.coreType != ECoreType.clash
|
||||
&& t.coreType != ECoreType.clash_meta
|
||||
&& t.coreType != ECoreType.hysteria))
|
||||
{
|
||||
if (it.coreType == ECoreType.v2fly)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var item = new MenuItem()
|
||||
{
|
||||
Tag = it.coreUrl.Replace(@"/releases", ""),
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.OptionSettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
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: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:resx="clr-namespace:v2rayN.Resx"
|
||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||
Title="{x:Static resx:ResUI.menuSetting}"
|
||||
@@ -68,6 +68,7 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -307,6 +308,33 @@
|
||||
Width="200"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="15"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsHysteriaBandwidth}" />
|
||||
|
||||
<StackPanel
|
||||
Grid.Row="15"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
|
||||
<TextBox
|
||||
x:Name="txtUpMbps"
|
||||
Width="90"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
materialDesign:HintAssist.Hint="Up"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
<TextBox
|
||||
x:Name="txtDownMbps"
|
||||
Width="90"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
materialDesign:HintAssist.Hint="Down"
|
||||
Style="{StaticResource DefTextBox}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</TabItem>
|
||||
@@ -777,6 +805,8 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -829,6 +859,34 @@
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
Style="{StaticResource DefComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="5"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" />
|
||||
<ToggleButton
|
||||
x:Name="togEnableExInbound"
|
||||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="6"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" />
|
||||
<ToggleButton
|
||||
x:Name="togEnableIPv6Address"
|
||||
Grid.Row="6"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
|
||||
@@ -18,6 +18,17 @@ namespace v2rayN.Views
|
||||
public OptionSettingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
_config = LazyConfig.Instance.GetConfig();
|
||||
|
||||
@@ -27,15 +38,15 @@ namespace v2rayN.Views
|
||||
{
|
||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
||||
});
|
||||
Global.LogLevel.ForEach(it =>
|
||||
Global.LogLevels.ForEach(it =>
|
||||
{
|
||||
cmbloglevel.Items.Add(it);
|
||||
});
|
||||
Global.fingerprints.ForEach(it =>
|
||||
Global.Fingerprints.ForEach(it =>
|
||||
{
|
||||
cmbdefFingerprint.Items.Add(it);
|
||||
});
|
||||
Global.userAgent.ForEach(it =>
|
||||
Global.UserAgent.ForEach(it =>
|
||||
{
|
||||
cmbdefUserAgent.Items.Add(it);
|
||||
});
|
||||
@@ -52,7 +63,7 @@ namespace v2rayN.Views
|
||||
{
|
||||
cmbStack.Items.Add(it);
|
||||
});
|
||||
Global.coreTypes.ForEach(it =>
|
||||
Global.CoreTypes.ForEach(it =>
|
||||
{
|
||||
cmbCoreType1.Items.Add(it);
|
||||
cmbCoreType2.Items.Add(it);
|
||||
@@ -78,7 +89,12 @@ namespace v2rayN.Views
|
||||
//fill fonts
|
||||
try
|
||||
{
|
||||
var files = Directory.GetFiles(Utils.GetFontsPath(), "*.ttf");
|
||||
string[] searchPatterns = { "*.ttf", "*.ttc" };
|
||||
var files = new List<string>();
|
||||
foreach (var pattern in searchPatterns)
|
||||
{
|
||||
files.AddRange(Directory.GetFiles(Utils.GetFontsPath(), pattern));
|
||||
}
|
||||
var culture = _config.uiItem.currentLanguage == Global.Languages[0] ? "zh-cn" : "en-us";
|
||||
var culture2 = "en-us";
|
||||
foreach (var ttf in files)
|
||||
@@ -135,6 +151,8 @@ namespace v2rayN.Views
|
||||
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.hyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.hyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
|
||||
|
||||
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.Text).DisposeWith(disposables);
|
||||
//this.Bind(ViewModel, vm => vm.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
||||
@@ -168,6 +186,8 @@ namespace v2rayN.Views
|
||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunEnableExInbound, v => v.togEnableExInbound.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
||||
|
||||
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
||||
|
||||
@@ -12,16 +12,27 @@ namespace v2rayN.Views
|
||||
public RoutingRuleDetailsWindow(RulesItem rulesItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Loaded += Window_Loaded;
|
||||
clbProtocol.SelectionChanged += ClbProtocol_SelectionChanged;
|
||||
clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged;
|
||||
|
||||
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, this);
|
||||
cmbOutboundTag.Items.Add(Global.agentTag);
|
||||
cmbOutboundTag.Items.Add(Global.directTag);
|
||||
cmbOutboundTag.Items.Add(Global.blockTag);
|
||||
Global.Protocols.ForEach(it =>
|
||||
cmbOutboundTag.Items.Add(Global.ProxyTag);
|
||||
cmbOutboundTag.Items.Add(Global.DirectTag);
|
||||
cmbOutboundTag.Items.Add(Global.BlockTag);
|
||||
Global.RuleProtocols.ForEach(it =>
|
||||
{
|
||||
clbProtocol.Items.Add(it);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,17 @@ namespace v2rayN.Views
|
||||
public RoutingRuleSettingWindow(RoutingItem routingItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Loaded += Window_Loaded;
|
||||
this.PreviewKeyDown += RoutingRuleSettingWindow_PreviewKeyDown;
|
||||
@@ -20,12 +31,12 @@ namespace v2rayN.Views
|
||||
lstRules.MouseDoubleClick += LstRules_MouseDoubleClick;
|
||||
|
||||
ViewModel = new RoutingRuleSettingViewModel(routingItem, this);
|
||||
Global.domainStrategys.ForEach(it =>
|
||||
Global.DomainStrategys.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy.Items.Add(it);
|
||||
});
|
||||
cmbdomainStrategy.Items.Add(string.Empty);
|
||||
Global.domainStrategys4Singbox.ForEach(it =>
|
||||
Global.DomainStrategys4Singbox.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
||||
});
|
||||
@@ -121,7 +132,7 @@ namespace v2rayN.Views
|
||||
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
var openFileDialog1 = new OpenFileDialog();
|
||||
openFileDialog1.Filter = "PNG|*.png";
|
||||
openFileDialog1.Filter = "PNG,ICO|*.png;*.ico";
|
||||
openFileDialog1.ShowDialog();
|
||||
|
||||
txtCustomIcon.Text = openFileDialog1.FileName;
|
||||
|
||||
@@ -12,6 +12,17 @@ namespace v2rayN.Views
|
||||
public RoutingSettingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Closing += RoutingSettingWindow_Closing;
|
||||
this.PreviewKeyDown += RoutingSettingWindow_PreviewKeyDown;
|
||||
@@ -20,15 +31,15 @@ namespace v2rayN.Views
|
||||
|
||||
ViewModel = new RoutingSettingViewModel(this);
|
||||
|
||||
Global.domainStrategys.ForEach(it =>
|
||||
Global.DomainStrategys.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy.Items.Add(it);
|
||||
});
|
||||
Global.domainMatchers.ForEach(it =>
|
||||
Global.DomainMatchers.ForEach(it =>
|
||||
{
|
||||
cmbdomainMatcher.Items.Add(it);
|
||||
});
|
||||
Global.domainStrategys4Singbox.ForEach(it =>
|
||||
Global.DomainStrategys4Singbox.ForEach(it =>
|
||||
{
|
||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
||||
});
|
||||
@@ -77,6 +88,11 @@ namespace v2rayN.Views
|
||||
|
||||
private void RoutingSettingWindow_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
if (ViewModel?.enableRoutingBasic ?? false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
||||
{
|
||||
if (e.Key == Key.A)
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<reactiveui:ReactiveWindow
|
||||
x:Class="v2rayN.Views.SubEditWindow"
|
||||
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.menuSubSetting}"
|
||||
@@ -30,17 +30,38 @@
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel Margin="8">
|
||||
<Grid
|
||||
Margin="8"
|
||||
HorizontalAlignment="Center"
|
||||
DockPanel.Dock="Bottom">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="btnSave"
|
||||
Grid.Column="0"
|
||||
Margin="4"
|
||||
Content="{x:Static resx:ResUI.TbConfirm}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
Grid.Column="1"
|
||||
Margin="4"
|
||||
Click="btnCancel_Click"
|
||||
Content="{x:Static resx:ResUI.TbCancel}"
|
||||
Cursor="Hand"
|
||||
IsCancel="true"
|
||||
Style="{StaticResource DefButton}" />
|
||||
</Grid>
|
||||
<ScrollViewer
|
||||
materialDesign:ScrollViewerAssist.IsAutoHideEnabled="True"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
|
||||
<ScrollViewer
|
||||
materialDesign:ScrollViewerAssist.IsAutoHideEnabled="True"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Grid Margin="8">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -51,6 +72,8 @@
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
@@ -209,9 +232,8 @@
|
||||
Grid.Column="1"
|
||||
Margin="4"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvConvertTargetTip}"
|
||||
FontSize="{DynamicResource StdFontSize}"
|
||||
MaxDropDownHeight="1000"
|
||||
Style="{StaticResource MaterialDesignOutlinedComboBox}" />
|
||||
Style="{StaticResource MyOutlinedTextComboBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="8"
|
||||
@@ -229,32 +251,43 @@
|
||||
VerticalAlignment="Top"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
</Grid>
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="btnSave"
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="9"
|
||||
Grid.Column="0"
|
||||
Margin="4"
|
||||
Content="{x:Static resx:ResUI.TbConfirm}"
|
||||
Cursor="Hand"
|
||||
Style="{StaticResource DefButton}" />
|
||||
<Button
|
||||
x:Name="btnCancel"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.LvPrevProfile}" />
|
||||
<TextBox
|
||||
x:Name="txtPrevProfile"
|
||||
Grid.Row="9"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="4"
|
||||
Click="btnCancel_Click"
|
||||
Content="{x:Static resx:ResUI.TbCancel}"
|
||||
Cursor="Hand"
|
||||
IsCancel="true"
|
||||
Style="{StaticResource DefButton}" />
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="10"
|
||||
Grid.Column="0"
|
||||
Margin="4"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.LvNextProfile}" />
|
||||
<TextBox
|
||||
x:Name="txtNextProfile"
|
||||
Grid.Row="10"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="4"
|
||||
VerticalAlignment="Top"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</ScrollViewer>
|
||||
</DockPanel>
|
||||
</reactiveui:ReactiveWindow>
|
||||
@@ -11,6 +11,17 @@ namespace v2rayN.Views
|
||||
public SubEditWindow(SubItem subItem)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
this.Loaded += Window_Loaded;
|
||||
|
||||
@@ -32,6 +43,8 @@ namespace v2rayN.Views
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.sort, v => v.txtSort.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.filter, v => v.txtFilter.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.convertTarget, v => v.cmbConvertTarget.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.prevProfile, v => v.txtPrevProfile.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.nextProfile, v => v.txtNextProfile.Text).DisposeWith(disposables);
|
||||
|
||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||
});
|
||||
|
||||
@@ -13,6 +13,17 @@ namespace v2rayN.Views
|
||||
public SubSettingWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// 设置窗口的尺寸不大于屏幕的尺寸
|
||||
if (this.Width > SystemParameters.WorkArea.Width)
|
||||
{
|
||||
this.Width = SystemParameters.WorkArea.Width;
|
||||
}
|
||||
if (this.Height > SystemParameters.WorkArea.Height)
|
||||
{
|
||||
this.Height = SystemParameters.WorkArea.Height;
|
||||
}
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
|
||||
ViewModel = new SubSettingViewModel(this);
|
||||
|
||||
@@ -9,28 +9,29 @@
|
||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
|
||||
<FileVersion>6.27</FileVersion>
|
||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||
<FileVersion>6.33</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Downloader" Version="3.0.6" />
|
||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.108" />
|
||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.124" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
|
||||
<PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
|
||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
||||
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
||||
<PackageReference Include="ReactiveUI.Fody" Version="18.4.1" />
|
||||
<PackageReference Include="ReactiveUI.Validation" Version="3.0.22" />
|
||||
<PackageReference Include="ReactiveUI.WPF" Version="18.4.1" />
|
||||
<PackageReference Include="Splat.NLog" Version="14.6.37" />
|
||||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.39" />
|
||||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
|
||||
<PackageReference Include="ReactiveUI.WPF" Version="19.5.39" />
|
||||
<PackageReference Include="Splat.NLog" Version="14.8.12" />
|
||||
<PackageReference Include="System.Reactive" Version="6.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="app.manifest" />
|
||||
<EmbeddedResource Include="Sample\SingboxSampleOutbound" />
|
||||
<EmbeddedResource Include="Sample\SingboxSampleClientConfig">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
@@ -63,8 +64,9 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\SampleInbound">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\tun_singbox_rules">
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\SampleOutbound" />
|
||||
<EmbeddedResource Include="Sample\tun_singbox_rules">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Sample\tun_singbox_inbound">
|
||||
@@ -108,6 +110,9 @@
|
||||
<EmbeddedResource Update="Resx\ResUI.zh-Hans.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Resx\ResUI.zh-Hant.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Resx\ResUI.fa-Ir.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
|
||||
@@ -92,9 +92,9 @@ namespace v2rayUpgrade
|
||||
File.Move(Application.ExecutablePath, thisAppOldFile);
|
||||
}
|
||||
|
||||
string entryOuputPath = GetPath(fullName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(entryOuputPath)!);
|
||||
entry.ExtractToFile(entryOuputPath, true);
|
||||
string entryOutputPath = GetPath(fullName);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
|
||||
entry.ExtractToFile(entryOutputPath, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -145,4 +145,4 @@ namespace v2rayUpgrade
|
||||
return Path.Combine(startupPath, fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ namespace v2rayUpgrade
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm(args));
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
Reference in New Issue
Block a user