zerotier / zeronsd

A DNS server for ZeroTier users
https://zerotier.com
BSD 3-Clause "New" or "Revised" License
518 stars 57 forks source link

Fail the app when binding to a port fails #218

Open laduke opened 1 year ago

laduke commented 1 year ago

tokio is was eating the panics and continuing on with no socket listening on 53

making tokio crash would take a bunch of rewrite, i think, so i moved the bind calls out to a different fn

The error looks like this:

thread 'main' panicked at 'Could not bind TCP port 53. Are you root?', ~/repos/github.com/zerotier/zeronsd/src/server.rs:31:23
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
laduke commented 1 year ago

Thanks. I couldn't get that to work for some reason and you motivated me to fix it.

Now it makes errors that look like this:

Error: Failed to bind TCP port 53

Caused by:
    Permission denied (os error 13)
Error: Failed to bind UDP port 53

Caused by:
    Address already in use (os error 48)
erikh commented 1 year ago

Glad to be of help! I hadn't used with_context() before. Neat call!