Compare commits

...

5 commits

Author SHA1 Message Date
fonaix
e45c1ddb36
Merge branch '2dust:master' into master 2024-12-05 08:31:48 +08:00
2dust
fd8f863c5b Add stream-one for xhttp mode
Some checks failed
release macos / build (Release) (push) Has been cancelled
release / build (Release) (push) Has been cancelled
2024-12-03 18:00:55 +08:00
2dust
246f1d7df0
Update README.md
Some checks are pending
release macos / build (Release) (push) Waiting to run
release / build (Release) (push) Waiting to run
2024-12-03 17:54:13 +08:00
2dust
ccacda9bf5 Using mixed local listening ports 2024-12-03 15:01:36 +08:00
2dust
5494d63878 Remove v2fly-core UI operation support 2024-12-03 13:58:56 +08:00
19 changed files with 40 additions and 101 deletions

View file

@ -1,5 +1,5 @@
# v2rayN
A GUI client for Windows and Linux, support [Xray core](https://github.com/XTLS/Xray-core) and [others](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores)
A GUI client for Windows and Linux, support [Xray core](https://github.com/XTLS/Xray-core) and [sing-box-core](https://github.com/SagerNet/sing-box/releases) and [others](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/2dust/v2rayN)](https://github.com/2dust/v2rayN/commits/master)

View file

@ -5,9 +5,7 @@
v2fly = 1,
Xray = 2,
v2fly_v5 = 4,
mihomo = 13,
hysteria = 21,
naiveproxy = 22,
tuic = 23,

View file

@ -3,12 +3,11 @@
public enum EInboundProtocol
{
socks = 0,
http,
socks2,
http2,
pac,
api,
api2,
mixed,
speedtest = 21
}
}

View file

@ -182,14 +182,13 @@
public static readonly List<string> Flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> Networks = new() { "tcp", "kcp", "ws", "httpupgrade", "xhttp", "h2", "quic", "grpc" };
public static readonly List<string> KcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> CoreTypes = new() { "v2fly", "Xray", "sing_box" };
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };
public static readonly List<string> CoreTypes = new() { "Xray", "sing_box" };
public static readonly List<string> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
public static readonly List<string> DomainMatchers = new() { "linear", "mph", "" };
public static readonly List<string> Fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
public static readonly List<string> UserAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
public static readonly List<string> XhttpMode = new() { "auto", "packet-up", "stream-up" };
public static readonly List<string> XhttpMode = new() { "auto", "packet-up", "stream-up", "stream-one" };
public static readonly List<string> AllowInsecure = new() { "true", "false", "" };
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
@ -199,7 +198,7 @@
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2", "h2,http/1.1", "h3,h2,http/1.1", "" };
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", "socks2" };
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
public static readonly List<string> RuleNetworks = new() { "", "tcp", "udp", "tcp,udp" };
public static readonly List<string> destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"];

View file

@ -264,16 +264,8 @@
return (ECoreType)profileItem.CoreType;
}
if (_config.CoreTypeItem == null)
{
return ECoreType.Xray;
}
var item = _config.CoreTypeItem.FirstOrDefault(it => it.ConfigType == eConfigType);
if (item == null)
{
return ECoreType.Xray;
}
return item.CoreType;
var item = _config.CoreTypeItem?.FirstOrDefault(it => it.ConfigType == eConfigType);
return item?.CoreType ?? ECoreType.Xray;
}
#endregion Core Type

View file

