mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Compare commits
No commits in common. "65ee5eb510ad2d44248660ab87487d9e17dbac0f" and "f2ed8c1d6b1b93b37b7a2affff1bfa4c22bc4315" have entirely different histories.
65ee5eb510
...
f2ed8c1d6b
5 changed files with 51 additions and 12 deletions
|
@ -1484,7 +1484,16 @@ public static class ConfigHandler
|
|||
if (profileItem is null)
|
||||
{
|
||||
profileItem = Hysteria2Fmt.ResolveFull2(strData, subRemarks);
|
||||
}
|
||||
}
|
||||
if (profileItem is null)
|
||||
{
|
||||
profileItem = Hysteria2Fmt.ResolveFull(strData, subRemarks);
|
||||
}
|
||||
//Is naiveproxy configuration
|
||||
if (profileItem is null)
|
||||
{
|
||||
profileItem = NaiveproxyFmt.ResolveFull(strData, subRemarks);
|
||||
}
|
||||
if (profileItem is null || profileItem.Address.IsNullOrEmpty())
|
||||
{
|
||||
return -1;
|
||||
|
|
|
@ -4,7 +4,7 @@ public class ClashFmt : BaseFmt
|
|||
{
|
||||
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
|
||||
{
|
||||
if (Contains(strData, "rules", "-port", "proxies"))
|
||||
if (Contains(strData, "external-controller", "-port", "proxies"))
|
||||
{
|
||||
var fileName = WriteAllText(strData, "yaml");
|
||||
|
||||
|
|
|
@ -63,6 +63,24 @@ public class Hysteria2Fmt : BaseFmt
|
|||
return ToUri(EConfigType.Hysteria2, item.Address, item.Port, item.Id, dicQuery, remark);
|
||||
}
|
||||
|
||||
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
|
||||
{
|
||||
if (Contains(strData, "server", "up", "down", "listen", "<html>", "<body>"))
|
||||
{
|
||||
var fileName = WriteAllText(strData);
|
||||
|
||||
var profileItem = new ProfileItem
|
||||
{
|
||||
CoreType = ECoreType.hysteria,
|
||||
Address = fileName,
|
||||
Remarks = subRemarks ?? "hysteria_custom"
|
||||
};
|
||||
return profileItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static ProfileItem? ResolveFull2(string strData, string? subRemarks)
|
||||
{
|
||||
if (Contains(strData, "server", "auth", "up", "down", "listen"))
|
||||
|
|
22
v2rayN/ServiceLib/Handler/Fmt/NaiveproxyFmt.cs
Normal file
22
v2rayN/ServiceLib/Handler/Fmt/NaiveproxyFmt.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
namespace ServiceLib.Handler.Fmt;
|
||||
|
||||
public class NaiveproxyFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
|
||||
{
|
||||
if (Contains(strData, "listen", "proxy", "<html>", "<body>"))
|
||||
{
|
||||
var fileName = WriteAllText(strData);
|
||||
|
||||
var profileItem = new ProfileItem
|
||||
{
|
||||
CoreType = ECoreType.naiveproxy,
|
||||
Address = fileName,
|
||||
Remarks = subRemarks ?? "naiveproxy_custom"
|
||||
};
|
||||
return profileItem;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -43,16 +43,6 @@ public partial class CoreConfigSingboxService
|
|||
});
|
||||
}
|
||||
|
||||
//Outbound Freedom Resolver
|
||||
var freedomOutbound = singboxConfig.outbounds?.FirstOrDefault(t => t is { type: "direct", tag: Global.DirectTag });
|
||||
if (freedomOutbound != null)
|
||||
{
|
||||
freedomOutbound.domain_resolver = new()
|
||||
{
|
||||
server = Global.SingboxDirectDNSTag,
|
||||
};
|
||||
}
|
||||
|
||||
await GenOutboundDnsRule(node, singboxConfig, Global.SingboxOutboundResolverTag);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
Loading…
Reference in a new issue