mirror of https://github.com/2dust/v2rayN
fix speed test display
parent
f6ccee1976
commit
4d7cf140cd
|
@ -288,7 +288,7 @@ namespace v2rayN.Forms
|
||||||
Utils.AddSubItem(lvItem, EServerColName.security.ToString(), item.security);
|
Utils.AddSubItem(lvItem, EServerColName.security.ToString(), item.security);
|
||||||
Utils.AddSubItem(lvItem, EServerColName.network.ToString(), item.network);
|
Utils.AddSubItem(lvItem, EServerColName.network.ToString(), item.network);
|
||||||
Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity);
|
Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity);
|
||||||
Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.getSubRemarks(config));
|
Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.GetSubRemarks(config));
|
||||||
Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult);
|
Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult);
|
||||||
if (stats)
|
if (stats)
|
||||||
{
|
{
|
||||||
|
@ -336,7 +336,7 @@ namespace v2rayN.Forms
|
||||||
for (int k = 0; k < lstVmess.Count; k++)
|
for (int k = 0; k < lstVmess.Count; k++)
|
||||||
{
|
{
|
||||||
VmessItem item = lstVmess[k];
|
VmessItem item = lstVmess[k];
|
||||||
string name = item.getSummary();
|
string name = item.GetSummary();
|
||||||
|
|
||||||
if (config.IsActiveNode(item))
|
if (config.IsActiveNode(item))
|
||||||
{
|
{
|
||||||
|
@ -355,7 +355,7 @@ namespace v2rayN.Forms
|
||||||
for (int k = 0; k < lstVmess.Count; k++)
|
for (int k = 0; k < lstVmess.Count; k++)
|
||||||
{
|
{
|
||||||
VmessItem item = lstVmess[k];
|
VmessItem item = lstVmess[k];
|
||||||
string name = item.getSummary();
|
string name = item.GetSummary();
|
||||||
|
|
||||||
ToolStripMenuItem ts = new ToolStripMenuItem(name)
|
ToolStripMenuItem ts = new ToolStripMenuItem(name)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,6 +142,7 @@ namespace v2rayN.Handler
|
||||||
string status = GetRealPingTime(_config.constItem.speedPingTestUrl, webProxy, out responseTime);
|
string status = GetRealPingTime(_config.constItem.speedPingTestUrl, webProxy, out responseTime);
|
||||||
string output = Utils.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status;
|
string output = Utils.IsNullOrEmpty(status) ? FormatOut(responseTime, "ms") : status;
|
||||||
|
|
||||||
|
_config.GetVmessItem(it.indexId)?.SetTestResult(output);
|
||||||
_updateFunc(it.indexId, output);
|
_updateFunc(it.indexId, output);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -210,6 +211,7 @@ namespace v2rayN.Handler
|
||||||
DownloadHandle downloadHandle2 = new DownloadHandle();
|
DownloadHandle downloadHandle2 = new DownloadHandle();
|
||||||
downloadHandle2.UpdateCompleted += (sender2, args) =>
|
downloadHandle2.UpdateCompleted += (sender2, args) =>
|
||||||
{
|
{
|
||||||
|
_config.GetVmessItem(testIndexId)?.SetTestResult(args.Msg);
|
||||||
_updateFunc(testIndexId, args.Msg);
|
_updateFunc(testIndexId, args.Msg);
|
||||||
};
|
};
|
||||||
downloadHandle2.Error += (sender2, args) =>
|
downloadHandle2.Error += (sender2, args) =>
|
||||||
|
|
|
@ -80,7 +80,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
Utils.ToJsonFile(v2rayConfig, fileName, false);
|
Utils.ToJsonFile(v2rayConfig, fileName, false);
|
||||||
|
|
||||||
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{config.GetGroupRemarks(node.groupId)}] {node.getSummary()}");
|
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{config.GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -584,7 +584,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
var config = LazyConfig.Instance.GetConfig();
|
var config = LazyConfig.Instance.GetConfig();
|
||||||
//远程服务器底层传输配置
|
//远程服务器底层传输配置
|
||||||
streamSettings.network = node.getNetwork();
|
streamSettings.network = node.GetNetwork();
|
||||||
string host = node.requestHost.TrimEx();
|
string host = node.requestHost.TrimEx();
|
||||||
string sni = node.sni;
|
string sni = node.sni;
|
||||||
|
|
||||||
|
@ -596,7 +596,7 @@ namespace v2rayN.Handler
|
||||||
TlsSettings tlsSettings = new TlsSettings
|
TlsSettings tlsSettings = new TlsSettings
|
||||||
{
|
{
|
||||||
allowInsecure = Utils.ToBool(node.allowInsecure),
|
allowInsecure = Utils.ToBool(node.allowInsecure),
|
||||||
alpn = node.getAlpn()
|
alpn = node.GetAlpn()
|
||||||
};
|
};
|
||||||
if (!string.IsNullOrWhiteSpace(sni))
|
if (!string.IsNullOrWhiteSpace(sni))
|
||||||
{
|
{
|
||||||
|
@ -617,7 +617,7 @@ namespace v2rayN.Handler
|
||||||
TlsSettings xtlsSettings = new TlsSettings
|
TlsSettings xtlsSettings = new TlsSettings
|
||||||
{
|
{
|
||||||
allowInsecure = Utils.ToBool(node.allowInsecure),
|
allowInsecure = Utils.ToBool(node.allowInsecure),
|
||||||
alpn = node.getAlpn()
|
alpn = node.GetAlpn()
|
||||||
};
|
};
|
||||||
if (!string.IsNullOrWhiteSpace(sni))
|
if (!string.IsNullOrWhiteSpace(sni))
|
||||||
{
|
{
|
||||||
|
@ -631,7 +631,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
//streamSettings
|
//streamSettings
|
||||||
switch (node.getNetwork())
|
switch (node.GetNetwork())
|
||||||
{
|
{
|
||||||
//kcp基本配置暂时是默认值,用户能自己设置伪装类型
|
//kcp基本配置暂时是默认值,用户能自己设置伪装类型
|
||||||
case "kcp":
|
case "kcp":
|
||||||
|
@ -921,7 +921,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
File.Copy(addressFileName, fileName);
|
File.Copy(addressFileName, fileName);
|
||||||
|
|
||||||
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.getSummary()}");
|
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), $"[{LazyConfig.Instance.GetConfig().GetGroupRemarks(node.groupId)}] {node.GetSummary()}");
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -984,7 +984,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
Utils.ToJsonFile(v2rayConfig, fileName, false);
|
Utils.ToJsonFile(v2rayConfig, fileName, false);
|
||||||
|
|
||||||
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), node.getSummary());
|
msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), node.GetSummary());
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
@ -1471,9 +1471,8 @@ namespace v2rayN.Handler
|
||||||
inbound.tag = Global.InboundHttp + inbound.port.ToString();
|
inbound.tag = Global.InboundHttp + inbound.port.ToString();
|
||||||
v2rayConfig.inbounds.Add(inbound);
|
v2rayConfig.inbounds.Add(inbound);
|
||||||
|
|
||||||
var index = configCopy.FindIndexId(it.indexId);
|
|
||||||
V2rayConfig v2rayConfigCopy = Utils.FromJson<V2rayConfig>(result);
|
V2rayConfig v2rayConfigCopy = Utils.FromJson<V2rayConfig>(result);
|
||||||
outbound(configCopy.vmess[index], ref v2rayConfigCopy);
|
outbound(configCopy.GetVmessItem(it.indexId), ref v2rayConfigCopy);
|
||||||
v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();
|
v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();
|
||||||
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
|
v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
|
||||||
|
|
||||||
|
|
|
@ -245,6 +245,15 @@ namespace v2rayN.Mode
|
||||||
return vmess.FindIndex(it => it.indexId == id);
|
return vmess.FindIndex(it => it.indexId == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public VmessItem GetVmessItem(string id)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(id))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return vmess.FirstOrDefault(it => it.indexId == id);
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> GetShadowsocksSecuritys()
|
public List<string> GetShadowsocksSecuritys()
|
||||||
{
|
{
|
||||||
if (coreType == ECoreType.v2fly_core)
|
if (coreType == ECoreType.v2fly_core)
|
||||||
|
@ -306,7 +315,7 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
|
|
||||||
#region function
|
#region function
|
||||||
public string getSummary()
|
public string GetSummary()
|
||||||
{
|
{
|
||||||
string summary = string.Format("[{0}] ", ((EConfigType)configType).ToString());
|
string summary = string.Format("[{0}] ", ((EConfigType)configType).ToString());
|
||||||
string[] arrAddr = address.Split('.');
|
string[] arrAddr = address.Split('.');
|
||||||
|
@ -356,7 +365,7 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
return summary;
|
return summary;
|
||||||
}
|
}
|
||||||
public string getSubRemarks(Config config)
|
public string GetSubRemarks(Config config)
|
||||||
{
|
{
|
||||||
string subRemarks = string.Empty;
|
string subRemarks = string.Empty;
|
||||||
if (Utils.IsNullOrEmpty(subid))
|
if (Utils.IsNullOrEmpty(subid))
|
||||||
|
@ -377,7 +386,7 @@ namespace v2rayN.Mode
|
||||||
return subid.Substring(0, 4);
|
return subid.Substring(0, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> getAlpn()
|
public List<string> GetAlpn()
|
||||||
{
|
{
|
||||||
if (alpn != null && alpn.Count > 0)
|
if (alpn != null && alpn.Count > 0)
|
||||||
{
|
{
|
||||||
|
@ -388,7 +397,7 @@ namespace v2rayN.Mode
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public string getNetwork()
|
public string GetNetwork()
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(network) || !Global.networks.Contains(network))
|
if (Utils.IsNullOrEmpty(network) || !Global.networks.Contains(network))
|
||||||
{
|
{
|
||||||
|
@ -396,6 +405,11 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
return network.TrimEx();
|
return network.TrimEx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetTestResult(string value)
|
||||||
|
{
|
||||||
|
testResult = value;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public string indexId
|
public string indexId
|
||||||
|
|
Loading…
Reference in New Issue