Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问会支持IPv6转发吗 #36

Closed
kdurov opened this issue Aug 15, 2021 · 3 comments
Closed

请问会支持IPv6转发吗 #36

kdurov opened this issue Aug 15, 2021 · 3 comments

Comments

@kdurov
Copy link

kdurov commented Aug 15, 2021

realm -l [::]:12345 -r example.com:12345
无法监听v6的样子

谢谢

@zephyrchien
Copy link
Collaborator

这是个BUG

realm/src/lib.rs

Lines 83 to 87 in 6f8cb4e

let client_parse: Vec<&str> = client.split(":").collect();
if client_parse.len() != 2 {
panic!("client address is incorrect!");
}
let listening_address = String::from_str(client_parse[0]).unwrap();

zephyrchien added a commit to zephyrchien/realm that referenced this issue Aug 15, 2021
@kdurov
Copy link
Author

kdurov commented Sep 28, 2021

尝试了下1.5版本,此问题依然未彻底解决。
可以监听v6端口了,但是仍然无法转发到v6地址。 -r 后面直接写v6地址的话报错

thread 'tokio-runtime-worker' panicked at 'called Result::unwrap() on an Err value: ResolveError { kind: Proto(ProtoError { kind: Msg("Label contains invalid characters: Err(Errors { invalid_mapping, disallowed_by_std3_ascii_rules })") }) }', src/resolver.rs:18:53
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

@zhboner @zephyrchien
麻烦看看是否还有解析问题,谢谢。

@zephyrchien
Copy link
Collaborator

感谢report。目前已经定位到问题了,但是还没有比较好的解决方法

标准库的 ipv6 parser 在解析ipv6+port时要求给IP加中括号(比如 [::1]:80),而直接解析ipv6的时候则不需要加中括号(比如 ::1)

realm目前的解析策略是启动时提取ipv6和port,同时定时解析ipv6。等发起新连接时再合并当前的ipv6+port,解析字符串得到socket_addr。如果按 [::1]:80 的格式填写地址,首次解析ipv6时就panic;如果以 ::1:80 的格式填写,则发起连接的时panic

@zhboner 也许是时候重构一下resolver了,顺便还能把 #24 解决掉。能否把我加入collaborators,我会负责这部分的重构

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

No branches or pull requests

2 participants