@ -13,8 +13,7 @@
try
{
var port = AppHandler.Instance.GetLocalPort(EInboundProtocol.http);
var portSocks = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
var port = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
if (port <= 0)
{
return false;
@ -23,7 +22,7 @@
{
case ESysProxyType.ForcedChange when Utils.IsWindows():
{
GetWindowsProxyString(config, port, portSocks, out var strProxy, out var strExceptions);
GetWindowsProxyString(config, port, out var strProxy, out var strExceptions);
ProxySettingWindows.SetProxy(strProxy, strExceptions, 2);
break;
}
@ -64,7 +63,7 @@
return true;
}
private static void GetWindowsProxyString(Config config, int port, int portSocks, out string strProxy, out string strExceptions)
private static void GetWindowsProxyString(Config config, int port, out string strProxy, out string strExceptions)
{
strExceptions = $"{config.ConstItem.DefIEProxyExceptions};{config.SystemProxyItem.SystemProxyExceptions}";
if (config.SystemProxyItem.NotProxyLocalAddress)
@ -82,7 +81,7 @@
strProxy = config.SystemProxyItem.SystemProxyAdvancedProtocol
.Replace("{ip}", Global.Loopback)
.Replace("{http_port}", port.ToString())
.Replace("{socks_port}", portSocks.ToString());
.Replace("{socks_port}", port.ToString());
}
}

View file

@ -3311,7 +3311,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 SOCKS Port 的本地化字符串。
/// 查找类似 Mixed Port 的本地化字符串。
/// </summary>
public static string TbSettingsSocksPort {
get {
@ -3320,7 +3320,7 @@ namespace ServiceLib.Resx {
}
/// <summary>
/// 查找类似 http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6; 的本地化字符串。
/// 查找类似 Pac port = +2; Xray API port = +3; mihomo API port = +4; 的本地化字符串。
/// </summary>
public static string TbSettingsSocksPortTip {
get {

View file

@ -752,7 +752,7 @@
<value>Turn on Sniffing</value>
</data>
<data name="TbSettingsSocksPort" xml:space="preserve">
<value>ساکس Port</value>
<value>Mixed Port</value>
</data>
<data name="TbSettingsStartBoot" xml:space="preserve">
<value>درهنگام راه ائدازی شروع شود</value>
@ -1244,7 +1244,7 @@
<value>Copy the font TTF/TTC file to the directory guiFonts, restart the settings</value>
</data>
<data name="TbSettingsSocksPortTip" xml:space="preserve">
<value>http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6;</value>
<value>Pac port = +2; Xray API port = +3; mihomo API port = +4;</value>
</data>
<data name="TbSettingsStartBootTip" xml:space="preserve">
<value>Set this with admin privileges, get admin privileges after startup</value>

View file

@ -755,7 +755,7 @@
<value>Turn on Sniffing</value>
</data>
<data name="TbSettingsSocksPort" xml:space="preserve">
<value>SOCKS Port</value>
<value>Mixed Port</value>
</data>
<data name="TbSettingsStartBoot" xml:space="preserve">
<value>Start on boot</value>
@ -992,7 +992,7 @@
<value>Copy the font TTF/TTC file to the directory guiFonts, restart the settings</value>
</data>
<data name="TbSettingsSocksPortTip" xml:space="preserve">
<value>http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6;</value>
<value>Pac port = +2; Xray API port = +3; mihomo API port = +4;</value>
</data>
<data name="TbSettingsStartBootTip" xml:space="preserve">
<value>Set this with admin privileges, get admin privileges after startup</value>

View file

@ -761,7 +761,7 @@
<value>Включить сниффинг</value>
</data>
<data name="TbSettingsSocksPort" xml:space="preserve">
<value>Порт Socks</value>
<value>Mixed Port</value>
</data>
<data name="TbSettingsStartBoot" xml:space="preserve">
<value>Автозапуск</value>
@ -1310,7 +1310,7 @@
<value>Move up and down</value>
</data>
<data name="TbSettingsSocksPortTip" xml:space="preserve">
<value>http port = +1; Pac port = +4; *ray API port = +5; mihomo API port = +6;</value>
<value>Pac port = +2; Xray API port = +3; mihomo API port = +4;</value>
</data>
<data name="TbSettingsCurrentFontFamilyLinuxTip" xml:space="preserve">
<value>Install the font to the system and restart the settings</value>

View file

@ -755,7 +755,7 @@
<value>开启流量探测</value>
</data>
<data name="TbSettingsSocksPort" xml:space="preserve">
<value>本地socks监听端口</value>
<value>本地混合监听端口</value>
</data>
<data name="TbSettingsStartBoot" xml:space="preserve">
<value>开机启动(可能会不成功)</value>
@ -992,7 +992,7 @@
<value>拷贝字体TTF/TTC文件到目录guiFonts重启设置</value>
</data>
<data name="TbSettingsSocksPortTip" xml:space="preserve">
<value>http端口= +1Pac端口= +4*ray API端口= +5mihomo API端口= +6</value>
<value>Pac端口= +2Xray API端口= +3mihomo API端口= +4</value>
</data>
<data name="TbSettingsStartBootTip" xml:space="preserve">
<value>以管理员权限设置此项,在启动后获得管理员权限</value>

View file

@ -755,7 +755,7 @@
<value>開啟流量探測</value>
</data>
<data name="TbSettingsSocksPort" xml:space="preserve">
<value>本機SOCKS偵聽埠</value>
<value>本機混合偵聽埠</value>
</data>
<data name="TbSettingsStartBoot" xml:space="preserve">
<value>開機啟動(可能會不成功)</value>
@ -992,7 +992,7 @@
<value>複製字型TTF/TTC檔案到目錄guiFonts重啟設定</value>
</data>
<data name="TbSettingsSocksPortTip" xml:space="preserve">
<value>http連接埠= +1Pac連接埠= +4*ray API連接埠= +5mihomo API連接埠= +6</value>
<value>Pac連接埠= +2Xray API連接埠= +3mihomo API連接埠= +4</value>
</data>
<data name="TbSettingsStartBootTip" xml:space="preserve">
<value>以管理員權限設定此項,在啟動後獲得管理員權限</value>

View file

@ -78,10 +78,8 @@ namespace ServiceLib.Services.CoreConfig
return ret;
}
//port
fileContent["port"] = AppHandler.Instance.GetLocalPort(EInboundProtocol.http);
//socks-port
fileContent["socks-port"] = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
//mixed-port
fileContent["mixed-port"] = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
//log-level
fileContent["log-level"] = GetLogLevel(_config.CoreBasicItem.Loglevel);

View file

@ -174,7 +174,7 @@ namespace ServiceLib.Services.CoreConfig
{
listen = Global.Loopback,
listen_port = port,
type = EInboundProtocol.http.ToString(),
type = EInboundProtocol.mixed.ToString(),
};
inbound.tag = inbound.type + inbound.listen_port.ToString();
singboxConfig.inbounds.Add(inbound);
@ -488,7 +488,7 @@ namespace ServiceLib.Services.CoreConfig
{
var inbound = new Inbound4Sbox()
{
type = EInboundProtocol.socks.ToString(),
type = EInboundProtocol.mixed.ToString(),
tag = EInboundProtocol.socks.ToString(),
listen = Global.Loopback,
};
@ -505,10 +505,6 @@ namespace ServiceLib.Services.CoreConfig
inbound.domain_strategy = routing.DomainStrategy4Singbox;
}
//http
var inbound2 = GetInbound(inbound, EInboundProtocol.http, false);
singboxConfig.inbounds.Add(inbound2);
if (_config.Inbound.First().AllowLANConn)
{
if (_config.Inbound.First().NewPort4LAN)
@ -517,21 +513,15 @@ namespace ServiceLib.Services.CoreConfig
inbound3.listen = listen;
singboxConfig.inbounds.Add(inbound3);
var inbound4 = GetInbound(inbound, EInboundProtocol.http2, false);
inbound4.listen = listen;
singboxConfig.inbounds.Add(inbound4);
//auth
if (Utils.IsNotEmpty(_config.Inbound.First().User) && Utils.IsNotEmpty(_config.Inbound.First().Pass))
{
inbound3.users = new() { new() { username = _config.Inbound.First().User, password = _config.Inbound.First().Pass } };
inbound4.users = new() { new() { username = _config.Inbound.First().User, password = _config.Inbound.First().Pass } };
}
}
else
{
inbound.listen = listen;
inbound2.listen = listen;
}
}
}
@ -574,7 +564,7 @@ namespace ServiceLib.Services.CoreConfig
var inbound = JsonUtils.DeepCopy(inItem);
inbound.tag = protocol.ToString();
inbound.listen_port = inItem.listen_port + (int)protocol;
inbound.type = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
inbound.type = EInboundProtocol.mixed.ToString();
return inbound;
}

View file

@ -322,7 +322,7 @@ namespace ServiceLib.Services.CoreConfig
{
listen = Global.Loopback,
port = port,
protocol = EInboundProtocol.http.ToString(),
protocol = EInboundProtocol.socks.ToString(),
};
inbound.tag = inbound.protocol + inbound.port.ToString();
v2rayConfig.inbounds.Add(inbound);
@ -391,13 +391,9 @@ namespace ServiceLib.Services.CoreConfig
var listen = "0.0.0.0";
v2rayConfig.inbounds = [];
Inbounds4Ray? inbound = GetInbound(_config.Inbound.First(), EInboundProtocol.socks, true);
var inbound = GetInbound(_config.Inbound.First(), EInboundProtocol.socks, true);
v2rayConfig.inbounds.Add(inbound);
//http
Inbounds4Ray? inbound2 = GetInbound(_config.Inbound.First(), EInboundProtocol.http, false);
v2rayConfig.inbounds.Add(inbound2);
if (_config.Inbound.First().AllowLANConn)
{
if (_config.Inbound.First().NewPort4LAN)
@ -406,24 +402,16 @@ namespace ServiceLib.Services.CoreConfig
inbound3.listen = listen;
v2rayConfig.inbounds.Add(inbound3);
var inbound4 = GetInbound(_config.Inbound.First(), EInboundProtocol.http2, false);
inbound4.listen = listen;
v2rayConfig.inbounds.Add(inbound4);
//auth
if (Utils.IsNotEmpty(_config.Inbound.First().User) && Utils.IsNotEmpty(_config.Inbound.First().Pass))
{
inbound3.settings.auth = "password";
inbound3.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.Inbound.First().User, pass = _config.Inbound.First().Pass } };
inbound4.settings.auth = "password";
inbound4.settings.accounts = new List<AccountsItem4Ray> { new AccountsItem4Ray() { user = _config.Inbound.First().User, pass = _config.Inbound.First().Pass } };
}
}
else
{
inbound.listen = listen;
inbound2.listen = listen;
}
}
}
@ -449,7 +437,7 @@ namespace ServiceLib.Services.CoreConfig
}
inbound.tag = protocol.ToString();
inbound.port = inItem.LocalPort + (int)protocol;
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
inbound.protocol = EInboundProtocol.socks.ToString();
inbound.settings.udp = inItem.UdpEnabled;
inbound.sniffing.enabled = inItem.SniffingEnabled;
inbound.sniffing.destOverride = inItem.DestOverride;

