using --hosts-files=./path gives invalid argument error
- how to reproduce:
echo "10.10.10.10 somehost" >> path dnsproxy --hosts-files=./path
- error msg:
2024/09/10 13:30:09.174559 INFO dnsproxy starting version=0.73.1 revision="" branch="" commit_time="" 2024/09/10 13:30:09.174606 ERROR running dnsproxy err="configuring proxy: creating default handler: open ./path: invalid argument"
DNSProxy prepends a slash to the path, so you need the full path without a leading slash. For example, if you're in /home/whoever, you would need --hosts-files=home/whoever/path.
DNSProxy prepends a slash to the path
But why? I've encountered this too and it's confusing.
For example, if you're in /home/whoever, you would need --hosts-files=home/whoever/path.
In other words the path is always considered as absolute (a current directory doesn't matter) and a leading slash has to be omitted?
This seems to be an error in how paths are handled in relation to the root filesystem.
@schzhn, please investigate. I feel like Windows paths in particular might pose an issue.
dnsproxy v0.74.0 now supports both absolute paths and paths relative to the current directory.