zhboner / realm

A network relay tool
MIT License
1.62k stars 291 forks source link

feat: advanced mapping with support for splitting configurations into multiple files. #139

Closed Zerorigin closed 2 months ago

Zerorigin commented 3 months ago

我正在为 advanced mapping 添加“支持将配置拆分到多个配置文件”的特性。 我在编写代码的时候遇到了点小问题,需要向开发团队确认一下。

我需要调用 realm::conf::net::NetConf 下的 is_empty 函数对其进行非空判断, 但是我发现它似乎忽略对 no_tcp, use_udp 这两个属性的判断。 https://github.com/zhboner/realm/blob/d8810e345c9e69063eed32297113dc94c0a7c552/src/conf/net.rs#L67-L73 我想了解是之前编写代码时发生了遗漏,还是这是一个别有用意(其它特殊用途)的忽略? 我不太熟悉 rust,更重要的是没那么多时间阅读代码。

按照我目前获得的信息来理解,正确的代码片段应该差不多是这样子的:

    fn is_empty(&self) -> bool {
        crate::empty![self =>
            no_tcp, use_udp, ipv6_only,
            send_proxy, accept_proxy, send_proxy_version, accept_proxy_timeout,
            tcp_keepalive, tcp_keepalive_probe, tcp_timeout, udp_timeout
        ]
    }

期待能得到开发者的答疑。

zephyrchien commented 3 months ago

Thank you for your interest in this project. The code was written 2+ years ago that I dont still remember so many details.

At a first glance, I think you're probably right. I will have a deeper look at it when I have time. And If you have other suggestions or ideas, please go ahead.

Zerorigin commented 3 months ago

Thank you for your interest in this project. The code was written 2+ years ago that I dont still remember so many details.

At a first glance, I think you're probably right. I will have a deeper look at it when I have time. And If you have other suggestions or ideas, please go ahead.

大概率是遗漏,我找了下,发现没有其它代码引用了此内置方法,一会我会针对此行代码提交个修复请求。

zephyrchien commented 3 months ago

Ok thank you. I may not able to review at the earliest time.