Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b57ba6a98b | ||
|
|
d748e6eff4 | ||
|
|
315d4b75b2 | ||
|
|
31267cbc33 | ||
|
|
c23379b3b6 | ||
|
|
568144d6a2 |
@@ -1,6 +1,13 @@
|
|||||||
using QRCoder;
|
using QRCoder;
|
||||||
using QRCoder.Xaml;
|
using QRCoder.Xaml;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using ZXing.Common;
|
||||||
|
using ZXing.QrCode;
|
||||||
|
using ZXing.Windows.Compatibility;
|
||||||
|
using ZXing;
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
@@ -28,5 +35,70 @@ namespace v2rayN
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ScanScreen(float dpiX, float dpiY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var left = (int)(SystemParameters.WorkArea.Left);
|
||||||
|
var top = (int)(SystemParameters.WorkArea.Top);
|
||||||
|
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
||||||
|
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
||||||
|
|
||||||
|
using Bitmap fullImage = new Bitmap(width, height);
|
||||||
|
using (Graphics g = Graphics.FromImage(fullImage))
|
||||||
|
{
|
||||||
|
g.CopyFromScreen(left, top, 0, 0, fullImage.Size, CopyPixelOperation.SourceCopy);
|
||||||
|
}
|
||||||
|
int maxTry = 10;
|
||||||
|
for (int i = 0; i < maxTry; i++)
|
||||||
|
{
|
||||||
|
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
|
||||||
|
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
|
||||||
|
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
|
||||||
|
Bitmap target = new(width, height);
|
||||||
|
|
||||||
|
double imageScale = (double)width / (double)cropRect.Width;
|
||||||
|
using (Graphics g = Graphics.FromImage(target))
|
||||||
|
{
|
||||||
|
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
|
||||||
|
cropRect,
|
||||||
|
GraphicsUnit.Pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapLuminanceSource source = new(target);
|
||||||
|
QRCodeReader reader = new();
|
||||||
|
|
||||||
|
BinaryBitmap bitmap = new(new HybridBinarizer(source));
|
||||||
|
var result = reader.decode(bitmap);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
return result.Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BinaryBitmap bitmap2 = new(new HybridBinarizer(source.invert()));
|
||||||
|
var result2 = reader.decode(bitmap2);
|
||||||
|
if (result2 != null)
|
||||||
|
{
|
||||||
|
return result2.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(ex.Message, ex);
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Tuple<float, float> GetDpiXY(Window window)
|
||||||
|
{
|
||||||
|
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
|
||||||
|
Graphics g = Graphics.FromHwnd(hWnd);
|
||||||
|
|
||||||
|
return new(96 / g.DpiX, 96 / g.DpiY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,6 @@ using System.Windows;
|
|||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using ZXing;
|
|
||||||
using ZXing.Common;
|
|
||||||
using ZXing.QrCode;
|
|
||||||
using ZXing.Windows.Compatibility;
|
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
@@ -481,7 +477,7 @@ namespace v2rayN
|
|||||||
/// 验证Domain地址是否合法
|
/// 验证Domain地址是否合法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="domain"></param>
|
/// <param name="domain"></param>
|
||||||
public static bool IsDomain(string domain)
|
public static bool IsDomain(string? domain)
|
||||||
{
|
{
|
||||||
//如果为空
|
//如果为空
|
||||||
if (IsNullOrEmpty(domain))
|
if (IsNullOrEmpty(domain))
|
||||||
@@ -950,66 +946,6 @@ namespace v2rayN
|
|||||||
|
|
||||||
#endregion TempPath
|
#endregion TempPath
|
||||||
|
|
||||||
#region scan screen
|
|
||||||
|
|
||||||
public static string ScanScreen(float dpiX, float dpiY)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var left = (int)(SystemParameters.WorkArea.Left);
|
|
||||||
var top = (int)(SystemParameters.WorkArea.Top);
|
|
||||||
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
|
||||||
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
|
||||||
|
|
||||||
using Bitmap fullImage = new Bitmap(width, height);
|
|
||||||
using (Graphics g = Graphics.FromImage(fullImage))
|
|
||||||
{
|
|
||||||
g.CopyFromScreen(left, top, 0, 0, fullImage.Size, CopyPixelOperation.SourceCopy);
|
|
||||||
}
|
|
||||||
int maxTry = 10;
|
|
||||||
for (int i = 0; i < maxTry; i++)
|
|
||||||
{
|
|
||||||
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
|
|
||||||
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
|
|
||||||
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
|
|
||||||
Bitmap target = new(width, height);
|
|
||||||
|
|
||||||
double imageScale = (double)width / (double)cropRect.Width;
|
|
||||||
using (Graphics g = Graphics.FromImage(target))
|
|
||||||
{
|
|
||||||
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
|
|
||||||
cropRect,
|
|
||||||
GraphicsUnit.Pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
BitmapLuminanceSource source = new(target);
|
|
||||||
BinaryBitmap bitmap = new(new HybridBinarizer(source));
|
|
||||||
QRCodeReader reader = new();
|
|
||||||
Result result = reader.decode(bitmap);
|
|
||||||
if (result != null)
|
|
||||||
{
|
|
||||||
string ret = result.Text;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logging.SaveLog(ex.Message, ex);
|
|
||||||
}
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Tuple<float, float> GetDpiXY(Window window)
|
|
||||||
{
|
|
||||||
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
|
|
||||||
Graphics g = Graphics.FromHwnd(hWnd);
|
|
||||||
|
|
||||||
return new(96 / g.DpiX, 96 / g.DpiY);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion scan screen
|
|
||||||
|
|
||||||
#region 开机自动启动等
|
#region 开机自动启动等
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ namespace v2rayN
|
|||||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||||
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
||||||
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
||||||
|
public static readonly List<string> destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"];
|
||||||
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
||||||
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
||||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||||
|
|||||||
@@ -111,7 +111,8 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
singboxConfig.inbounds.Clear();
|
var listen = "::";
|
||||||
|
singboxConfig.inbounds = [];
|
||||||
|
|
||||||
if (!_config.tunModeItem.enableTun || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound))
|
if (!_config.tunModeItem.enableTun || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound))
|
||||||
{
|
{
|
||||||
@@ -146,11 +147,11 @@ namespace v2rayN.Handler
|
|||||||
if (_config.inbound[0].newPort4LAN)
|
if (_config.inbound[0].newPort4LAN)
|
||||||
{
|
{
|
||||||
var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true);
|
var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true);
|
||||||
inbound3.listen = "::";
|
inbound3.listen = listen;
|
||||||
singboxConfig.inbounds.Add(inbound3);
|
singboxConfig.inbounds.Add(inbound3);
|
||||||
|
|
||||||
var inbound4 = GetInbound(inbound, EInboundProtocol.http2, false);
|
var inbound4 = GetInbound(inbound, EInboundProtocol.http2, false);
|
||||||
inbound4.listen = "::";
|
inbound4.listen = listen;
|
||||||
singboxConfig.inbounds.Add(inbound4);
|
singboxConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
@@ -162,8 +163,8 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inbound.listen = "::";
|
inbound.listen = listen;
|
||||||
inbound2.listen = "::";
|
inbound2.listen = listen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -810,24 +811,9 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//Add the dns of the remote server domain
|
|
||||||
if (dns4Sbox.rules is null)
|
|
||||||
{
|
|
||||||
dns4Sbox.rules = new();
|
|
||||||
}
|
|
||||||
dns4Sbox.servers.Add(new()
|
|
||||||
{
|
|
||||||
tag = "local_local",
|
|
||||||
address = "223.5.5.5",
|
|
||||||
detour = Global.DirectTag,
|
|
||||||
});
|
|
||||||
dns4Sbox.rules.Add(new()
|
|
||||||
{
|
|
||||||
server = "local_local",
|
|
||||||
outbound = "any"
|
|
||||||
});
|
|
||||||
|
|
||||||
singboxConfig.dns = dns4Sbox;
|
singboxConfig.dns = dns4Sbox;
|
||||||
|
|
||||||
|
GenDnsDomains(singboxConfig);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -836,6 +822,35 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int GenDnsDomains(SingboxConfig singboxConfig)
|
||||||
|
{
|
||||||
|
var dns4Sbox = singboxConfig.dns ?? new();
|
||||||
|
dns4Sbox.servers ??= [];
|
||||||
|
dns4Sbox.rules ??= [];
|
||||||
|
|
||||||
|
var lstDomain = singboxConfig.outbounds
|
||||||
|
.Where(t => !Utils.IsNullOrEmpty(t.server) && Utils.IsDomain(t.server))
|
||||||
|
.Select(t => t.server)
|
||||||
|
.ToList();
|
||||||
|
if (lstDomain != null && lstDomain.Count > 0)
|
||||||
|
{
|
||||||
|
var tag = "local_local";
|
||||||
|
dns4Sbox.servers.Insert(0, new()
|
||||||
|
{
|
||||||
|
tag = tag,
|
||||||
|
address = "223.5.5.5",
|
||||||
|
detour = Global.DirectTag,
|
||||||
|
});
|
||||||
|
dns4Sbox.rules.Insert(0, new()
|
||||||
|
{
|
||||||
|
server = tag,
|
||||||
|
domain = lstDomain
|
||||||
|
});
|
||||||
|
}
|
||||||
|
singboxConfig.dns = dns4Sbox;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private int GenExperimental(SingboxConfig singboxConfig)
|
private int GenExperimental(SingboxConfig singboxConfig)
|
||||||
{
|
{
|
||||||
if (_config.guiItem.enableStatistics)
|
if (_config.guiItem.enableStatistics)
|
||||||
@@ -1076,18 +1091,18 @@ namespace v2rayN.Handler
|
|||||||
singboxConfig.route.rules.Add(rule);
|
singboxConfig.route.rules.Add(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenDns(new(), singboxConfig);
|
GenDnsDomains(singboxConfig);
|
||||||
var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
//var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
||||||
if (dnsServer != null)
|
//if (dnsServer != null)
|
||||||
{
|
//{
|
||||||
dnsServer.detour = singboxConfig.route.rules.LastOrDefault()?.outbound;
|
// dnsServer.detour = singboxConfig.route.rules.LastOrDefault()?.outbound;
|
||||||
}
|
//}
|
||||||
var dnsRule = singboxConfig.dns?.rules.Where(t => t.outbound != null).FirstOrDefault();
|
//var dnsRule = singboxConfig.dns?.rules.Where(t => t.outbound != null).FirstOrDefault();
|
||||||
if (dnsRule != null)
|
//if (dnsRule != null)
|
||||||
{
|
//{
|
||||||
singboxConfig.dns.rules = [];
|
// singboxConfig.dns.rules = [];
|
||||||
singboxConfig.dns.rules.Add(dnsRule);
|
// singboxConfig.dns.rules.Add(dnsRule);
|
||||||
}
|
//}
|
||||||
|
|
||||||
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
v2rayConfig.inbounds = new List<Inbounds4Ray>();
|
var listen = "0.0.0.0";
|
||||||
|
v2rayConfig.inbounds = [];
|
||||||
|
|
||||||
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], EInboundProtocol.socks, true);
|
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], EInboundProtocol.socks, true);
|
||||||
v2rayConfig.inbounds.Add(inbound);
|
v2rayConfig.inbounds.Add(inbound);
|
||||||
@@ -112,11 +113,11 @@ namespace v2rayN.Handler
|
|||||||
if (_config.inbound[0].newPort4LAN)
|
if (_config.inbound[0].newPort4LAN)
|
||||||
{
|
{
|
||||||
var inbound3 = GetInbound(_config.inbound[0], EInboundProtocol.socks2, true);
|
var inbound3 = GetInbound(_config.inbound[0], EInboundProtocol.socks2, true);
|
||||||
inbound3.listen = "0.0.0.0";
|
inbound3.listen = listen;
|
||||||
v2rayConfig.inbounds.Add(inbound3);
|
v2rayConfig.inbounds.Add(inbound3);
|
||||||
|
|
||||||
var inbound4 = GetInbound(_config.inbound[0], EInboundProtocol.http2, false);
|
var inbound4 = GetInbound(_config.inbound[0], EInboundProtocol.http2, false);
|
||||||
inbound4.listen = "0.0.0.0";
|
inbound4.listen = listen;
|
||||||
v2rayConfig.inbounds.Add(inbound4);
|
v2rayConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
@@ -131,8 +132,8 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inbound.listen = "0.0.0.0";
|
inbound.listen = listen;
|
||||||
inbound2.listen = "0.0.0.0";
|
inbound2.listen = listen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,24 +144,25 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Inbounds4Ray? GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
||||||
{
|
{
|
||||||
string result = Utils.GetEmbedText(Global.V2raySampleInbound);
|
string result = Utils.GetEmbedText(Global.V2raySampleInbound);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
return null;
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
var inbound = JsonUtils.Deserialize<Inbounds4Ray>(result);
|
var inbound = JsonUtils.Deserialize<Inbounds4Ray>(result);
|
||||||
if (inbound == null)
|
if (inbound == null)
|
||||||
{
|
{
|
||||||
return null;
|
return new();
|
||||||
}
|
}
|
||||||
inbound.tag = protocol.ToString();
|
inbound.tag = protocol.ToString();
|
||||||
inbound.port = inItem.localPort + (int)protocol;
|
inbound.port = inItem.localPort + (int)protocol;
|
||||||
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
||||||
inbound.settings.udp = inItem.udpEnabled;
|
inbound.settings.udp = inItem.udpEnabled;
|
||||||
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
||||||
|
inbound.sniffing.destOverride = inItem.destOverride;
|
||||||
inbound.sniffing.routeOnly = inItem.routeOnly;
|
inbound.sniffing.routeOnly = inItem.routeOnly;
|
||||||
|
|
||||||
return inbound;
|
return inbound;
|
||||||
|
|||||||
@@ -47,8 +47,8 @@ namespace v2rayN.Models
|
|||||||
public bool udpEnabled { get; set; }
|
public bool udpEnabled { get; set; }
|
||||||
|
|
||||||
public bool sniffingEnabled { get; set; } = true;
|
public bool sniffingEnabled { get; set; } = true;
|
||||||
|
public List<string>? destOverride { get; set; } = ["http", "tls"];
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
|
|
||||||
public bool allowLANConn { get; set; }
|
public bool allowLANConn { get; set; }
|
||||||
|
|
||||||
public bool newPort4LAN { get; set; }
|
public bool newPort4LAN { get; set; }
|
||||||
|
|||||||
@@ -95,7 +95,7 @@
|
|||||||
{
|
{
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
public string server { get; set; }
|
public string? server { get; set; }
|
||||||
public int? server_port { get; set; }
|
public int? server_port { get; set; }
|
||||||
public string uuid { get; set; }
|
public string uuid { get; set; }
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
|
|||||||
@@ -195,7 +195,7 @@ namespace v2rayN.Models
|
|||||||
public class Sniffing4Ray
|
public class Sniffing4Ray
|
||||||
{
|
{
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
public List<string> destOverride { get; set; }
|
public List<string>? destOverride { get; set; }
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,56 +4,7 @@
|
|||||||
"error": "Verror.log",
|
"error": "Verror.log",
|
||||||
"loglevel": "warning"
|
"loglevel": "warning"
|
||||||
},
|
},
|
||||||
"inbounds": [{
|
"inbounds": [],
|
||||||
"tag": "tag1",
|
|
||||||
"port": 10808,
|
|
||||||
"protocol": "socks",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"auth": "noauth",
|
|
||||||
"udp": true
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "tag2",
|
|
||||||
"port": 10809,
|
|
||||||
"protocol": "http",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"allowTransparent": false
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "tag3",
|
|
||||||
"port": 10809,
|
|
||||||
"protocol": "http",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"allowTransparent": false
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outbounds": [{
|
"outbounds": [{
|
||||||
"tag": "proxy",
|
"tag": "proxy",
|
||||||
"protocol": "vmess",
|
"protocol": "vmess",
|
||||||
|
|||||||
@@ -3,14 +3,7 @@
|
|||||||
"level": "debug",
|
"level": "debug",
|
||||||
"timestamp": true
|
"timestamp": true
|
||||||
},
|
},
|
||||||
"inbounds": [
|
"inbounds": [],
|
||||||
{
|
|
||||||
"type": "socks",
|
|
||||||
"tag": "socks",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 10000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outbounds": [
|
"outbounds": [
|
||||||
{
|
{
|
||||||
"type": "vless",
|
"type": "vless",
|
||||||
|
|||||||
@@ -30,5 +30,6 @@
|
|||||||
],
|
],
|
||||||
"server": "block"
|
"server": "block"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"final": "local"
|
||||||
}
|
}
|
||||||
@@ -30,5 +30,6 @@
|
|||||||
],
|
],
|
||||||
"server": "block"
|
"server": "block"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"final": "local"
|
||||||
}
|
}
|
||||||
@@ -1026,10 +1026,10 @@ namespace v2rayN.ViewModels
|
|||||||
{
|
{
|
||||||
ShowHideWindow(false);
|
ShowHideWindow(false);
|
||||||
|
|
||||||
var dpiXY = Utils.GetDpiXY(Application.Current.MainWindow);
|
var dpiXY = QRCodeHelper.GetDpiXY(Application.Current.MainWindow);
|
||||||
string result = await Task.Run(() =>
|
string result = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
return Utils.ScanScreen(dpiXY.Item1, dpiXY.Item2);
|
return QRCodeHelper.ScanScreen(dpiXY.Item1, dpiXY.Item2);
|
||||||
});
|
});
|
||||||
|
|
||||||
ShowHideWindow(true);
|
ShowHideWindow(true);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace v2rayN.ViewModels
|
|||||||
[Reactive] public int localPort { get; set; }
|
[Reactive] public int localPort { get; set; }
|
||||||
[Reactive] public bool udpEnabled { get; set; }
|
[Reactive] public bool udpEnabled { get; set; }
|
||||||
[Reactive] public bool sniffingEnabled { get; set; }
|
[Reactive] public bool sniffingEnabled { get; set; }
|
||||||
|
public IList<string> destOverride { get; set; }
|
||||||
[Reactive] public bool routeOnly { get; set; }
|
[Reactive] public bool routeOnly { get; set; }
|
||||||
[Reactive] public bool allowLANConn { get; set; }
|
[Reactive] public bool allowLANConn { get; set; }
|
||||||
[Reactive] public bool newPort4LAN { get; set; }
|
[Reactive] public bool newPort4LAN { get; set; }
|
||||||
@@ -279,6 +280,7 @@ namespace v2rayN.ViewModels
|
|||||||
_config.inbound[0].localPort = localPort;
|
_config.inbound[0].localPort = localPort;
|
||||||
_config.inbound[0].udpEnabled = udpEnabled;
|
_config.inbound[0].udpEnabled = udpEnabled;
|
||||||
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||||
|
_config.inbound[0].destOverride = destOverride?.ToList();
|
||||||
_config.inbound[0].routeOnly = routeOnly;
|
_config.inbound[0].routeOnly = routeOnly;
|
||||||
_config.inbound[0].allowLANConn = allowLANConn;
|
_config.inbound[0].allowLANConn = allowLANConn;
|
||||||
_config.inbound[0].newPort4LAN = newPort4LAN;
|
_config.inbound[0].newPort4LAN = newPort4LAN;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/dns.html#dnsobject");
|
Utils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkDnsSingboxObjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkDnsSingboxObjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
<materialDesign:DialogHost
|
<materialDesign:DialogHost
|
||||||
Identifier="RootDialog"
|
Identifier="RootDialog"
|
||||||
|
materialDesign:TransitionAssist.DisableTransitions="True"
|
||||||
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
|
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
|
||||||
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
|||||||
@@ -119,12 +119,22 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
||||||
<ToggleButton
|
<StackPanel
|
||||||
x:Name="togsniffingEnabled"
|
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Grid.ColumnSpan="2"
|
||||||
HorizontalAlignment="Left" />
|
Orientation="Horizontal">
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="togsniffingEnabled"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
HorizontalAlignment="Left" />
|
||||||
|
<ListBox
|
||||||
|
x:Name="clbdestOverride"
|
||||||
|
Margin="4"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
FontSize="{DynamicResource StdFontSize}"
|
||||||
|
Style="{StaticResource MaterialDesignFilterChipPrimaryListBox}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
|
|||||||
@@ -34,6 +34,15 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
ViewModel = new OptionSettingViewModel(this);
|
ViewModel = new OptionSettingViewModel(this);
|
||||||
|
|
||||||
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
|
Global.destOverrideProtocols.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.Items.Add(it);
|
||||||
|
});
|
||||||
|
_config.inbound[0].destOverride?.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.SelectedItems.Add(it);
|
||||||
|
});
|
||||||
Global.IEProxyProtocols.ForEach(it =>
|
Global.IEProxyProtocols.ForEach(it =>
|
||||||
{
|
{
|
||||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
||||||
@@ -213,5 +222,10 @@ namespace v2rayN.Views
|
|||||||
}
|
}
|
||||||
return lstFonts;
|
return lstFonts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
|
{
|
||||||
|
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkRuleobjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkRuleobjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html#ruleobject");
|
Utils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkdomainStrategy_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void linkdomainStrategy_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html");
|
Utils.ProcessStart("https://xtls.github.io/config/routing.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
|
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -23,7 +23,10 @@
|
|||||||
TextOptions.TextRenderingMode="Auto"
|
TextOptions.TextRenderingMode="Auto"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<materialDesign:DialogHost Identifier="SubDialog" Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
<materialDesign:DialogHost
|
||||||
|
materialDesign:TransitionAssist.DisableTransitions="True"
|
||||||
|
Identifier="SubDialog"
|
||||||
|
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ToolBarTray DockPanel.Dock="Top">
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
<ToolBar
|
<ToolBar
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||||
<FileVersion>6.44</FileVersion>
|
<FileVersion>6.45</FileVersion>
|
||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
||||||
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
||||||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
||||||
<PackageReference Include="ReactiveUI.Validation" Version="4.0.6" />
|
<PackageReference Include="ReactiveUI.Validation" Version="4.0.9" />
|
||||||
<PackageReference Include="ReactiveUI.WPF" Version="20.0.1" />
|
<PackageReference Include="ReactiveUI.WPF" Version="20.0.1" />
|
||||||
<PackageReference Include="Splat.NLog" Version="15.0.1" />
|
<PackageReference Include="Splat.NLog" Version="15.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user