View file

@ -280,7 +280,7 @@ namespace ServiceLib.Services
{
return null;
}
var httpPort = AppHandler.Instance.GetLocalPort(EInboundProtocol.http);
var httpPort = AppHandler.Instance.GetLocalPort(EInboundProtocol.socks);
if (await SocketCheck(Global.Loopback, httpPort) == false)
{
return null;

View file

@ -451,9 +451,7 @@ namespace ServiceLib.ViewModels
public async Task InboundDisplayStatus()
{
StringBuilder sb = new();
sb.Append($"[{EInboundProtocol.socks}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]");
sb.Append(" | ");
sb.Append($"[{EInboundProtocol.http}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.http)}]");
sb.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]");
InboundDisplay = $"{ResUI.LabLocal}:{sb}";
if (_config.Inbound.First().AllowLANConn)
@ -461,9 +459,7 @@ namespace ServiceLib.ViewModels
if (_config.Inbound.First().NewPort4LAN)
{
StringBuilder sb2 = new();
sb2.Append($"[{EInboundProtocol.socks}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}]");
sb2.Append(" | ");
sb2.Append($"[{EInboundProtocol.http}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.http2)}]");
sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}]");
InboundLanDisplay = $"{ResUI.LabLAN}:{sb2}";
}
else

View file

@ -26,20 +26,10 @@ namespace v2rayN.Desktop.Views
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
if (profileItem.ConfigType == EConfigType.VLESS)
Global.CoreTypes.ForEach(it =>
{
Global.CoreTypes4VLESS.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
else
{
Global.CoreTypes.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
cmbCoreType.Items.Add(it);
});
cmbCoreType.Items.Add(string.Empty);
cmbStreamSecurity.Items.Add(string.Empty);

View file

@ -20,20 +20,10 @@ namespace v2rayN.Views
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
if (profileItem.ConfigType == EConfigType.VLESS)
Global.CoreTypes.ForEach(it =>
{
Global.CoreTypes4VLESS.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
else
{
Global.CoreTypes.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
cmbCoreType.Items.Add(it);
});
cmbCoreType.Items.Add(string.Empty);
cmbStreamSecurity.Items.Add(string.Empty);