mirror of
https://github.com/netchx/netch.git
synced 2026-03-26 18:49:46 +08:00
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using System.IO;
|
|
using Netch.Controllers;
|
|
using Netch.Models;
|
|
using Netch.Servers.VMess.Utils;
|
|
|
|
namespace Netch.Servers.VMess
|
|
{
|
|
public class VMessController : Guard, IServerController
|
|
{
|
|
public VMessController()
|
|
{
|
|
StartedKeywords.Add("started");
|
|
StoppedKeywords.AddRange(new[] {"config file not readable", "failed to"});
|
|
}
|
|
|
|
public override string Name { get; protected set; } = "V2Ray";
|
|
public override string MainFile { get; protected set; } = "v2ray.exe";
|
|
public Server Server { get; set; }
|
|
public ushort? Socks5LocalPort { get; set; }
|
|
public string LocalAddress { get; set; }
|
|
|
|
|
|
public bool Start(in Server s,in Mode mode)
|
|
{
|
|
Server = s;
|
|
File.WriteAllText("data\\last.json", V2rayConfigUtils.GenerateClientConfig(s, mode));
|
|
return StartInstanceAuto("-config ..\\data\\last.json");
|
|
}
|
|
|
|
public override void Stop()
|
|
{
|
|
StopInstance();
|
|
}
|
|
}
|
|
} |