oznu / docker-cloudflare-ddns

A small amd64/ARM/ARM64 Docker image that allows you to use CloudFlare as a DDNS / DynDNS Provider.
https://hub.docker.com/r/oznu/cloudflare-ddns/
GNU General Public License v3.0
1.07k stars 213 forks source link

fixing dns ip addr retrieval for century link issue #30

Closed clevernyyyy closed 4 years ago

clevernyyyy commented 4 years ago

CenturyLink doesn't allow use of 1.1.1.1 for IP addr retrieval. Proposed change in order to work with my provider.

clevernyyyy commented 4 years ago

This was pointed out to me. I think we should just reverse this if possible. https://github.com/oznu/docker-cloudflare-ddns/pull/21/commits

JakeWharton commented 4 years ago

What is the behavior? Why doesn't the fallback work?

clevernyyyy commented 4 years ago

It times out, see open issue.

JakeWharton commented 4 years ago

So it would seem that the fallback mechanism needs fixed. Otherwise what's the point of having it?

clevernyyyy commented 4 years ago

That is certainly one option, yes. I think I would prefer not wasting the cycles before falling back.

clevernyyyy commented 4 years ago

I have no context why the fall back mechanism was put in place. Reversing the change to cloud flare fixes my issue. I didn't have reason to reverse the fallback, so I did not.

ptts commented 4 years ago

One might also play around with dig's timeout and tries option/tries and use both 1.1.1.1 and opendns.

+time=T Sets the timeout for a query to T seconds. The default timeout is 5 seconds. An attempt to set T to less than 1 will result in a query timeout of 1 second being applied.

+tries=T Sets the number of times to try UDP queries to server to T instead of the default, 3. If T is less than or equal to zero, the number of tries is silently rounded up to 1.

clevernyyyy commented 4 years ago

I have added a ternary statement. Regardless of dig's timeout and tries operations, everything halted with the timeout output. However, I did take @ptts suggestion and just use both since everyone seems adamant to keep the cloudflare dns in regardless of the extra time it causes people in my predicament.

This new commit is a ternary statement which will utilize myip.opendns if people's ISPs block 1.1.1.1 like mine does.

oznu commented 4 years ago

Pulling this in for testing.

clevernyyyy commented 4 years ago

@oznu - if you prefer a one-liner with grep to the ternary, there's also this option:

( dig +short @1.1.1.1 ch txt whoami.cloudflare || dig +short myip.opendns.com @resolver1.opendns.com ) | tr -d '"' | grep -vF ';; connection timed out;'

oznu commented 4 years ago

I pushed a small fix to your PR to test. Can you confirm it's still working? It's published using the test tag.

docker pull oznu/cloudflare-ddns:test
clevernyyyy commented 4 years ago

@oznu - it works!

oznu commented 4 years ago

Thanks @clevernyyyy. The latest tag will be updated shortly.