diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs
index 1d8b3586..5f31540f 100644
--- a/v2rayN/v2rayN/Forms/MainForm.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.cs
@@ -328,7 +328,7 @@ namespace v2rayN.Forms
if (config.sysAgentEnabled)
{
- toolSslHttpPort.Text = $"{Global.Loopback}:{Global.sysAgentPort}";
+ toolSslHttpPort.Text = $"{Global.Loopback}:{Global.httpPort}";
if (config.listenerType == 2 || config.listenerType == 4)
{
if (PACServerHandle.IsRunning)
@@ -1252,7 +1252,7 @@ namespace v2rayN.Forms
{
if (isChecked)
{
- if (HttpProxyHandle.RestartHttpAgent(config, true))
+ if (HttpProxyHandle.RestartHttpAgent(config, false))
{
ChangePACButtonStatus(config.listenerType);
}
@@ -1299,7 +1299,7 @@ namespace v2rayN.Forms
}
else
{
- downloadHandle.DownloadFileAsync(config, url, false);
+ downloadHandle.DownloadFileAsync(config, url, null);
}
}));
}
diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs
index b6cd232e..83dc9f30 100644
--- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs
+++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs
@@ -45,7 +45,7 @@ namespace v2rayN.Forms
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
txtlocalPort2.Text = "socks + 1";
- cmbprotocol2.Text = "http";
+ cmbprotocol2.Text = Global.InboundHttp;
if (config.inbound.Count > 1)
{
diff --git a/v2rayN/v2rayN/Global.cs b/v2rayN/v2rayN/Global.cs
index 94534f20..23ff973d 100644
--- a/v2rayN/v2rayN/Global.cs
+++ b/v2rayN/v2rayN/Global.cs
@@ -102,6 +102,13 @@ namespace v2rayN
///
public const string StreamSecurity = "tls";
+ public const string InboundSocks = "socks";
+ public const string InboundHttp = "http";
+ public const string Loopback = "127.0.0.1";
+ public const string InboundAPITagName = "api";
+ public const string InboundAPIProtocal = "dokodemo-door";
+
+
///
/// vmess
///
@@ -147,12 +154,6 @@ namespace v2rayN
///
public const string CustomIconName = "v2rayN.ico";
- public const string Loopback = "127.0.0.1";
-
- public const string InboundAPITagName = "api";
- public const string InboundProxyTagName = "proxy";
- public const string InboundAPIProtocal = "dokodemo-door";
-
public enum StatisticsFreshRate
{
quick = 1000,
@@ -177,17 +178,17 @@ namespace v2rayN
public static bool sysAgent { get; set; }
///
- /// socks端口号
+ /// socks端口
///
public static int socksPort { get; set; }
///
- /// 全局代理端口(http)
+ /// http端口
///
- public static int sysAgentPort { get; set; }
+ public static int httpPort { get; set; }
///
- /// PAC监听端口号
+ /// PAC端口
///
public static int pacPort { get; set; }
diff --git a/v2rayN/v2rayN/Handler/ConfigHandler.cs b/v2rayN/v2rayN/Handler/ConfigHandler.cs
index e4f48d0e..ddf14123 100644
--- a/v2rayN/v2rayN/Handler/ConfigHandler.cs
+++ b/v2rayN/v2rayN/Handler/ConfigHandler.cs
@@ -57,7 +57,7 @@ namespace v2rayN.Handler
{
config.inbound = new List();
InItem inItem = new InItem();
- inItem.protocol = "socks";
+ inItem.protocol = Global.InboundSocks;
inItem.localPort = 10808;
inItem.udpEnabled = true;
inItem.sniffingEnabled = true;
@@ -76,7 +76,7 @@ namespace v2rayN.Handler
//http协议不由core提供,只保留socks
if (config.inbound.Count > 0)
{
- config.inbound[0].protocol = "socks";
+ config.inbound[0].protocol = Global.InboundSocks;
}
}
//路由规则
diff --git a/v2rayN/v2rayN/Handler/DownloadHandle.cs b/v2rayN/v2rayN/Handler/DownloadHandle.cs
index 38b402a0..df26cc70 100644
--- a/v2rayN/v2rayN/Handler/DownloadHandle.cs
+++ b/v2rayN/v2rayN/Handler/DownloadHandle.cs
@@ -87,7 +87,7 @@ namespace v2rayN.Handler
}
- public void DownloadFileAsync(Config config, string url, bool blProxy)
+ public void DownloadFileAsync(Config config, string url, WebProxy webProxy)
{
try
{
@@ -101,9 +101,9 @@ namespace v2rayN.Handler
progressPercentage = -1;
WebClientEx ws = new WebClientEx();
- if (blProxy)
+ if (webProxy != null)
{
- ws.Proxy = new WebProxy(Global.Loopback, Global.sysAgentPort);
+ ws.Proxy = webProxy;// new WebProxy(Global.Loopback, Global.httpPort);
}
ws.DownloadFileCompleted += ws_DownloadFileCompleted;
diff --git a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs
index 6254107d..fefabfe4 100644
--- a/v2rayN/v2rayN/Handler/SpeedtestHandler.cs
+++ b/v2rayN/v2rayN/Handler/SpeedtestHandler.cs
@@ -88,7 +88,7 @@ namespace v2rayN.Handler
}
}
- Thread.Sleep(1);
+ Thread.Sleep(100);
}
catch (Exception ex)
@@ -119,7 +119,7 @@ namespace v2rayN.Handler
}
}
- Thread.Sleep(1);
+ Thread.Sleep(100);
}
catch (Exception ex)
@@ -132,6 +132,12 @@ namespace v2rayN.Handler
{
try
{
+ string msg = string.Empty;
+
+ Global.reloadV2ray = true;
+ _v2rayHandler.LoadV2ray(_config, _selecteds);
+
+ var httpPort = _config.GetLocalPort("speedtest");
for (int k = 0; k < _selecteds.Count; k++)
{
int index = _selecteds[k];
@@ -139,20 +145,12 @@ namespace v2rayN.Handler
{
continue;
}
+
try
{
- if (ConfigHandler.SetDefaultServer(ref _config, index) == 0)
- {
- _v2rayHandler.LoadV2ray(_config);
- }
- else
- {
- return;
- }
- Thread.Sleep(1000 * 5);
-
+ var webProxy = new WebProxy(Global.Loopback, httpPort + index);
int responseTime = -1;
- var status = GetRealPingTime(Global.SpeedPingTestUrl, out responseTime);
+ var status = GetRealPingTime(Global.SpeedPingTestUrl, webProxy, out responseTime);
if (!Utils.IsNullOrEmpty(status))
{
_updateFunc(index, string.Format("{0}", status));
@@ -166,9 +164,12 @@ namespace v2rayN.Handler
{
Utils.SaveLog(ex.Message, ex);
}
+ Thread.Sleep(100);
}
- Thread.Sleep(1);
+ Global.reloadV2ray = true;
+ _v2rayHandler.LoadV2ray(_config);
+ Thread.Sleep(100);
}
catch (Exception ex)
@@ -184,6 +185,9 @@ namespace v2rayN.Handler
return;
}
+ Global.reloadV2ray = true;
+ _v2rayHandler.LoadV2ray(_config, _selecteds);
+
string url = Global.SpeedTestUrl;
testCounter = 0;
if (downloadHandle2 == null)
@@ -213,6 +217,7 @@ namespace v2rayN.Handler
}
};
}
+
if (ServerSpeedTestSub(testCounter, url) != 0)
{
return;
@@ -223,23 +228,19 @@ namespace v2rayN.Handler
{
if (index >= _selecteds.Count)
{
- return -1;
- }
-
- if (ConfigHandler.SetDefaultServer(ref _config, _selecteds[index]) == 0)
- {
+ Global.reloadV2ray = true;
_v2rayHandler.LoadV2ray(_config);
-
- testCounter++;
-
- downloadHandle2.DownloadFileAsync(_config, url,true);
-
- return 0;
- }
- else
- {
return -1;
}
+
+ var httpPort = _config.GetLocalPort("speedtest");
+ index = _selecteds[index];
+
+ testCounter++;
+ var webProxy = new WebProxy(Global.Loopback, httpPort + index);
+ downloadHandle2.DownloadFileAsync(_config, url, webProxy);
+
+ return 0;
}
private int GetTcpingTime(string url, int port)
@@ -267,7 +268,7 @@ namespace v2rayN.Handler
return responseTime;
}
- private string GetRealPingTime(string url, out int responseTime)
+ private string GetRealPingTime(string url, WebProxy webProxy, out int responseTime)
{
string msg = string.Empty;
responseTime = -1;
@@ -276,7 +277,7 @@ namespace v2rayN.Handler
{
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(url);
myHttpWebRequest.Timeout = 5000;
- myHttpWebRequest.Proxy = new WebProxy(Global.Loopback, Global.sysAgentPort);
+ myHttpWebRequest.Proxy = webProxy;//new WebProxy(Global.Loopback, Global.httpPort);
var timer = new Stopwatch();
timer.Start();
diff --git a/v2rayN/v2rayN/Handler/StatisticsHandler.cs b/v2rayN/v2rayN/Handler/StatisticsHandler.cs
index c6074b66..4593b3ca 100644
--- a/v2rayN/v2rayN/Handler/StatisticsHandler.cs
+++ b/v2rayN/v2rayN/Handler/StatisticsHandler.cs
@@ -192,7 +192,7 @@ namespace v2rayN.Handler
name = nStr[1];
type = nStr[3];
- if (name == Global.InboundProxyTagName)
+ if (name == Global.agentTag)
{
if (type == "uplink")
{
diff --git a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
index 6aadec52..bb518a36 100644
--- a/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
+++ b/v2rayN/v2rayN/Handler/V2rayConfigHandler.cs
@@ -1365,5 +1365,90 @@ namespace v2rayN.Handler
#endregion
+ #region Gen speedtest config
+
+
+ public static int GenerateClientSpeedtestConfig(Config config, List selecteds, string fileName, out string msg)
+ {
+ msg = string.Empty;
+
+ try
+ {
+ if (config == null
+ || config.index < 0
+ || config.vmess.Count <= 0
+ || config.index > config.vmess.Count - 1
+ )
+ {
+ msg = UIRes.I18N("CheckServerSettings");
+ return -1;
+ }
+
+ msg = UIRes.I18N("InitialConfiguration");
+
+ string result = Utils.GetEmbedText(SampleClient);
+ if (Utils.IsNullOrEmpty(result))
+ {
+ msg = UIRes.I18N("FailedGetDefaultConfiguration");
+ return -1;
+ }
+
+ V2rayConfig v2rayConfig = Utils.FromJson(result);
+ if (v2rayConfig == null)
+ {
+ msg = UIRes.I18N("FailedGenDefaultConfiguration");
+ return -1;
+ }
+
+ log(config, ref v2rayConfig, false);
+ //routing(config, ref v2rayConfig);
+ dns(config, ref v2rayConfig);
+
+
+ var httpPort = config.GetLocalPort("speedtest");
+ for (int k = 0; k < selecteds.Count; k++)
+ {
+ int index = selecteds[k];
+ if (config.vmess[index].configType == (int)EConfigType.Custom)
+ {
+ continue;
+ }
+
+ config.index = index;
+
+ var inbound = new Inbounds();
+ inbound.listen = Global.Loopback;
+ inbound.port = httpPort + index;
+ inbound.protocol = Global.InboundHttp;
+ inbound.tag = Global.InboundHttp + inbound.port.ToString();
+ v2rayConfig.inbounds.Add(inbound);
+
+
+ var v2rayConfigCopy = Utils.FromJson(result);
+ outbound(config, ref v2rayConfigCopy);
+ v2rayConfigCopy.outbounds[0].tag = Global.agentTag + inbound.port.ToString();
+ v2rayConfig.outbounds.Add(v2rayConfigCopy.outbounds[0]);
+
+ var rule = new Mode.RulesItem();
+ rule.inboundTag = inbound.tag;
+ rule.outboundTag = v2rayConfigCopy.outbounds[0].tag;
+ rule.type = "field";
+ v2rayConfig.routing.rules.Add(rule);
+ }
+
+ Utils.ToJsonFile(v2rayConfig, fileName);
+
+ msg = string.Format(UIRes.I18N("SuccessfulConfiguration"), config.getSummary());
+ }
+ catch (Exception ex)
+ {
+ msg = UIRes.I18N("FailedGenDefaultConfiguration");
+ return -1;
+ }
+ return 0;
+ }
+
+ #endregion
+
}
}
diff --git a/v2rayN/v2rayN/Handler/V2rayHandler.cs b/v2rayN/v2rayN/Handler/V2rayHandler.cs
index 244892c8..a8209775 100644
--- a/v2rayN/v2rayN/Handler/V2rayHandler.cs
+++ b/v2rayN/v2rayN/Handler/V2rayHandler.cs
@@ -52,6 +52,27 @@ namespace v2rayN.Handler
}
}
+ ///
+ /// 载入V2ray
+ ///
+ public void LoadV2ray(Config config, List _selecteds)
+ {
+ if (Global.reloadV2ray)
+ {
+ string msg = string.Empty;
+ string fileName = Utils.GetPath(v2rayConfigRes);
+ if (V2rayConfigHandler.GenerateClientSpeedtestConfig(config, _selecteds, fileName, out msg) != 0)
+ {
+ ShowMsg(false, msg);
+ }
+ else
+ {
+ ShowMsg(true, msg);
+ V2rayRestart();
+ }
+ }
+ }
+
///
/// V2ray重启
///
@@ -118,7 +139,7 @@ namespace v2rayN.Handler
}
}
if (Utils.IsNullOrEmpty(fileName))
- {
+ {
string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2ray/v2ray-core/releases");
ShowMsg(true, msg);
return;
diff --git a/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs b/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs
index 8195e1e1..71dd88de 100644
--- a/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs
+++ b/v2rayN/v2rayN/HttpProxyHandler/HttpProxyHandle.cs
@@ -23,7 +23,7 @@ namespace v2rayN.HttpProxyHandler
{
if (type != 0)
{
- var port = Global.sysAgentPort;
+ var port = Global.httpPort;
if (port <= 0)
{
return false;
@@ -74,7 +74,7 @@ namespace v2rayN.HttpProxyHandler
{
try
{
- int localPort = config.GetLocalPort("socks");
+ int localPort = config.GetLocalPort(Global.InboundSocks);
if (localPort > 0)
{
PrivoxyHandler.Instance.Start(localPort, config);
@@ -82,8 +82,8 @@ namespace v2rayN.HttpProxyHandler
{
Global.sysAgent = true;
Global.socksPort = localPort;
- Global.sysAgentPort = PrivoxyHandler.Instance.RunningPort;
- Global.pacPort = Global.sysAgentPort + 1;
+ Global.httpPort = PrivoxyHandler.Instance.RunningPort;
+ Global.pacPort = config.GetLocalPort("pac");
}
}
}
@@ -100,16 +100,12 @@ namespace v2rayN.HttpProxyHandler
{
try
{
- ////开启全局代理则关闭
- //if (Global.sysAgent)
- //{
PrivoxyHandler.Instance.Stop();
Global.sysAgent = false;
Global.socksPort = 0;
- Global.sysAgentPort = 0;
+ Global.httpPort = 0;
Global.pacPort = 0;
- //}
}
catch
{
@@ -131,7 +127,7 @@ namespace v2rayN.HttpProxyHandler
}
else
{
- int localPort = config.GetLocalPort("socks");
+ int localPort = config.GetLocalPort(Global.InboundSocks);
if (localPort != Global.socksPort)
{
isRestart = true;
diff --git a/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs b/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs
index cc2a033b..a28159bf 100644
--- a/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs
+++ b/v2rayN/v2rayN/HttpProxyHandler/PACServerHandle.cs
@@ -67,7 +67,6 @@ namespace v2rayN.HttpProxyHandler
server = new HttpWebServer(SendResponse, prefixes);
server.Run();
- //pacPort = Global.pacPort;
}
}
Utils.SaveLog("Webserver at " + address);
@@ -95,7 +94,6 @@ namespace v2rayN.HttpProxyHandler
if (serverB == null)
{
serverB = new HttpWebServerB(Global.pacPort, SendResponse);
- //pacPort = Global.pacPort;
}
}
Utils.SaveLog("WebserverB at " + address);
@@ -159,7 +157,7 @@ namespace v2rayN.HttpProxyHandler
private static string GetPacList(string address)
{
- var port = Global.sysAgentPort;
+ var port = Global.httpPort;
if (port <= 0)
{
return "No port";
diff --git a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs
index 939f1415..3bbe6d1d 100644
--- a/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs
+++ b/v2rayN/v2rayN/HttpProxyHandler/PrivoxyHandler.cs
@@ -24,8 +24,6 @@ namespace v2rayN.HttpProxyHandler
private static string _uniqueConfigFile;
private static Job _privoxyJob;
private Process _process;
- private int _runningPort;
- private bool _isRunning;
static PrivoxyHandler()
{
@@ -66,18 +64,7 @@ namespace v2rayN.HttpProxyHandler
public int RunningPort
{
- get
- {
- return _runningPort;
- }
- }
-
- public bool IsRunning
- {
- get
- {
- return _isRunning;
- }
+ get; set;
}
public void Start(int localPort, Config config)
@@ -90,9 +77,9 @@ namespace v2rayN.HttpProxyHandler
KillProcess(p);
}
string privoxyConfig = Resources.privoxy_conf;
- _runningPort = GetFreePort(localPort);
+ RunningPort = config.GetLocalPort(Global.InboundHttp);
privoxyConfig = privoxyConfig.Replace("__SOCKS_PORT__", localPort.ToString());
- privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", _runningPort.ToString());
+ privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_PORT__", RunningPort.ToString());
if (config.allowLANConn)
{
privoxyConfig = privoxyConfig.Replace("__PRIVOXY_BIND_IP__", "0.0.0.0");
@@ -123,7 +110,7 @@ namespace v2rayN.HttpProxyHandler
* when ss exit unexpectedly, this process will be forced killed by system.
*/
_privoxyJob.AddProcess(_process.Handle);
- _isRunning = true;
+
}
}
@@ -134,7 +121,7 @@ namespace v2rayN.HttpProxyHandler
KillProcess(_process);
_process.Dispose();
_process = null;
- _isRunning = false;
+ RunningPort = 0;
}
}
@@ -191,25 +178,5 @@ namespace v2rayN.HttpProxyHandler
}
}
- private int GetFreePort(int localPort)
- {
- int defaultPort = 8123;
- try
- {
- //// TCP stack please do me a favor
- //TcpListener l = new TcpListener(IPAddress.Loopback, 0);
- //l.Start();
- //var port = ((IPEndPoint)l.LocalEndpoint).Port;
- //l.Stop();
- //return port;
- return localPort + 1;
- }
- catch (Exception ex)
- {
- // in case access denied
- Utils.SaveLog(ex.Message, ex);
- return defaultPort;
- }
- }
}
}
diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs
index 1586f621..dc714d6e 100644
--- a/v2rayN/v2rayN/Mode/Config.cs
+++ b/v2rayN/v2rayN/Mode/Config.cs
@@ -13,93 +13,147 @@ namespace v2rayN.Mode
///
/// 本地监听
///
- public List inbound { get; set; }
+ public List inbound
+ {
+ get; set;
+ }
///
/// 允许日志
///
- public bool logEnabled { get; set; }
+ public bool logEnabled
+ {
+ get; set;
+ }
///
/// 日志等级
///
- public string loglevel { get; set; }
+ public string loglevel
+ {
+ get; set;
+ }
///
/// 活动配置序号
///
- public int index { get; set; }
+ public int index
+ {
+ get; set;
+ }
///
/// vmess服务器信息
///
- public List vmess { get; set; }
+ public List vmess
+ {
+ get; set;
+ }
///
/// 允许Mux多路复用
///
- public bool muxEnabled { get; set; }
+ public bool muxEnabled
+ {
+ get; set;
+ }
///
/// 域名解析策略
///
- public string domainStrategy { get; set; }
+ public string domainStrategy
+ {
+ get; set;
+ }
///
/// 路由模式
///
- public string routingMode { get; set; }
+ public string routingMode
+ {
+ get; set;
+ }
///
/// 用户自定义需代理的网址或ip
///
- public List useragent { get; set; }
+ public List useragent
+ {
+ get; set;
+ }
///
/// 用户自定义直连的网址或ip
///
- public List userdirect { get; set; }
+ public List userdirect
+ {
+ get; set;
+ }
///
/// 用户自定义阻止的网址或ip
///
- public List userblock { get; set; }
+ public List userblock
+ {
+ get; set;
+ }
///
/// KcpItem
///
- public KcpItem kcpItem { get; set; }
+ public KcpItem kcpItem
+ {
+ get; set;
+ }
///
/// 启用Http代理
///
- public bool sysAgentEnabled { get; set; }
+ public bool sysAgentEnabled
+ {
+ get; set;
+ }
///
/// 监听状态 0-不改变 1-全局 2-PAC
///
- public int listenerType { get; set; }
+ public int listenerType
+ {
+ get; set;
+ }
///
/// 自定义GFWList url
///
- public string urlGFWList { get; set; }
+ public string urlGFWList
+ {
+ get; set;
+ }
///
/// 允许来自局域网的连接
///
- public bool allowLANConn { get; set; }
+ public bool allowLANConn
+ {
+ get; set;
+ }
///
/// 启用实时网速和流量统计
///
- public bool enableStatistics { get; set; }
+ public bool enableStatistics
+ {
+ get; set;
+ }
///
/// 视图刷新率
///
- public int statisticsFreshRate { get; set; }
+ public int statisticsFreshRate
+ {
+ get; set;
+ }
///
/// 统计数据缓存天数 [0, 30]
@@ -107,9 +161,13 @@ namespace v2rayN.Mode
/// * 无论如何不会关闭总流量的缓存
///
private uint cacheDays;
- public uint CacheDays {
- get { return cacheDays; }
- set
+ public uint CacheDays
+ {
+ get
+ {
+ return cacheDays;
+ }
+ set
{
if (value < 0) cacheDays = 0;
else if (value > 30) cacheDays = 30;
@@ -120,15 +178,24 @@ namespace v2rayN.Mode
///
/// 自定义远程DNS
///
- public string remoteDNS { get; set; }
+ public string remoteDNS
+ {
+ get; set;
+ }
///
/// 订阅
///
- public List subItem { get; set; }
+ public List subItem
+ {
+ get; set;
+ }
///
/// UI
///
- public UIItem uiItem { get; set; }
+ public UIItem uiItem
+ {
+ get; set;
+ }
#region 函数
@@ -236,6 +303,19 @@ namespace v2rayN.Mode
public int GetLocalPort(string protocol)
{
+ if (protocol == Global.InboundHttp)
+ {
+ return GetLocalPort(Global.InboundSocks) + 1;
+ }
+ else if (protocol == "pac")
+ {
+ return GetLocalPort(Global.InboundSocks) + 2;
+ }
+ else if (protocol == "speedtest")
+ {
+ return GetLocalPort(Global.InboundSocks) + 103;
+ }
+
int localPort = 0;
foreach (InItem inItem in inbound)
{
@@ -352,77 +432,125 @@ namespace v2rayN.Mode
///
/// 版本(现在=2)
///
- public int configVersion { get; set; }
+ public int configVersion
+ {
+ get; set;
+ }
///
/// 远程服务器地址
///
- public string address { get; set; }
+ public string address
+ {
+ get; set;
+ }
///
/// 远程服务器端口
///
- public int port { get; set; }
+ public int port
+ {
+ get; set;
+ }
///
/// 远程服务器ID
///
- public string id { get; set; }
+ public string id
+ {
+ get; set;
+ }
///
/// 远程服务器额外ID
///
- public int alterId { get; set; }
+ public int alterId
+ {
+ get; set;
+ }
///
/// 本地安全策略
///
- public string security { get; set; }
+ public string security
+ {
+ get; set;
+ }
///
/// tcp,kcp,ws
///
- public string network { get; set; }
+ public string network
+ {
+ get; set;
+ }
///
/// 备注或别名
///
- public string remarks { get; set; }
+ public string remarks
+ {
+ get; set;
+ }
///
/// 伪装类型
///
- public string headerType { get; set; }
+ public string headerType
+ {
+ get; set;
+ }
///
/// 伪装的域名
///
- public string requestHost { get; set; }
+ public string requestHost
+ {
+ get; set;
+ }
///
/// ws h2 path
///
- public string path { get; set; }
+ public string path
+ {
+ get; set;
+ }
///
/// 底层传输安全
///
- public string streamSecurity { get; set; }
+ public string streamSecurity
+ {
+ get; set;
+ }
///
/// 是否允许不安全连接(用于客户端)
///
- public string allowInsecure { get; set; }
+ public string allowInsecure
+ {
+ get; set;
+ }
///
/// config type(1=normal,2=custom)
///
- public int configType { get; set; }
+ public int configType
+ {
+ get; set;
+ }
///
///
///
- public string testResult { get; set; }
+ public string testResult
+ {
+ get; set;
+ }
///
/// SubItem id
///
- public string subid { get; set; }
+ public string subid
+ {
+ get; set;
+ }
}
[Serializable]
@@ -431,17 +559,26 @@ namespace v2rayN.Mode
///
/// 本地监听端口
///
- public int localPort { get; set; }
+ public int localPort
+ {
+ get; set;
+ }
///
/// 协议,默认为socks
///
- public string protocol { get; set; }
+ public string protocol
+ {
+ get; set;
+ }
///
/// 允许udp
///
- public bool udpEnabled { get; set; }
+ public bool udpEnabled
+ {
+ get; set;
+ }
///
/// 开启流量探测
@@ -455,31 +592,52 @@ namespace v2rayN.Mode
///
///
///
- public int mtu { get; set; }
+ public int mtu
+ {
+ get; set;
+ }
///
///
///
- public int tti { get; set; }
+ public int tti
+ {
+ get; set;
+ }
///
///
///
- public int uplinkCapacity { get; set; }
+ public int uplinkCapacity
+ {
+ get; set;
+ }
///
///
///
- public int downlinkCapacity { get; set; }
+ public int downlinkCapacity
+ {
+ get; set;
+ }
///
///
///
- public bool congestion { get; set; }
+ public bool congestion
+ {
+ get; set;
+ }
///
///
///
- public int readBufferSize { get; set; }
+ public int readBufferSize
+ {
+ get; set;
+ }
///
///
///
- public int writeBufferSize { get; set; }
+ public int writeBufferSize
+ {
+ get; set;
+ }
}
@@ -489,17 +647,26 @@ namespace v2rayN.Mode
///
///
///
- public string id { get; set; }
+ public string id
+ {
+ get; set;
+ }
///
/// 备注
///
- public string remarks { get; set; }
+ public string remarks
+ {
+ get; set;
+ }
///
/// url
///
- public string url { get; set; }
+ public string url
+ {
+ get; set;
+ }
///
/// enable