anaganisk/digitalocean-dynamic-dns-ip

disabling ipv6 check has no effect?

nwgat opened this issue · 11 comments

nwgat commented

it still tries to check even when the connection has no ipv6 and fails to update record for ipv4

2019/10/25 00:15:56 Discovered IPv4 address mypublicip
2019/10/25 00:15:56 Get https://ipv6bot.whatismyipaddress.com: dial tcp: lookup ipv6bot.whatismyipaddress.com: no such host

build it on windows from git
go version go1.13.3 windows/amd64

Can u post a redacted view of your config?

nwgat commented
{
  "apikey": "redacted",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
  "ipv6CheckUrl": "https://ipv6bot.whatismyipaddress.com",
  "allowIPv4InIPv6": false,
  "domains": [
    {
      "domain": "redacted.ninja",
      "records": [
        {
          "name": "redacted",
          "type": "A"
        }
      ]
  ]
}

I'm not able to reproduce it, can you put a log at may be line 148 and run it? The conditions seems to be fine in the code.

log.Printf("%t", *config.UseIPv6)
nwgat commented

image

C:\Users\Tommy\go\src\github.com\digitalocean-dynamic-dns-ip-master>digitalocean-dynamic-dns-ip-master.exe digitalocean-dynamic-ip.json
2019/10/25 16:25:24 Discovered IPv4 address `redacted`
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0x65624f]

goroutine 1 [running]:
main.CheckLocalIPs(0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
        C:/Users/Tommy/go/src/github.com/digitalocean-dynamic-dns-ip-master/digitalocean-dynamic-ip.go:148 +0x10f
main.main()
        C:/Users/Tommy/go/src/github.com/digitalocean-dynamic-dns-ip-master/digitalocean-dynamic-ip.go:339 +0x7a

Im not sure if the the config is being read properly. Could be a text encoding issue.

Let me try on a windows machine

@nwgat can you post the command line you are using? I agree with @anaganisk, it looks like your configuration file isn't being read and the defaults are being used. Another way to check would be to use invalid URLs in your configuration for the IP Check sites.

{
  "apikey": "redacted",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "ipv4CheckUrl": "https://iLoveTacos.com",
  "ipv6CheckUrl": "https://TacosAreTheBestFood.net",
  "allowIPv4InIPv6": false,
  "domains": [
    {
      "domain": "redacted.ninja",
      "records": [
        {
          "name": "redacted",
          "type": "A"
        }
      ]
    }
  ]
}

if your IPV4 address is still found, then your config isn't being read, which indicates it's not in the default place, or you passed a bad location on the command line

@nwgat also to note, your pasted configuration file is invalid JSON.

nwgat commented

this works, thanks for the help :)

{
  "apikey": "redacted",
  "doPageSize": 20,
  "useIPv4": true,
  "useIPv6": false,
  "ipv4CheckUrl": "https://ipv4bot.whatismyipaddress.com",
  "ipv6CheckUrl": "https://ipv6bot.whatismyipaddress.com",
  "allowIPv4InIPv6": false,
  "domains": [
    {
      "domain": "redacted.ninja",
      "records": [
        {
          "name": "redacted",
          "type": "A"
        }
      ]
    }
  ]
}

@nwgat was the provided example JSON incorrect, or was it just a typo on your end?

nwgat commented

@johnjaylward typo in the json, it might be a good idea to have a json example for ipv4 only, ipv6 only and combined so that people like me wont get it wrong

on a related note
just for fun i tried https://ifconfig.co/ip and that fails for some reason even when its just plain ip and they even have https://ifconfig.co/json for some more interesting uses

i wish there was pushover support in it so i can get a notification on my phone with the new ip, other than that this is a nice tool, keep up the good work guys! :)