diff --git a/Netch/Servers/V2ray/V2rayController.cs b/Netch/Servers/V2ray/V2rayController.cs index 3d9fe9b3..10d5288c 100644 --- a/Netch/Servers/V2ray/V2rayController.cs +++ b/Netch/Servers/V2ray/V2rayController.cs @@ -8,7 +8,7 @@ namespace Netch.Servers; public class V2rayController : Guard, IServerController { - public V2rayController() : base("xray.exe") + public V2rayController() : base("v2ray-sn.exe") { if (!Global.Settings.V2RayConfig.XrayCone) Instance.StartInfo.Environment["XRAY_CONE_DISABLED"] = "true"; @@ -18,7 +18,7 @@ public class V2rayController : Guard, IServerController protected override IEnumerable FailedKeywords => new[] { "config file not readable", "failed to" }; - public override string Name => "Xray"; + public override string Name => "V2Ray (SagerNet)"; public ushort? Socks5LocalPort { get; set; } diff --git a/Other/v2ray-sn/build.ps1 b/Other/v2ray-sn/build.ps1 new file mode 100644 index 00000000..69315110 --- /dev/null +++ b/Other/v2ray-sn/build.ps1 @@ -0,0 +1,28 @@ +Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) + +git clone https://github.com/SagerNet/v2ray-core.git -b 'v5.0.12' src +if ( -Not $? ) { + exit $lastExitCode +} +Set-Location src + +# Download SSR plugin +Invoke-WebRequest -Uri 'https://gist.githubusercontent.com/H1JK/b3165a99b635dcc06101690e4c43b5fd/raw/691b471f3b395a949d03a3d064d93d319d4997b7/ssr.go' -OutFile '.\proxy\shadowsocks\plugin\self\ssr.go' + +# Download Simple-Obfs plugin +Invoke-WebRequest -Uri 'https://gist.githubusercontent.com/H1JK/b3165a99b635dcc06101690e4c43b5fd/raw/691b471f3b395a949d03a3d064d93d319d4997b7/obfs.go' -OutFile '.\proxy\shadowsocks\plugin\self\obfs.go' + +# Enable ReadV (Use v2fly/v2ray-core's ReadV code) +Remove-Item '.\common\buf\io.go' +Remove-Item '.\common\buf\readv_reader.go' +Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/v2fly/v2ray-core/master/common/buf/io.go' -OutFile '.\common\buf\io.go' +Invoke-WebRequest -Uri 'https://raw.githubusercontent.com/v2fly/v2ray-core/master/common/buf/readv_reader.go' -OutFile '.\common\buf\readv_reader.go' + +$Env:CGO_ENABLED='0' +$Env:GOROOT_FINAL='/usr' + +$Env:GOOS='windows' +$Env:GOARCH='amd64' +go mod tidy # necessary +go build -a -trimpath -asmflags '-s -w' -ldflags '-s -w -buildid=' -o '..\..\release\v2ray-sn.exe' '.\main' +exit $lastExitCode \ No newline at end of file diff --git a/Other/xray-core/build.ps1 b/Other/xray-core/build.ps1 deleted file mode 100644 index 20939b0e..00000000 --- a/Other/xray-core/build.ps1 +++ /dev/null @@ -1,15 +0,0 @@ -Set-Location (Split-Path $MyInvocation.MyCommand.Path -Parent) - -git clone https://github.com/xtls/xray-core -b 'v1.5.6' src -if ( -Not $? ) { - exit $lastExitCode -} -Set-Location src - -$Env:CGO_ENABLED='0' -$Env:GOROOT_FINAL='/usr' - -$Env:GOOS='windows' -$Env:GOARCH='amd64' -go build -a -trimpath -asmflags '-s -w' -ldflags '-s -w -buildid=' -o '..\..\release\xray.exe' '.\main' -exit $lastExitCode \ No newline at end of file