mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-07 22:28:07 +03:00
* Revert "Temporary addition to support proper use of sing-box v1.12"
This reverts commit 508eb24fc3.
* Migrating to singbox 1.11 support
* Removes unnecessary sniffer
* Migrating to singbox 1.12 support
* Adds Google cn dns rules
* Improves geoip rule handling in singbox
* add anytls support
* Simplifies local DNS address handling
* Enables dhcp interface configuration
* Fetches DNS strategy for domain resolution
* support Wireguard endpoint
Refactors Singbox config classes for dial fields
* Utils.GetFreePort() default port to be zero
* Adds Sing-box legacy DNS config support
* Adds IPv4 preference to DNS configurations
对应原dns.servers[].strategy = prefer_ipv4
* Refactors DNS address parsing
* Fixes config generation
* fix singbox endpoints proxy chain not work
* Fixes wrong field
* Removes direct clash_mode domain strategy
* Improves DNS address parsing in Singbox
DNS type, host, port, and path
* Adds properties to Rule4Sbox class
* Removes Wireguard listen port
* Support sing-box hosts
* Adds tag resolver supports
* Adds sing-box DomainStrategy support
* Deletes Duplicate Rules
* Adds anytls reality support
* Fixes
* Updates sing-box documentation link
* Updates translations
50 lines
1.3 KiB
C#
50 lines
1.3 KiB
C#
using static QRCoder.PayloadGenerator;
|
|
|
|
namespace ServiceLib.Handler.Fmt;
|
|
public class AnytlsFmt : BaseFmt
|
|
{
|
|
public static ProfileItem? Resolve(string str, out string msg)
|
|
{
|
|
msg = ResUI.ConfigurationFormatIncorrect;
|
|
|
|
var parsedUrl = Utils.TryUri(str);
|
|
if (parsedUrl == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
ProfileItem item = new()
|
|
{
|
|
ConfigType = EConfigType.Anytls,
|
|
Remarks = parsedUrl.GetComponents(UriComponents.Fragment, UriFormat.Unescaped),
|
|
Address = parsedUrl.IdnHost,
|
|
Port = parsedUrl.Port,
|
|
};
|
|
var rawUserInfo = Utils.UrlDecode(parsedUrl.UserInfo);
|
|
item.Id = rawUserInfo;
|
|
|
|
var query = Utils.ParseQueryString(parsedUrl.Query);
|
|
_ = ResolveStdTransport(query, ref item);
|
|
|
|
return item;
|
|
}
|
|
|
|
public static string? ToUri(ProfileItem? item)
|
|
{
|
|
if (item == null)
|
|
{
|
|
return null;
|
|
}
|
|
var remark = string.Empty;
|
|
if (item.Remarks.IsNotEmpty())
|
|
{
|
|
remark = "#" + Utils.UrlEncode(item.Remarks);
|
|
}
|
|
var pw = item.Id;
|
|
var dicQuery = new Dictionary<string, string>();
|
|
_ = GetStdTransport(item, Global.None, ref dicQuery);
|
|
|
|
return ToUri(EConfigType.Anytls, item.Address, item.Port, pw, dicQuery, remark);
|
|
}
|
|
}
|