mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-19 21:52:25 +00:00
up routing
This commit is contained in:
parent
9eab95e870
commit
70dadf9964
9 changed files with 230 additions and 21 deletions
|
@ -405,7 +405,7 @@ namespace v2rayN.Forms
|
||||||
}
|
}
|
||||||
v2rayHandler.LoadV2ray(config);
|
v2rayHandler.LoadV2ray(config);
|
||||||
Global.reloadV2ray = false;
|
Global.reloadV2ray = false;
|
||||||
ConfigHandler.ToJsonFile(config);
|
ConfigHandler.SaveConfig(ref config, false);
|
||||||
|
|
||||||
ChangeSysAgent(config.sysAgentEnabled);
|
ChangeSysAgent(config.sysAgentEnabled);
|
||||||
DisplayToolStatus();
|
DisplayToolStatus();
|
||||||
|
@ -416,7 +416,7 @@ namespace v2rayN.Forms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void CloseV2ray()
|
private void CloseV2ray()
|
||||||
{
|
{
|
||||||
ConfigHandler.ToJsonFile(config);
|
ConfigHandler.SaveConfig(ref config, false);
|
||||||
|
|
||||||
ChangeSysAgent(false);
|
ChangeSysAgent(false);
|
||||||
|
|
||||||
|
@ -1234,6 +1234,7 @@ namespace v2rayN.Forms
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
ConfigHandler.SaveConfig(ref config, false);
|
||||||
DisplayToolStatus();
|
DisplayToolStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1399,7 +1400,7 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void tsbPromotion_Click(object sender, EventArgs e)
|
private void tsbPromotion_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
System.Diagnostics.Process.Start(Global.PromotionUrl);
|
System.Diagnostics.Process.Start($"{Global.PromotionUrl}?t={DateTime.Now.Ticks}");
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace v2rayN.Forms
|
||||||
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
chkudpEnabled.Checked = config.inbound[0].udpEnabled;
|
||||||
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
chksniffingEnabled.Checked = config.inbound[0].sniffingEnabled;
|
||||||
|
|
||||||
txtlocalPort2.Text = "socks + 1";
|
txtlocalPort2.Text = $"{config.inbound[0].localPort + 1}";
|
||||||
cmbprotocol2.Text = Global.InboundHttp;
|
cmbprotocol2.Text = Global.InboundHttp;
|
||||||
|
|
||||||
if (config.inbound.Count > 1)
|
if (config.inbound.Count > 1)
|
||||||
|
@ -127,7 +127,7 @@ namespace v2rayN.Forms
|
||||||
cbFreshrate.DisplayMember = "Text";
|
cbFreshrate.DisplayMember = "Text";
|
||||||
cbFreshrate.ValueMember = "ID";
|
cbFreshrate.ValueMember = "ID";
|
||||||
|
|
||||||
switch(config.statisticsFreshRate)
|
switch (config.statisticsFreshRate)
|
||||||
{
|
{
|
||||||
case (int)Global.StatisticsFreshRate.quick:
|
case (int)Global.StatisticsFreshRate.quick:
|
||||||
cbFreshrate.SelectedItem = cbSource[0];
|
cbFreshrate.SelectedItem = cbSource[0];
|
||||||
|
@ -369,10 +369,14 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void btnSetDefRountingRule_Click(object sender, EventArgs e)
|
private void btnSetDefRountingRule_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
txtUseragent.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.agentTag);
|
||||||
|
txtUserdirect.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.directTag);
|
||||||
|
txtUserblock.Text = Utils.GetEmbedText(Global.CustomRoutingFileName + Global.blockTag);
|
||||||
|
|
||||||
var lstUrl = new List<string>();
|
var lstUrl = new List<string>();
|
||||||
lstUrl.Add(Global.CustomRoutingListUrl + "proxy");
|
lstUrl.Add(Global.CustomRoutingListUrl + Global.agentTag);
|
||||||
lstUrl.Add(Global.CustomRoutingListUrl + "direct");
|
lstUrl.Add(Global.CustomRoutingListUrl + Global.directTag);
|
||||||
lstUrl.Add(Global.CustomRoutingListUrl + "block");
|
lstUrl.Add(Global.CustomRoutingListUrl + Global.blockTag);
|
||||||
|
|
||||||
var lstTxt = new List<TextBox>();
|
var lstTxt = new List<TextBox>();
|
||||||
lstTxt.Add(txtUseragent);
|
lstTxt.Add(txtUseragent);
|
||||||
|
@ -415,7 +419,13 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
class ComboItem
|
class ComboItem
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID
|
||||||
public string Text { get; set; }
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@ namespace v2rayN
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BlankPacFileName = "v2rayN.Sample.BlankPac.txt";
|
public const string BlankPacFileName = "v2rayN.Sample.BlankPac.txt";
|
||||||
|
|
||||||
|
public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_";
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 默认加密方式
|
/// 默认加密方式
|
||||||
|
@ -172,32 +174,50 @@ namespace v2rayN
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否需要重启服务V2ray
|
/// 是否需要重启服务V2ray
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool reloadV2ray { get; set; }
|
public static bool reloadV2ray
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否开启全局代理(http)
|
/// 是否开启全局代理(http)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static bool sysAgent { get; set; }
|
public static bool sysAgent
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// socks端口
|
/// socks端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int socksPort { get; set; }
|
public static int socksPort
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// http端口
|
/// http端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int httpPort { get; set; }
|
public static int httpPort
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// PAC端口
|
/// PAC端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int pacPort { get; set; }
|
public static int pacPort
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int statePort { get; set; }
|
public static int statePort
|
||||||
|
{
|
||||||
|
get; set;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
|
@ -307,9 +307,9 @@ namespace v2rayN.Handler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int SaveConfig(ref Config config)
|
public static int SaveConfig(ref Config config, bool reload = true)
|
||||||
{
|
{
|
||||||
Global.reloadV2ray = true;
|
Global.reloadV2ray = reload;
|
||||||
|
|
||||||
ToJsonFile(config);
|
ToJsonFile(config);
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ namespace v2rayN.Handler
|
||||||
/// 存储文件
|
/// 存储文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="config"></param>
|
/// <param name="config"></param>
|
||||||
public static void ToJsonFile(Config config)
|
private static void ToJsonFile(Config config)
|
||||||
{
|
{
|
||||||
Utils.ToJsonFile(config, Utils.GetPath(configRes));
|
Utils.ToJsonFile(config, Utils.GetPath(configRes));
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,4 +33,4 @@ using System.Runtime.InteropServices;
|
||||||
// 方法是按如下所示使用“*”:
|
// 方法是按如下所示使用“*”:
|
||||||
//[assembly: AssemblyVersion("1.0.*")]
|
//[assembly: AssemblyVersion("1.0.*")]
|
||||||
//[assembly: AssemblyVersion("1.0.0")]
|
//[assembly: AssemblyVersion("1.0.0")]
|
||||||
[assembly: AssemblyFileVersion("2.48")]
|
[assembly: AssemblyFileVersion("2.49")]
|
||||||
|
|
1
v2rayN/v2rayN/Sample/custom_routing_block
Normal file
1
v2rayN/v2rayN/Sample/custom_routing_block
Normal file
|
@ -0,0 +1 @@
|
||||||
|
geosite:category-ads,
|
132
v2rayN/v2rayN/Sample/custom_routing_direct
Normal file
132
v2rayN/v2rayN/Sample/custom_routing_direct
Normal file
|
@ -0,0 +1,132 @@
|
||||||
|
domain:12306.com,
|
||||||
|
domain:51ym.me,
|
||||||
|
domain:52pojie.cn,
|
||||||
|
domain:8686c.com,
|
||||||
|
domain:abercrombie.com,
|
||||||
|
domain:adobesc.com,
|
||||||
|
domain:air-matters.com,
|
||||||
|
domain:air-matters.io,
|
||||||
|
domain:airtable.com,
|
||||||
|
domain:akadns.net,
|
||||||
|
domain:apache.org,
|
||||||
|
domain:api.crisp.chat,
|
||||||
|
domain:api.termius.com,
|
||||||
|
domain:appshike.com,
|
||||||
|
domain:appstore.com,
|
||||||
|
domain:aweme.snssdk.com,
|
||||||
|
domain:bababian.com,
|
||||||
|
domain:battle.net,
|
||||||
|
domain:beatsbydre.com,
|
||||||
|
domain:bet365.com,
|
||||||
|
domain:bilibili.cn,
|
||||||
|
domain:ccgslb.com,
|
||||||
|
domain:ccgslb.net,
|
||||||
|
domain:chunbo.com,
|
||||||
|
domain:chunboimg.com,
|
||||||
|
domain:clashroyaleapp.com,
|
||||||
|
domain:cloudsigma.com,
|
||||||
|
domain:cloudxns.net,
|
||||||
|
domain:cmfu.com,
|
||||||
|
domain:culturedcode.com,
|
||||||
|
domain:dct-cloud.com,
|
||||||
|
domain:didialift.com,
|
||||||
|
domain:douyutv.com,
|
||||||
|
domain:duokan.com,
|
||||||
|
domain:dytt8.net,
|
||||||
|
domain:easou.com,
|
||||||
|
domain:ecitic.net,
|
||||||
|
domain:eclipse.org,
|
||||||
|
domain:eudic.net,
|
||||||
|
domain:ewqcxz.com,
|
||||||
|
domain:fir.im,
|
||||||
|
domain:frdic.com,
|
||||||
|
domain:fresh-ideas.cc,
|
||||||
|
domain:godic.net,
|
||||||
|
domain:goodread.com,
|
||||||
|
domain:haibian.com,
|
||||||
|
domain:hdslb.net,
|
||||||
|
domain:hollisterco.com,
|
||||||
|
domain:hongxiu.com,
|
||||||
|
domain:hxcdn.net,
|
||||||
|
domain:images.unsplash.com,
|
||||||
|
domain:img4me.com,
|
||||||
|
domain:ipify.org,
|
||||||
|
domain:ixdzs.com,
|
||||||
|
domain:jd.hk,
|
||||||
|
domain:jianshuapi.com,
|
||||||
|
domain:jomodns.com,
|
||||||
|
domain:jsboxbbs.com,
|
||||||
|
domain:knewone.com,
|
||||||
|
domain:kuaidi100.com,
|
||||||
|
domain:lemicp.com,
|
||||||
|
domain:letvcloud.com,
|
||||||
|
domain:lizhi.io,
|
||||||
|
domain:localizecdn.com,
|
||||||
|
domain:lucifr.com,
|
||||||
|
domain:luoo.net,
|
||||||
|
domain:mai.tn,
|
||||||
|
domain:maven.org,
|
||||||
|
domain:miwifi.com,
|
||||||
|
domain:moji.com,
|
||||||
|
domain:moke.com,
|
||||||
|
domain:mtalk.google.com,
|
||||||
|
domain:mxhichina.com,
|
||||||
|
domain:myqcloud.com,
|
||||||
|
domain:myunlu.com,
|
||||||
|
domain:netease.com,
|
||||||
|
domain:nfoservers.com,
|
||||||
|
domain:nssurge.com,
|
||||||
|
domain:nuomi.com,
|
||||||
|
domain:ourdvs.com,
|
||||||
|
domain:overcast.fm,
|
||||||
|
domain:paypal.com,
|
||||||
|
domain:paypalobjects.com,
|
||||||
|
domain:pgyer.com,
|
||||||
|
domain:qdaily.com,
|
||||||
|
domain:qdmm.com,
|
||||||
|
domain:qin.io,
|
||||||
|
domain:qingmang.me,
|
||||||
|
domain:qingmang.mobi,
|
||||||
|
domain:qqurl.com,
|
||||||
|
domain:rarbg.to,
|
||||||
|
domain:rrmj.tv,
|
||||||
|
domain:ruguoapp.com,
|
||||||
|
domain:sm.ms,
|
||||||
|
domain:snwx.com,
|
||||||
|
domain:soku.com,
|
||||||
|
domain:startssl.com,
|
||||||
|
domain:store.steampowered.com,
|
||||||
|
domain:symcd.com,
|
||||||
|
domain:teamviewer.com,
|
||||||
|
domain:tmzvps.com,
|
||||||
|
domain:trello.com,
|
||||||
|
domain:trellocdn.com,
|
||||||
|
domain:ttmeiju.com,
|
||||||
|
domain:udache.com,
|
||||||
|
domain:uxengine.net,
|
||||||
|
domain:weather.bjango.com,
|
||||||
|
domain:weather.com,
|
||||||
|
domain:webqxs.com,
|
||||||
|
domain:weico.cc,
|
||||||
|
domain:wenku8.net,
|
||||||
|
domain:werewolf.53site.com,
|
||||||
|
domain:windowsupdate.com,
|
||||||
|
domain:wkcdn.com,
|
||||||
|
domain:workflowy.com,
|
||||||
|
domain:xdrig.com,
|
||||||
|
domain:xiaojukeji.com,
|
||||||
|
domain:xiaomi.net,
|
||||||
|
domain:xiaomicp.com,
|
||||||
|
domain:ximalaya.com,
|
||||||
|
domain:xitek.com,
|
||||||
|
domain:xmcdn.com,
|
||||||
|
domain:xslb.net,
|
||||||
|
domain:xteko.com,
|
||||||
|
domain:yach.me,
|
||||||
|
domain:yixia.com,
|
||||||
|
domain:yunjiasu-cdn.net,
|
||||||
|
domain:zealer.com,
|
||||||
|
domain:zgslb.net,
|
||||||
|
domain:zimuzu.tv,
|
||||||
|
domain:zmz002.com,
|
||||||
|
domain:samsungdm.com,
|
33
v2rayN/v2rayN/Sample/custom_routing_proxy
Normal file
33
v2rayN/v2rayN/Sample/custom_routing_proxy
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
geosite:google,
|
||||||
|
geosite:github,
|
||||||
|
geosite:netflix,
|
||||||
|
geosite:steam,
|
||||||
|
geosite:telegram,
|
||||||
|
geosite:tumblr,
|
||||||
|
geosite:speedtest,
|
||||||
|
geosite:bbc,
|
||||||
|
domain:gvt1.com,
|
||||||
|
domain:textnow.com,
|
||||||
|
domain:twitch.tv,
|
||||||
|
domain:wikileaks.org,
|
||||||
|
domain:naver.com,
|
||||||
|
91.108.4.0/22,
|
||||||
|
91.108.8.0/22,
|
||||||
|
91.108.12.0/22,
|
||||||
|
91.108.20.0/22,
|
||||||
|
91.108.36.0/23,
|
||||||
|
91.108.38.0/23,
|
||||||
|
91.108.56.0/22,
|
||||||
|
149.154.160.0/20,
|
||||||
|
149.154.164.0/22,
|
||||||
|
149.154.172.0/22,
|
||||||
|
74.125.0.0/16,
|
||||||
|
173.194.0.0/16,
|
||||||
|
172.217.0.0/16,
|
||||||
|
216.58.200.0/24,
|
||||||
|
216.58.220.0/24,
|
||||||
|
91.108.56.116,
|
||||||
|
91.108.56.0/24,
|
||||||
|
109.239.140.0/24,
|
||||||
|
149.154.167.0/24,
|
||||||
|
149.154.175.0/24,
|
|
@ -150,6 +150,12 @@
|
||||||
<Compile Include="Forms\MainForm.Designer.cs">
|
<Compile Include="Forms\MainForm.Designer.cs">
|
||||||
<DependentUpon>MainForm.cs</DependentUpon>
|
<DependentUpon>MainForm.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Forms\RoutingRuleSettingForm.cs">
|
||||||
|
<SubType>Form</SubType>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Forms\RoutingRuleSettingForm.Designer.cs">
|
||||||
|
<DependentUpon>RoutingRuleSettingForm.cs</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Forms\SubSettingForm.cs">
|
<Compile Include="Forms\SubSettingForm.cs">
|
||||||
<SubType>Form</SubType>
|
<SubType>Form</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -286,6 +292,9 @@
|
||||||
<DependentUpon>QRCodeControl.cs</DependentUpon>
|
<DependentUpon>QRCodeControl.cs</DependentUpon>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Include="Forms\RoutingRuleSettingForm.resx">
|
||||||
|
<DependentUpon>RoutingRuleSettingForm.cs</DependentUpon>
|
||||||
|
</EmbeddedResource>
|
||||||
<EmbeddedResource Include="Forms\SubSettingControl.resx">
|
<EmbeddedResource Include="Forms\SubSettingControl.resx">
|
||||||
<DependentUpon>SubSettingControl.cs</DependentUpon>
|
<DependentUpon>SubSettingControl.cs</DependentUpon>
|
||||||
</EmbeddedResource>
|
</EmbeddedResource>
|
||||||
|
@ -340,6 +349,9 @@
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<EmbeddedResource Include="Sample\custom_routing_block" />
|
||||||
|
<EmbeddedResource Include="Sample\custom_routing_direct" />
|
||||||
|
<EmbeddedResource Include="Sample\custom_routing_proxy" />
|
||||||
<Protobuf Include="Protos\Statistics.proto" />
|
<Protobuf Include="Protos\Statistics.proto" />
|
||||||
<None Include="Resources\abp.js.gz" />
|
<None Include="Resources\abp.js.gz" />
|
||||||
<None Include="Resources\grpc_csharp_ext.x64.dll.gz" />
|
<None Include="Resources\grpc_csharp_ext.x64.dll.gz" />
|
||||||
|
|
Loading…
Reference in a new issue