zhboner / realm

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

DNS resolve runs when not required #121

Closed ocfox closed 10 months ago

ocfox commented 10 months ago

If it's just a local network relay that's needed it's possible that the DNS service isn't needed, I run it on a machine that doesn't have a DNS service and it results in the following error.

realm[644]: fd: soft=524288, hard=524288
realm[644]: log: level=off, output=stdout
realm[644]: dns: mode=ipv4_and_ipv6, protocol=tcp+udp, min-ttl=0, max-ttl=86400, cache-size=32, servers=system
realm[644]: thread 'main' panicked at realm_core/src/dns/mod.rs:29:47:
realm[644]: called `Result::unwrap()` on an `Err` value: ResolveError { kind: Io(Os { code: 2, kind: NotFound, message: "No such file or directory" }) }
realm[644]: note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Running it without getting the system DNS resolution service might be possible.

zephyrchien commented 10 months ago

This error is caused by the non-existence of /etc/resolv.conf when attempting to load the system-wide dns configuration..

While dns resolution is not necesaary here, this behavior should be avoided.

ocfox commented 10 months ago

Is it possible to have setup_dns run when dns resolution is needed instead of the default behavior? https://github.com/zhboner/realm/blob/882c2e3c00e73aba97cddc02295a92a1daaaa1e8/src/bin.rs#L60

Well it looks like it's a complicated change, so maybe it's simpler to just start resolved.