zhboner / realm

A network relay tool
MIT License
1.56k stars 285 forks source link

Error parsing resolv.conf #143

Closed yxmyxmyyy closed 2 weeks ago

yxmyxmyyy commented 2 weeks ago

你好,我在运营商的光猫上面运行realm,但是出现resolv解析错误,我查看了/etc/resolv的格式,由于各种原因无法对resolv进行修改(修改后可以运行,但是重启会变回去),请问能否兼容这种resolv格式?

/tmp # ./realm -l 0.0.0.0:6666 -r 1.1.1.1:443
fd: soft=4096, hard=4096
log: level=off, output=stdout
dns: mode=ipv4_and_ipv6, protocol=tcp+udp, min-ttl=0, max-ttl=86400, cache-size=32,
servers=system
thread 'main' panicked at realm_core/src/dns/mod.rs:33:47:
called `Result::unwrap()` on an `Err` value: ResolveError { kind: Io(Custom { kind:
Other, error: "Error parsing resolv.conf: directive at line 0 is not recognized" })
}
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
/tmp # cat /etc/resolv.conf
wancid  IGD.WD1.WCD1.WCPPP1
IPMode  .:
nameserver      211.x.x.x
nameserver      211.x.x.x
nameserver      2409::x
nameserver      2409::x
wancid  IGD.WD1.WCD1.WCPPP1
IPMode  .:
zephyrchien commented 2 weeks ago

e1ac490 now /etc/resolv.conf is no longer enforced on unix-like platforms. If there's no such file or the file format's broken, it falls back to Google DNS. You could still override the DNS resolver with cmd arguments or configuration files in Realm, which is recommended in such use case.

Supporting a non-standard format usually brings endless troubles..

yxmyxmyyy commented 2 weeks ago

thanks,its worked