cloudflare / cloudflare/cloudflared
How can I specify DNS Resolver as environment variable or command line argument
- Dominant language
- Go
- Stars
- 15.6k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the feature you'd like*
As the title, because `cloudflared` uses go dns resolver, it looks for `/etc/resolv.conf` (for linux binaries) when try to resolve domains - which not the case on Android systems.
If it doen't find that file, it sets the default name server to `localhost:53`
https://github.com/golang/go/blob/e335a2665f5e322a7da8baa22fe816b6ef9aaf24/src/net/dnsconfig.go#L14
Which cause problems as here:

There's a few possible solutions:
+ On rooted Android phone, we could just create the `/etc/resolv.conf` file
+ Another way is to add a static entry to `/etc/hosts` for our domainns
+ Building a non-staticly linked version `cloudflared`. If we build a binary linked to libc it will use that to do name resolution which will probably fix this issue.
The first two require the device/emulator to be rooted.
The third one is too annoying because `cloudflared` is constantly updated, and adding a release build/fork for this is waste time.
**Describe alternatives you've considered**
Are there any alternatives to solving this problem? If so, what was your experience with them?
I think environment variable or command line argument is the best way in a scripting context.
Contributor guide
Assessment
This issue has not been assessed yet.