Skip to content

Conversation

@DHR60
Copy link
Contributor

@DHR60 DHR60 commented Aug 13, 2025

No description provided.

@DHR60
Copy link
Contributor Author

DHR60 commented Aug 13, 2025

还有这边序列化字段不全

v2rayConfig.dns = JsonUtils.Deserialize<Dns4Ray>(JsonUtils.Serialize(obj));

public class Dns4Ray
{
public Dictionary<string, List<string>>? hosts { get; set; }
public List<object> servers { get; set; }
}
public class DnsServer4Ray
{
public string? address { get; set; }
public List<string>? domains { get; set; }
public bool? skipFallback { get; set; }
public List<string>? expectedIPs { get; set; }
public List<string>? unexpectedIPs { get; set; }
}

以及这个问题 2dust/v2rayNG#4838
使用 xray 负载均衡,规则为绕过大陆,策略是 IPIfNonMatch 时,远程 DNS 会分流失败,全部回落到第一个节点上

@2dust 2dust merged commit a739065 into 2dust:master Aug 14, 2025
@2dust
Copy link
Owner

2dust commented Aug 14, 2025

还有这边序列化字段不全

这里 Dns4Ray? dns 换成直接用 object? dns
如果是用户自定义 dns ,直接 赋值给它,
如果是应用组合的 dns 则用 Dns4Ray
如何?

@DHR60
Copy link
Contributor Author

DHR60 commented Aug 14, 2025

public class Dns4Ray
{
    public Dictionary<string, object>? hosts { get; set; }
    public List<object> servers { get; set; }
    public string? clientIp { get; set; }
    public string? queryStrategy { get; set; }
    public bool? disableCache { get; set; }
    public bool? disableFallback { get; set; }
    public bool? disableFallbackIfMatch { get; set; }
    public bool? useSystemHosts { get; set; }
    public string? tag { get; set; }
}

public class DnsServer4Ray
{
    public string? address { get; set; }
    public List<string>? domains { get; set; }
    public bool? skipFallback { get; set; }
    public List<string>? expectedIPs { get; set; }
    public List<string>? unexpectedIPs { get; set; }
    public string? clientIp { get; set; }
    public string? queryStrategy { get; set; }
    public int? timeoutMs { get; set; }
    public bool? disableCache { get; set; }
    public bool? finalQuery { get; set; }
    public string? tag { get; set; }
}

这样就都能转换了

多类型的也就 hosts 和 servers ,这两个用 object 就够了

@DHR60
Copy link
Contributor Author

DHR60 commented Aug 14, 2025

使用 xray 负载均衡,规则为绕过大陆,策略是 IPIfNonMatch 时,远程 DNS 会分流失败,全部回落到第一个节点上

这个可以给整个 DNS 模块加一个 tag,路由最后加个 DNS 模块走代理,国内国外 DNS 的分流还是靠路由规则吧,要不不太好搞,并且 Add tag for DnsServerObject 是 25.5.16 才有的,旧版本可能没法用

@2dust
Copy link
Owner

2dust commented Aug 14, 2025

使用 xray 负载均衡,规则为绕过大陆,策略是 IPIfNonMatch 时,远程 DNS 会分流失败,全部回落到第一个节点上

这个可以给整个 DNS 模块加一个 tag,路由最后加个 DNS 模块走代理,国内国外 DNS 的分流还是靠路由规则吧,要不不太好搞,并且 Add tag for DnsServerObject 是 25.5.16 才有的,旧版本可能没法用

不好弄就不处理就行了

@DHR60 DHR60 deleted the fix2 branch August 14, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants