|
|
|
@ -33,8 +33,6 @@ namespace v2rayN.Handler
|
|
|
|
|
|
|
|
|
|
public bool UpdateUI;
|
|
|
|
|
|
|
|
|
|
private StringBuilder outputBuilder_;
|
|
|
|
|
|
|
|
|
|
public ulong TotalUp { get; private set; }
|
|
|
|
|
|
|
|
|
|
public ulong TotalDown { get; private set; }
|
|
|
|
@ -62,14 +60,12 @@ namespace v2rayN.Handler
|
|
|
|
|
DeleteExpiredLog();
|
|
|
|
|
foreach (var server in config.vmess)
|
|
|
|
|
{
|
|
|
|
|
var statistic = new ServerStatistics(server.remarks, server.address, server.port, server.path, 0, 0, 0, 0);
|
|
|
|
|
var statistic = new ServerStatistics(server.remarks, server.address, server.port, server.path, server.requestHost, 0, 0, 0, 0);
|
|
|
|
|
Statistic.Add(statistic);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadFromFile();
|
|
|
|
|
|
|
|
|
|
outputBuilder_ = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
var fullPath = Utils.GetPath(cliName_);
|
|
|
|
|
|
|
|
|
|
if (!File.Exists(fullPath))
|
|
|
|
@ -211,7 +207,7 @@ namespace v2rayN.Handler
|
|
|
|
|
overallWriter.WriteLine($"DOWN {string.Format("{0:f2}", down_amount)}{down_unit} {TotalDown}");
|
|
|
|
|
foreach(var s in Statistic)
|
|
|
|
|
{
|
|
|
|
|
overallWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.totalUp} {s.totalDown}");
|
|
|
|
|
overallWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.totalUp} {s.totalDown}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -230,7 +226,7 @@ namespace v2rayN.Handler
|
|
|
|
|
dailyWriter.WriteLine($"LastUpdate {DateTime.Now.ToLongDateString()} {DateTime.Now.ToLongTimeString()}");
|
|
|
|
|
foreach (var s in Statistic)
|
|
|
|
|
{
|
|
|
|
|
dailyWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.todayUp} {s.todayDown}");
|
|
|
|
|
dailyWriter.WriteLine($"* {s.name} {s.address} {s.port} {s.path} {s.host} {s.todayUp} {s.todayDown}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -278,15 +274,17 @@ namespace v2rayN.Handler
|
|
|
|
|
else if (line.StartsWith("*"))
|
|
|
|
|
{
|
|
|
|
|
var datas = line.Split(' ');
|
|
|
|
|
if (datas.Length < 6) return;
|
|
|
|
|
if (datas.Length < 8) return;
|
|
|
|
|
var name = datas[1];
|
|
|
|
|
var address = datas[2];
|
|
|
|
|
var port = int.Parse(datas[3]);
|
|
|
|
|
var path = datas[4];
|
|
|
|
|
var totalUp = ulong.Parse(datas[5]);
|
|
|
|
|
var totalDown = ulong.Parse(datas[6]);
|
|
|
|
|
var host = datas[5];
|
|
|
|
|
var totalUp = ulong.Parse(datas[6]);
|
|
|
|
|
var totalDown = ulong.Parse(datas[7]);
|
|
|
|
|
|
|
|
|
|
var index = Statistic.FindIndex(item => item.address == address && item.port == port);
|
|
|
|
|
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
|
|
|
|
|
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
|
|
|
|
|
if (index != -1)
|
|
|
|
|
{
|
|
|
|
|
Statistic[index].totalUp = totalUp;
|
|
|
|
@ -294,7 +292,7 @@ namespace v2rayN.Handler
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var s = new Mode.ServerStatistics(name, address, port, path, totalUp, totalDown, 0, 0);
|
|
|
|
|
var s = new Mode.ServerStatistics(name, address, port, path, host, totalUp, totalDown, 0, 0);
|
|
|
|
|
Statistic.Add(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -322,15 +320,17 @@ namespace v2rayN.Handler
|
|
|
|
|
else if (line.StartsWith("*"))
|
|
|
|
|
{
|
|
|
|
|
var datas = line.Split(' ');
|
|
|
|
|
if (datas.Length < 6) return;
|
|
|
|
|
if (datas.Length < 8) return;
|
|
|
|
|
var name = datas[1];
|
|
|
|
|
var address = datas[2];
|
|
|
|
|
var port = int.Parse(datas[3]);
|
|
|
|
|
var path = datas[4];
|
|
|
|
|
var todayUp = ulong.Parse(datas[5]);
|
|
|
|
|
var todayDown = ulong.Parse(datas[6]);
|
|
|
|
|
var host = datas[5];
|
|
|
|
|
var todayUp = ulong.Parse(datas[6]);
|
|
|
|
|
var todayDown = ulong.Parse(datas[7]);
|
|
|
|
|
|
|
|
|
|
var index = Statistic.FindIndex(item => item.address == address && item.port == port);
|
|
|
|
|
var temp = new ServerStatistics(name, address, port, path, host, 0, 0, 0, 0);
|
|
|
|
|
var index = Statistic.FindIndex(item => Utils.IsIdenticalServer(item, temp));
|
|
|
|
|
if (index != -1)
|
|
|
|
|
{
|
|
|
|
|
Statistic[index].todayUp = todayUp;
|
|
|
|
@ -338,7 +338,7 @@ namespace v2rayN.Handler
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var s = new Mode.ServerStatistics(name, address, port, path, 0, 0, todayUp, todayDown);
|
|
|
|
|
var s = new Mode.ServerStatistics(name, address, port, path, host, 0, 0, todayUp, todayDown);
|
|
|
|
|
Statistic.Add(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|