Add files via upload

This commit is contained in:
Netch
2021-07-10 14:16:34 +08:00
parent e812edef95
commit 0634e5718d
38 changed files with 279 additions and 46 deletions

10
BUILD.md Normal file
View File

@@ -0,0 +1,10 @@
# How to build
## Requirements
- Go
- MinGW-w64
- Visual Studio 2019
## Build
```powershell
.\build.ps1
```

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Mode
{

View File

@@ -56,6 +56,8 @@ namespace Netch.Controllers.Mode
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
Global.Logger.Info(String.Format("{0:x} Redirector.bin", Utils.FileHelper.Checksum("Bin\\Redirector.bin")));
var mode = m as Models.Mode.ProcessMode.ProcessMode;
Methods.aio_dial(NameList.TYPE_FILTERLOOPBACK, mode.Loopback ? "true" : "false");
Methods.aio_dial(NameList.TYPE_FILTERTCP, mode.TCP ? "true" : "false");

View File

@@ -133,8 +133,12 @@ namespace Netch.Controllers.Mode
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
Global.Logger.Info(String.Format("{0:x} tap2socks.bin", Utils.FileHelper.Checksum("Bin\\tap2socks.bin")));
if (!this.Outbound.Get())
{
Global.Logger.Error(String.Format("Failed to fetch outbound"));
return false;
}

View File

@@ -133,8 +133,12 @@ namespace Netch.Controllers.Mode
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
Global.Logger.Info(String.Format("{0:x} tun2socks.bin", Utils.FileHelper.Checksum("Bin\\tun2socks.bin"));
if (!this.Outbound.Get())
{
Global.Logger.Error(String.Format("Failed to fetch outbound"));
return false;
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Mode
{

View File

@@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using System;
using System.Runtime.InteropServices;
namespace Netch.Controllers.Other.DNS
{
@@ -27,6 +28,8 @@ namespace Netch.Controllers.Other.DNS
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
Global.Logger.Info(String.Format("{0:x} aiodns.bin", Utils.FileHelper.Checksum("Bin\\aiodns.bin")));
Methods.aiodns_dial(NameList.TYPE_REST, "");
Methods.aiodns_dial(NameList.TYPE_ADDR, ":53");
Methods.aiodns_dial(NameList.TYPE_LIST, "Bin\\aiodns.conf");

View File

@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Other.DNS
{

View File

@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Other.DNS
{

View File

@@ -2,9 +2,6 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Other.DNS
{

View File

@@ -0,0 +1,17 @@
using System;
namespace Netch.Controllers.Other.Web
{
public class PrivoxyController : Interface.IController
{
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
throw new NotImplementedException();
}
public bool Delete()
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Server
{
public class ClashController : Interface.IController
{
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
{
throw new NotImplementedException();
}
public bool Delete()
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Controllers.Server
{

View File

@@ -14,7 +14,7 @@ namespace Netch
/// <summary>
/// 日志记录
/// </summary>
public static Tools.Logger Logger = new Tools.Logger() { SavePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs\\Netch.log") };
public static Tools.Logger Logger = new() { SavePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs\\Netch.log") };
/// <summary>
/// 配置文件

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Netch.Models.Server.Clash
{
public class Clash : Server
{
public Clash()
{
this.Type = ServerType.Clash;
}
/// <summary>
/// 自定义配置
/// </summary>
[Newtonsoft.Json.JsonProperty("custom")]
public bool Custom = true;
/// <summary>
/// 自定义配置文件路径
/// </summary>
[Newtonsoft.Json.JsonProperty("filepath")]
public string FilePath;
/// <summary>
/// 解析链接
/// </summary>
/// <param name="link">链接</param>
/// <returns>是否成功</returns>
public bool ParseLink(string link)
{
return false;
}
}
}

View File

@@ -2,6 +2,16 @@
{
public enum ServerType : int
{
/// <summary>
/// HTTP
/// </summary>
HTTP,
/// <summary>
/// Clash
/// </summary>
Clash,
/// <summary>
/// Socks5
/// </summary>

View File

@@ -10,27 +10,32 @@
/// <summary>
/// 密码
/// </summary>
public string Passwd;
[Newtonsoft.Json.JsonProperty("password")]
public string Password;
/// <summary>
/// 伪装 SNI 标头
/// </summary>
[Newtonsoft.Json.JsonProperty("sni")]
public string SNI;
/// <summary>
/// 复用会话
/// </summary>
[Newtonsoft.Json.JsonProperty("reuse")]
public bool Reuse = true;
/// <summary>
/// Session Ticket
/// </summary>
[Newtonsoft.Json.JsonProperty("ticket")]
public bool Ticket = false;
/// <summary>
/// 不安全模式(跳过证书验证、跳过主机名验证)
/// </summary>
public bool Insecure = true;
[Newtonsoft.Json.JsonProperty("insecure")]
public bool Insecure = false;
/// <summary>
/// 解析链接

View File

@@ -10,11 +10,13 @@
/// <summary>
/// 自定义配置
/// </summary>
[Newtonsoft.Json.JsonProperty("custom")]
public bool Custom = true;
/// <summary>
/// 自定义配置文件路径
/// </summary>
[Newtonsoft.Json.JsonProperty("filepath")]
public string FilePath;
/// <summary>

View File

@@ -10,11 +10,13 @@
/// <summary>
/// 自定义配置
/// </summary>
[Newtonsoft.Json.JsonProperty("custom")]
public bool Custom = true;
/// <summary>
/// 自定义配置文件路径
/// </summary>
[Newtonsoft.Json.JsonProperty("filepath")]
public string FilePath;
/// <summary>

1
Other/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/release

View File

@@ -1 +0,0 @@
# aiodns

14
Other/aiodns/build.ps1 Normal file
View File

@@ -0,0 +1,14 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
$Env:CGO_ENABLED="0"
$Env:GOROOT_FINAL="/usr"
$Env:GOOS="windows"
$Env:GOARCH="amd64"
go build -a -trimpath -asmflags "-s -w" -ldflags "-s -w" -o "..\release\aiodns.exe"
Set-Location $last
exit $lastExitCode

11
Other/aiodns/deps.ps1 Normal file
View File

@@ -0,0 +1,11 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
rm -Force go.*
go mod init aiodns
go mod tidy
Set-Location $last
exit $lastExitCode

View File

@@ -1,4 +1,4 @@
module github.com/netchx/netch/other/aiodns
module aiodns
go 1.16

17
Other/build.ps1 Normal file
View File

@@ -0,0 +1,17 @@
Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
.\clean.ps1
Get-ChildItem -Path . -Directory | ForEach-Object {
$name=$_.Name
Write-Host "Building $name"
& ".\$name\build.ps1"
if ( -Not $? ) {
Write-Host "Build $name failed"
exit $lastExitCode
}
}
exit 0

7
Other/clean.ps1 Normal file
View File

@@ -0,0 +1,7 @@
Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
if (Test-Path release) {
Remove-Item -Recurse -Force release
}
exit 0

14
Other/deps.ps1 Normal file
View File

@@ -0,0 +1,14 @@
Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
.\clean.ps1
Get-ChildItem -Path . -Directory | ForEach-Object {
$name=$_.Name
& ".\$name\deps.ps1"
if (-Not $?) {
exit $lastExitCode
}
}
exit 0

14
Other/tap2socks/build.ps1 Normal file
View File

@@ -0,0 +1,14 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
$Env:CGO_ENABLED="0"
$Env:GOROOT_FINAL="/usr"
$Env:GOOS="windows"
$Env:GOARCH="amd64"
go build -a -trimpath -asmflags "-s -w" -ldflags "-s -w" -o "..\release\tap2socks.exe"
Set-Location $last
exit $lastExitCode

11
Other/tap2socks/deps.ps1 Normal file
View File

@@ -0,0 +1,11 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
rm -Force go.*
go mod init tap2socks
go mod tidy
Set-Location $last
exit $lastExitCode

3
Other/tap2socks/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module tap2socks
go 1.16

5
Other/tap2socks/main.go Normal file
View File

@@ -0,0 +1,5 @@
package main
func main() {
}

14
Other/tun2socks/build.ps1 Normal file
View File

@@ -0,0 +1,14 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
$Env:CGO_ENABLED="0"
$Env:GOROOT_FINAL="/usr"
$Env:GOOS="windows"
$Env:GOARCH="amd64"
go build -a -trimpath -asmflags "-s -w" -ldflags "-s -w" -o "..\release\tun2socks.exe"
Set-Location $last
exit $lastExitCode

11
Other/tun2socks/deps.ps1 Normal file
View File

@@ -0,0 +1,11 @@
$exec=(Split-Path $MyInvocation.MyCommand.Path -Parent)
$last=(Get-Location).Path
Set-Location $exec
rm -Force go.*
go mod init tun2socks
go mod tidy
Set-Location $last
exit $lastExitCode

3
Other/tun2socks/go.mod Normal file
View File

@@ -0,0 +1,3 @@
module tun2socks
go 1.16

5
Other/tun2socks/main.go Normal file
View File

@@ -0,0 +1,5 @@
package main
func main() {
}

View File

@@ -22,8 +22,11 @@ param (
$PublishSingleFile = $True
)
.\Other\build.ps1
if ( -Not $? ) { exit $lastExitCode }
.\scripts\download.ps1 $OutputPath
if ( -Not $? ) { exit 1 }
if ( -Not $? ) { exit $lastExitCode }
Write-Host "Building $Configuration to $OutputPath"
dotnet publish `
@@ -37,4 +40,4 @@ dotnet publish `
-o $OutputPath `
Netch\Netch.csproj
exit $lastExitCode
exit $lastExitCode

View File

@@ -1,3 +1,5 @@
Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent)
function Delete {
param([string]$Path)
@@ -12,4 +14,6 @@ Delete "Netch\obj"
Delete "Tests\bin"
Delete "Tests\obj"
Delete "TestResults"
exit 0
.\Other\clean.ps1
exit $lastExitCode

View File

@@ -1,10 +1,10 @@
param([string]$OutputPath)
$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/NetchI18N/archive/refs/heads/master.zip"
$NetchDataURL="https://github.com/netchx/netch-data/archive/refs/heads/main.zip"
$NetchModeURL="https://github.com/netchx/netch-mode/archive/refs/heads/main.zip"
$NetchI18NURL="https://github.com/netchx/netch-i18n/archive/refs/heads/main.zip"
$last=$(Get-Location)
$last=(Get-Location).Path
New-Item -ItemType Directory -Name $OutputPath | Out-Null
Set-Location $OutputPath
@@ -16,24 +16,24 @@ Expand-Archive -Force -Path data.zip -DestinationPath .
Expand-Archive -Force -Path mode.zip -DestinationPath .
Expand-Archive -Force -Path i18n.zip -DestinationPath .
New-Item -ItemType Directory -Name bin | Out-Null
New-Item -ItemType Directory -Name mode | Out-Null
New-Item -ItemType Directory -Name i18n | Out-Null
New-Item -ItemType Directory -Name Bin | Out-Null
New-Item -ItemType Directory -Name Mode | Out-Null
New-Item -ItemType Directory -Name I18N | Out-Null
Copy-Item -Recurse -Force .\NetchData-master\* .\bin
Copy-Item -Recurse -Force .\NetchMode-master\mode\* .\mode
Copy-Item -Recurse -Force .\NetchI18N-master\i18n\* .\i18n
Copy-Item -Recurse -Force .\netch-data-main\* .\Bin
Copy-Item -Recurse -Force .\netch-mode-main\mode\* .\Mode
Copy-Item -Recurse -Force .\netch-i18n-main\i18n\* .\I18N
Remove-Item -Recurse -Force NetchData-master
Remove-Item -Recurse -Force NetchMode-master
Remove-Item -Recurse -Force NetchI18N-master
Remove-Item -Recurse -Force netch-data-main
Remove-Item -Recurse -Force netch-mode-main
Remove-Item -Recurse -Force netch-i18n-main
Remove-Item -Force data.zip
Remove-Item -Force mode.zip
Remove-Item -Force i18n.zip
..\scripts\download\cloak.ps1 -OutputPath bin
..\scripts\download\xray-core.ps1 -OutputPath bin
..\scripts\download\cloak.ps1 -OutputPath Bin
..\scripts\download\xray-core.ps1 -OutputPath Bin
Get-Item *
Set-Location $last
exit 0
exit 0