mirror of
https://github.com/netchx/netch.git
synced 2026-05-07 22:44:03 +08:00
Add files via upload
This commit is contained in:
53
Netch/Controllers/Server/SRController.cs
Normal file
53
Netch/Controllers/Server/SRController.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Netch.Controllers.Server
|
||||
{
|
||||
public class SRController : Interface.IController
|
||||
{
|
||||
private Tools.Guard Guard = new()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Bin\\ShadowsocksR.exe"),
|
||||
WorkingDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Bin"),
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
},
|
||||
JudgmentStarted = new List<string>()
|
||||
{
|
||||
"listening at"
|
||||
},
|
||||
JudgmentStopped = new List<string>()
|
||||
{
|
||||
"usage",
|
||||
"invalid"
|
||||
},
|
||||
AutoRestart = true
|
||||
};
|
||||
|
||||
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
|
||||
{
|
||||
var node = s as Models.Server.ShadowsocksR.ShadowsocksR;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append($"-l {Global.Config.Ports.Socks} -s {node.Resolve()} -p {node.Port} -k '{node.Passwd}' -O {node.Prot} -o {node.OBFS} -t 30 -u --fast-open --no-delay");
|
||||
if (!String.IsNullOrEmpty(node.ProtParam)) sb.Append($" -G '{node.ProtParam}'");
|
||||
if (!String.IsNullOrEmpty(node.OBFSParam)) sb.Append($" -g '{node.OBFSParam}'");
|
||||
|
||||
this.Guard.StartInfo.Arguments = sb.ToString();
|
||||
return this.Guard.Create();
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
this.Guard.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
53
Netch/Controllers/Server/SSController.cs
Normal file
53
Netch/Controllers/Server/SSController.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Netch.Controllers.Server
|
||||
{
|
||||
public class SSController : Interface.IController
|
||||
{
|
||||
private Tools.Guard Guard = new()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Bin\\Shadowsocks.exe"),
|
||||
WorkingDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Bin"),
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
WindowStyle = ProcessWindowStyle.Hidden
|
||||
},
|
||||
JudgmentStarted = new List<string>()
|
||||
{
|
||||
"listening at"
|
||||
},
|
||||
JudgmentStopped = new List<string>()
|
||||
{
|
||||
"usage",
|
||||
"invalid",
|
||||
"plugin service exit unexpectedly"
|
||||
},
|
||||
AutoRestart = true
|
||||
};
|
||||
|
||||
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
|
||||
{
|
||||
var node = s as Models.Server.Shadowsocks.Shadowsocks;
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.Append($"-l {Global.Config.Ports.Socks} -s {node.Resolve()} -p {node.Port} -k '{node.Passwd}' -t 30 -u --fast-open --no-delay");
|
||||
if (!String.IsNullOrEmpty(node.OBFS)) sb.Append($" --plugin '{node.OBFS}' --plugin-opts '{node.OBFSParam}'");
|
||||
|
||||
this.Guard.StartInfo.Arguments = sb.ToString();
|
||||
return this.Guard.Create();
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
this.Guard.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Netch/Controllers/Server/TRController.cs
Normal file
15
Netch/Controllers/Server/TRController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Netch.Controllers.Server
|
||||
{
|
||||
public class TRController : Interface.IController
|
||||
{
|
||||
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Netch/Controllers/Server/VLController.cs
Normal file
15
Netch/Controllers/Server/VLController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Netch.Controllers.Server
|
||||
{
|
||||
public class VLController : Interface.IController
|
||||
{
|
||||
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Netch/Controllers/Server/VMController.cs
Normal file
15
Netch/Controllers/Server/VMController.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Netch.Controllers.Server
|
||||
{
|
||||
public class VMController : Interface.IController
|
||||
{
|
||||
public bool Create(Models.Server.Server s, Models.Mode.Mode m)
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public bool Delete()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user