mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
m
This commit is contained in:
49
.github/workflows/build.yml
vendored
Normal file
49
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: Netch CI
|
||||||
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build
|
||||||
|
runs-on: windows-latest
|
||||||
|
env:
|
||||||
|
NetchDataURL: https://github.com/NetchX/NetchData/archive/refs/heads/master.zip
|
||||||
|
NetchModeURL: https://github.com/NetchX/NetchMode/archive/refs/heads/master.zip
|
||||||
|
NetchI18NURL: https://github.com/NetchX/NetchTranslation/archive/refs/heads/master.zip
|
||||||
|
steps:
|
||||||
|
- name: MSBuild
|
||||||
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Submodule
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
New-Item -ItemType Directory -Name release
|
||||||
|
Set-Location release
|
||||||
|
|
||||||
|
Invoke-WebRequest -Uri $NetchDataURL -OutFile data.zip
|
||||||
|
Invoke-WebRequest -Uri $NetchModeURL -OutFile mode.zip
|
||||||
|
Invoke-WebRequest -Uri $NetchI18NURL -OutFile i18n.zip
|
||||||
|
|
||||||
|
Expand-Archive -Force -Path data.zip -DestinationPath bin
|
||||||
|
Expand-Archive -Force -Path mode.zip -DestinationPath .
|
||||||
|
Expand-Archive -Force -Path i18n.zip -DestinationPath .
|
||||||
|
|
||||||
|
Remove-Item -Force README.md
|
||||||
|
Remove-Item -Force data.zip
|
||||||
|
Remove-Item -Force mode.zip
|
||||||
|
Remove-Item -Force i18n.zip
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
shell: pwsh
|
||||||
|
run: .\build.ps1 Release -o release
|
||||||
|
|
||||||
|
- name: Upload
|
||||||
|
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: Netch
|
||||||
|
path: release
|
||||||
37
.github/workflows/ci.yml
vendored
37
.github/workflows/ci.yml
vendored
@@ -1,37 +0,0 @@
|
|||||||
name: Netch CI
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches-ignore:
|
|
||||||
dependabot/**
|
|
||||||
pull_request:
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
name: Build
|
|
||||||
runs-on: windows-latest
|
|
||||||
env:
|
|
||||||
OutputPath: Netch\bin\Publish\Debug
|
|
||||||
steps:
|
|
||||||
- name: Setup MSBuild
|
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
fetch-depth: 1
|
|
||||||
|
|
||||||
- name: Binaries Repo LFS Pull
|
|
||||||
working-directory: binaries
|
|
||||||
run: git lfs pull
|
|
||||||
|
|
||||||
- name: Build Solution
|
|
||||||
shell: pwsh
|
|
||||||
run: .\BUILD.ps1 Release -o ${{ env.OutputPath }}
|
|
||||||
|
|
||||||
- name: Upload Artifact
|
|
||||||
continue-on-error: true
|
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: Netch
|
|
||||||
path: ${{ env.OutputPath }}
|
|
||||||
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Netch Release
|
name: Netch CI
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
@@ -8,20 +8,15 @@ jobs:
|
|||||||
name: Build
|
name: Build
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Setup MSBuild
|
- name: MSBuild
|
||||||
uses: microsoft/setup-msbuild@v1.0.2
|
uses: microsoft/setup-msbuild@v1.0.2
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: true
|
|
||||||
fetch-depth: 1
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Binaries Repo LFS Pull
|
- name: Build
|
||||||
working-directory: binaries
|
|
||||||
run: git lfs pull
|
|
||||||
|
|
||||||
- name: Build Solution
|
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: .\BUILD.ps1
|
run: .\BUILD.ps1
|
||||||
|
|
||||||
@@ -31,8 +26,8 @@ jobs:
|
|||||||
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
|
New-Item -ItemType Directory -Path C:\builtfiles -Force > $null
|
||||||
7z a -mx9 C:\builtfiles\Netch.7z .\Netch\bin\Publish\
|
7z a -mx9 C:\builtfiles\Netch.7z .\Netch\bin\Publish\
|
||||||
7z rn C:\builtfiles\Netch.7z Publish Netch
|
7z rn C:\builtfiles\Netch.7z Publish Netch
|
||||||
echo "Netch_SHA256=$(.\GetSHA256.ps1 C:\builtfiles\Netch.7z)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "Netch_SHA256=$(.\sha256.ps1 C:\builtfiles\Netch.7z)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
echo "Netch_EXE_SHA256=$(.\GetSHA256.ps1 Netch\bin\Publish\Netch.exe)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
echo "Netch_EXE_SHA256=$(.\sha256.ps1 Netch\bin\Publish\Netch.exe)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v1
|
uses: softprops/action-gh-release@v1
|
||||||
|
|||||||
9
.gitmodules
vendored
9
.gitmodules
vendored
@@ -1,9 +0,0 @@
|
|||||||
[submodule "binaries"]
|
|
||||||
path = binaries
|
|
||||||
url = https://github.com/NetchX/data
|
|
||||||
[submodule "modes"]
|
|
||||||
path = modes
|
|
||||||
url = https://github.com/NetchX/NetchMode
|
|
||||||
[submodule "translations"]
|
|
||||||
path = translations
|
|
||||||
url = https://github.com/NetchX/NetchTranslation
|
|
||||||
@@ -5,8 +5,6 @@ VisualStudioVersion = 16.0.29009.5
|
|||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Netch", "Netch\Netch.csproj", "{4B041B91-5790-4571-8C58-C63FFE4BC9F8}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{53397641-35CA-4336-8E22-2CE12EF476AC}"
|
|
||||||
EndProject
|
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
@@ -17,9 +15,6 @@ Global
|
|||||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64
|
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Debug|x64.Build.0 = Debug|x64
|
||||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64
|
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
|
{4B041B91-5790-4571-8C58-C63FFE4BC9F8}.Release|x64.Build.0 = Release|x64
|
||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{53397641-35CA-4336-8E22-2CE12EF476AC}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -1,44 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Netch.Utils;
|
|
||||||
|
|
||||||
namespace UnitTest
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class Function : TestBase
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void LoadLanguage()
|
|
||||||
{
|
|
||||||
void TestLoad(string t)
|
|
||||||
{
|
|
||||||
Console.WriteLine($"Load: {t}");
|
|
||||||
i18N.Load(t);
|
|
||||||
Console.WriteLine($"Result: {i18N.LangCode}\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
Directory.CreateDirectory("logging");
|
|
||||||
TestLoad("System");
|
|
||||||
TestLoad("en-US");
|
|
||||||
TestLoad("zh-CN");
|
|
||||||
TestLoad("zh-HK");
|
|
||||||
TestLoad("zh");
|
|
||||||
TestLoad("HND123&*$_-^$@SAUI");
|
|
||||||
TestLoad("");
|
|
||||||
TestLoad("-");
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void TestMaskToCidr()
|
|
||||||
{
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("0.0.0.0"), 0);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("248.0.0.0"), 5);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("255.0.0.0"), 8);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("255.255.0.0"), 16);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("255.255.248.0"), 21);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("255.255.255.0"), 24);
|
|
||||||
Assert.AreEqual(Utils.SubnetToCidr("255.255.255.255"), 32);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Netch.Models;
|
|
||||||
|
|
||||||
namespace UnitTest
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class ParameterTest
|
|
||||||
{
|
|
||||||
[Verb]
|
|
||||||
private class VerbAndRealName : ParameterBase
|
|
||||||
{
|
|
||||||
[RealName("v")]
|
|
||||||
public string v1 { get; } = "a";
|
|
||||||
|
|
||||||
[RealName("v")]
|
|
||||||
public string v2 { get; } = "b";
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Full : ParameterBase
|
|
||||||
{
|
|
||||||
[RealName("f")]
|
|
||||||
public string f1 { get; } = "a";
|
|
||||||
|
|
||||||
[RealName("f")]
|
|
||||||
public string f2 { get; } = "b";
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FullWithVerb : ParameterBase
|
|
||||||
{
|
|
||||||
public string f { get; } = "a";
|
|
||||||
|
|
||||||
[Verb]
|
|
||||||
public string v { get; } = "b";
|
|
||||||
}
|
|
||||||
|
|
||||||
[Verb]
|
|
||||||
private class VerbWithFull : ParameterBase
|
|
||||||
{
|
|
||||||
public string v { get; } = "a";
|
|
||||||
|
|
||||||
[Full]
|
|
||||||
public string f { get; } = "b";
|
|
||||||
}
|
|
||||||
|
|
||||||
private class QuoteValue : ParameterBase
|
|
||||||
{
|
|
||||||
public static string pathValue = @"C:\Programe Files\Damn thats space";
|
|
||||||
|
|
||||||
[Quote]
|
|
||||||
public string path { get; set; } = pathValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FlagAndOptional : ParameterBase
|
|
||||||
{
|
|
||||||
public bool a { get; set; } = true;
|
|
||||||
|
|
||||||
public bool b { get; set; } = false;
|
|
||||||
|
|
||||||
[Optional]
|
|
||||||
public string c { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
[Optional]
|
|
||||||
public string? d { get; set; } = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RequiredEmpty : ParameterBase
|
|
||||||
{
|
|
||||||
public string? udp { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class RequiredNull : ParameterBase
|
|
||||||
{
|
|
||||||
public string? udp { get; set; } = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Number : ParameterBase
|
|
||||||
{
|
|
||||||
public ushort a { get; set; } = 1;
|
|
||||||
|
|
||||||
public int b { get; set; } = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void Test()
|
|
||||||
{
|
|
||||||
Assert.AreEqual(new VerbAndRealName().ToString(), "-v a -v b");
|
|
||||||
Assert.AreEqual(new Full().ToString(), "--f a --f b");
|
|
||||||
Assert.AreEqual(new FullWithVerb().ToString(), "--f a -v b");
|
|
||||||
Assert.AreEqual(new VerbWithFull().ToString(), "-v a --f b");
|
|
||||||
Assert.AreEqual(new QuoteValue().ToString(), $"--path \"{QuoteValue.pathValue}\"");
|
|
||||||
Assert.AreEqual(new FlagAndOptional().ToString(), "--a");
|
|
||||||
Assert.ThrowsException<RequiredArgumentValueInvalidException>(() => { _ = new RequiredEmpty().ToString(); });
|
|
||||||
Assert.ThrowsException<RequiredArgumentValueInvalidException>(() => { _ = new RequiredNull().ToString(); });
|
|
||||||
Assert.AreEqual(new Number().ToString(), "--a 1 --b 1");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,89 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text.Json;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Netch;
|
|
||||||
using Netch.Servers.ShadowsocksR;
|
|
||||||
using Netch.Servers.VMess;
|
|
||||||
using Netch.Utils;
|
|
||||||
|
|
||||||
namespace UnitTest
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class ParseShareLink : TestBase
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void ParseSSR()
|
|
||||||
{
|
|
||||||
const string normalCase =
|
|
||||||
"ssr://MTI3LjAuMC4xOjEyMzQ6YXV0aF9hZXMxMjhfbWQ1OmFlcy0xMjgtY2ZiOnRsczEuMl90aWNrZXRfYXV0aDpZV0ZoWW1KaS8_b2Jmc3BhcmFtPVluSmxZV3QzWVRFeExtMXZaUQ";
|
|
||||||
|
|
||||||
var server = (ShadowsocksR) ShareLink.ParseText(normalCase).First();
|
|
||||||
Assert.AreEqual(server.Hostname, "127.0.0.1");
|
|
||||||
Assert.AreEqual(server.Port, (ushort) 1234);
|
|
||||||
Assert.AreEqual(server.Protocol, "auth_aes128_md5");
|
|
||||||
Assert.AreEqual(server.EncryptMethod, "aes-128-cfb");
|
|
||||||
Assert.AreEqual(server.OBFS, "tls1.2_ticket_auth");
|
|
||||||
Assert.AreEqual(server.OBFSParam, "breakwa11.moe");
|
|
||||||
Assert.AreEqual(server.Password, "aaabbb");
|
|
||||||
|
|
||||||
|
|
||||||
const string normalCaseWithRemark =
|
|
||||||
"ssr://MTI3LjAuMC4xOjEyMzQ6YXV0aF9hZXMxMjhfbWQ1OmFlcy0xMjgtY2ZiOnRsczEuMl90aWNrZXRfYXV0aDpZV0ZoWW1KaS8_b2Jmc3BhcmFtPVluSmxZV3QzWVRFeExtMXZaUSZyZW1hcmtzPTVyV0w2Sy1WNUxpdDVwYUg";
|
|
||||||
|
|
||||||
server = (ShadowsocksR) ShareLink.ParseText(normalCaseWithRemark).First();
|
|
||||||
Assert.AreEqual(server.Hostname, "127.0.0.1");
|
|
||||||
Assert.AreEqual(server.Port, (ushort) 1234);
|
|
||||||
Assert.AreEqual(server.Protocol, "auth_aes128_md5");
|
|
||||||
Assert.AreEqual(server.EncryptMethod, "aes-128-cfb");
|
|
||||||
Assert.AreEqual(server.OBFS, "tls1.2_ticket_auth");
|
|
||||||
Assert.AreEqual(server.OBFSParam, "breakwa11.moe");
|
|
||||||
Assert.AreEqual(server.Password, "aaabbb");
|
|
||||||
Assert.AreEqual(server.Remark, "测试中文");
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void ParseV2RayNFormatUri()
|
|
||||||
{
|
|
||||||
var server = (VMess) ShareLink.ParseText(
|
|
||||||
@"vmess://eyAidiI6ICIyIiwgInBzIjogIuWkh+azqOWIq+WQjSIsICJhZGQiOiAiMTExLjExMS4xMTEuMTExIiwgInBvcnQiOiAiMzIwMDAiLCAiaWQiOiAiMTM4NmY4NWUtNjU3Yi00ZDZlLTlkNTYtNzhiYWRiNzVlMWZkIiwgImFpZCI6ICIxMDAiLCAibmV0IjogInRjcCIsICJ0eXBlIjogIm5vbmUiLCAiaG9zdCI6ICJ3d3cuYmJiLmNvbSIsICJwYXRoIjogIi8iLCAidGxzIjogInRscyIgfQ==")
|
|
||||||
.First();
|
|
||||||
|
|
||||||
Assert.AreEqual(server.Remark, "备注别名");
|
|
||||||
Assert.AreEqual(server.Hostname, "111.111.111.111");
|
|
||||||
Assert.AreEqual(server.Port, (ushort) 32000);
|
|
||||||
Assert.AreEqual(server.UserID, "1386f85e-657b-4d6e-9d56-78badb75e1fd");
|
|
||||||
Assert.AreEqual(server.AlterID, 100);
|
|
||||||
Assert.AreEqual(server.TransferProtocol, "tcp");
|
|
||||||
Assert.AreEqual(server.FakeType, "none");
|
|
||||||
Assert.AreEqual(server.Host, "www.bbb.com");
|
|
||||||
Assert.AreEqual(server.Path, "/");
|
|
||||||
Assert.AreEqual(server.TLSSecureType, "tls");
|
|
||||||
}
|
|
||||||
|
|
||||||
[TestMethod]
|
|
||||||
public void ParseVLESSUri()
|
|
||||||
{
|
|
||||||
var servers = ShareLink.ParseText(@"vmess://99c80931-f3f1-4f84-bffd-6eed6030f53d@qv2ray.net:31415?encryption=none#VMessTCPNaked
|
|
||||||
vmess://f08a563a-674d-4ffb-9f02-89d28aec96c9@qv2ray.net:9265#VMessTCPAuto
|
|
||||||
vmess://5dc94f3a-ecf0-42d8-ae27-722a68a6456c@qv2ray.net:35897?encryption=aes-128-gcm#VMessTCPAES
|
|
||||||
vmess://136ca332-f855-4b53-a7cc-d9b8bff1a8d7@qv2ray.net:9323?encryption=none&security=tls#VMessTCPTLSNaked
|
|
||||||
vmess://be5459d9-2dc8-4f47-bf4d-8b479fc4069d@qv2ray.net:8462?security=tls#VMessTCPTLS
|
|
||||||
vmess://c7199cd9-964b-4321-9d33-842b6fcec068@qv2ray.net:64338?encryption=none&security=tls&sni=fastgit.org#VMessTCPTLSSNI
|
|
||||||
vless://b0dd64e4-0fbd-4038-9139-d1f32a68a0dc@qv2ray.net:3279?security=xtls&flow=rprx-xtls-splice#VLESSTCPXTLSSplice
|
|
||||||
vless://399ce595-894d-4d40-add1-7d87f1a3bd10@qv2ray.net:50288?type=kcp&seed=69f04be3-d64e-45a3-8550-af3172c63055#VLESSmKCPSeed
|
|
||||||
vless://399ce595-894d-4d40-add1-7d87f1a3bd10@qv2ray.net:41971?type=kcp&headerType=wireguard&seed=69f04be3-d64e-45a3-8550-af3172c63055#VLESSmKCPSeedWG
|
|
||||||
vmess://44efe52b-e143-46b5-a9e7-aadbfd77eb9c@qv2ray.net:6939?type=ws&security=tls&host=qv2ray.net&path=%2Fsomewhere#VMessWebSocketTLS");
|
|
||||||
|
|
||||||
foreach (var server in servers)
|
|
||||||
{
|
|
||||||
var jsonSerializerOptions = Global.NewDefaultJsonSerializerOptions;
|
|
||||||
jsonSerializerOptions.WriteIndented = false;
|
|
||||||
Console.WriteLine(JsonSerializer.Serialize<object>(server, jsonSerializerOptions) + "\n");
|
|
||||||
Assert.IsNotNull(server);
|
|
||||||
|
|
||||||
Assert.AreEqual(server.Hostname, "qv2ray.net");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Netch.Models.GitHubRelease;
|
|
||||||
|
|
||||||
namespace UnitTest
|
|
||||||
{
|
|
||||||
[TestClass]
|
|
||||||
public class SuffixVersionTest
|
|
||||||
{
|
|
||||||
[TestMethod]
|
|
||||||
public void Test()
|
|
||||||
{
|
|
||||||
var rel = SuffixVersion.Parse("1.0.0");
|
|
||||||
var a1 = SuffixVersion.Parse("1.0.0-Alpha1");
|
|
||||||
var a3 = SuffixVersion.Parse("1.0.0-aLpHa3");
|
|
||||||
var b2 = SuffixVersion.Parse("1.0.0-betA2");
|
|
||||||
|
|
||||||
Assert.AreEqual(rel.ToString(), "1.0.0");
|
|
||||||
Assert.AreEqual(a1.ToString(), "1.0.0-Alpha1");
|
|
||||||
Assert.IsTrue(rel.CompareTo(a1) > 0);
|
|
||||||
Assert.IsTrue(rel.CompareTo(b2) > 0);
|
|
||||||
|
|
||||||
Assert.IsTrue(b2.CompareTo(a1) > 0);
|
|
||||||
Assert.IsTrue(b2.CompareTo(a3) > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
namespace UnitTest
|
|
||||||
{
|
|
||||||
public class TestBase
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>net5.0-windows</TargetFramework>
|
|
||||||
<Platforms>x64</Platforms>
|
|
||||||
<UseWindowsForms>true</UseWindowsForms>
|
|
||||||
<LangVersion>latest</LangVersion>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Remove=".gitignore" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\Netch\Netch.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
|
|
||||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
|
|
||||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.3" />
|
|
||||||
<PackageReference Include="System.Text.Json" Version="5.0.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
|
|
||||||
1
binaries
1
binaries
Submodule binaries deleted from 6c3cc41c7c
1
modes
1
modes
Submodule modes deleted from 27d099ea8e
3
scripts/.gitignore
vendored
3
scripts/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
/release
|
|
||||||
/x64
|
|
||||||
/x86
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
RD /S /Q ..\Netch\bin > NUL 2>&1
|
|
||||||
RD /S /Q ..\Netch\obj > NUL 2>&1
|
|
||||||
MSBuild -m -r /t:Rebuild /p:Configuration=Release;Platform=x64 ..\Netch.sln
|
|
||||||
MSBuild -m -r /t:Rebuild /p:Configuration=Release;Platform=x86 ..\Netch.sln
|
|
||||||
PAUSE
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
RD /S /Q release > NUL 2>&1
|
|
||||||
RD /S /Q x64 > NUL 2>&1
|
|
||||||
RD /S /Q x86 > NUL 2>&1
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import hashlib, os
|
|
||||||
|
|
||||||
text = '''| 文件名 | SHA256 |
|
|
||||||
| :- | :- |'''
|
|
||||||
|
|
||||||
def checksum(filename):
|
|
||||||
algorithm = hashlib.sha256()
|
|
||||||
with open(filename, 'rb') as f:
|
|
||||||
for byte_block in iter(lambda: f.read(4096), b''):
|
|
||||||
algorithm.update(byte_block)
|
|
||||||
return str(algorithm.hexdigest())
|
|
||||||
|
|
||||||
|
|
||||||
def filelist(path):
|
|
||||||
r = []
|
|
||||||
n = os.listdir(path)
|
|
||||||
for f in n:
|
|
||||||
if not os.path.isdir(f):
|
|
||||||
r.append(f)
|
|
||||||
return r
|
|
||||||
|
|
||||||
r = filelist('release')
|
|
||||||
|
|
||||||
print(text)
|
|
||||||
for i in r:
|
|
||||||
print('| {0} | {1} |'.format(i, checksum('release\\' + i)))
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
@ECHO OFF
|
|
||||||
RD /S /Q release > NUL 2>&1
|
|
||||||
RD /S /Q x64 > NUL 2>&1
|
|
||||||
RD /S /Q x86 > NUL 2>&1
|
|
||||||
|
|
||||||
MKDIR release > NUL 2>&1
|
|
||||||
XCOPY /E /Y ..\Netch\bin\x64\Release x64
|
|
||||||
XCOPY /E /Y ..\Netch\bin\x86\Release x86
|
|
||||||
|
|
||||||
PAUSE
|
|
||||||
|
|
||||||
CD x64
|
|
||||||
DEL /F /S /Q *.config
|
|
||||||
DEL /F /S /Q *.pdb
|
|
||||||
DEL /F /S /Q *.xml
|
|
||||||
7z a -r Netch.x64.7z *
|
|
||||||
MOVE Netch.x64.7z ..\release
|
|
||||||
|
|
||||||
CD ..\x86
|
|
||||||
DEL /F /S /Q *.config
|
|
||||||
DEL /F /S /Q *.pdb
|
|
||||||
DEL /F /S /Q *.xml
|
|
||||||
7z a -r Netch.x86.7z *
|
|
||||||
MOVE Netch.x86.7z ..\release
|
|
||||||
|
|
||||||
CD ..
|
|
||||||
RD /S /Q x64
|
|
||||||
RD /S /Q x86
|
|
||||||
|
|
||||||
PAUSE
|
|
||||||
Submodule translations deleted from 8ce7bdb364
Reference in New Issue
Block a user