qdm12 / gluetun

VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
https://hub.docker.com/r/qmcgaw/gluetun
MIT License
6.71k stars 331 forks source link

Bug: ip2location PUBLICIP_API Decoding/Unmarshaling Error #2192

Closed milkers69 closed 3 months ago

milkers69 commented 3 months ago

Is this urgent?

None

Host OS

Unraid 6.12.6

CPU arch

x86_64

VPN service provider

TorGuard

What are you using to run the container

Unraid

What is the version of Gluetun

Running version v3.38.0 built on 2024-03-25T15:53:33.983Z (commit b3ceece)

What's the problem 🤔

When utilizing the ip2location PUBLICIP_API value I get an error about being unable to decode the .latitude value from the response. ip2info has my VPN server IP banned (I think, I tried a personal key with no luck) hence why I am using the non default option.

Curl output of api from container using gluten

root@21025a545bd4:/# curl https://api.ip2location.io/?key=*
{"ip":"123.456.789.01","country_code":"AB","country_name":"A Country Name","region_name":"A Region Name","city_name":"City","latitude":12.345678,"longitude":1.23456,"zip_code":"0123","time_zone":"+01:23","asn":"12345","as":"ASN","is_proxy":false}

I'm not familiar with Go or Gluetun's codebase but If I had to guess issue is it isn't casting from a "decimal" (or whatever go calls it) from API to a string properly in the struct https://github.com/qdm12/gluetun/blob/6b2f350ec960a8e07fd1a78fd180260645f1b25e/internal/publicip/api/ip2location.go#L69

Share your logs (at least 10 lines)

2024-03-28T14:08:30-05:00 ERROR [ip getter] decoding response: json: cannot unmarshal number into Go struct field .latitude of type string - retrying in 5s
2024-03-28T14:08:35-05:00 ERROR [ip getter] decoding response: json: cannot unmarshal number into Go struct field .latitude of type string - retrying in 10s
2024-03-28T14:08:46-05:00 ERROR [ip getter] decoding response: json: cannot unmarshal number into Go struct field .latitude of type string - retrying in 20s
2024-03-28T14:09:06-05:00 ERROR [ip getter] decoding response: json: cannot unmarshal number into Go struct field .latitude of type string - retrying in 40s
2024-03-28T14:09:46-05:00 ERROR [ip getter] decoding response: json: cannot unmarshal number into Go struct field .latitude of type string - retrying in 1m20s

Share your configuration

docker run
  -d
  --name='GluetunVPN'
  --net='bridge'
  -e TZ="/"
  -e HOST_OS="Unraid"
  -e HOST_HOSTNAME=""
  -e HOST_CONTAINERNAME="GluetunVPN"
  -e 'VPN_SERVICE_PROVIDER'='custom'
  -e 'VPN_TYPE'='wireguard'
  -e 'WIREGUARD_PRIVATE_KEY'=''
  -e 'WIREGUARD_ADDRESSES'=''
  -e 'FIREWALL_VPN_INPUT_PORTS'=''
  -e 'FIREWALL_OUTBOUND_SUBNETS'='192.168.0.0/24'
  -e 'VPN_ENDPOINT_IP'=''
  -e 'VPN_ENDPOINT_PORT'='1443'
  -e 'WIREGUARD_PUBLIC_KEY'=''
  -e 'PUBLICIP_API'='ip2location'
  -e 'PUBLICIP_API_TOKEN'=''
  -e 'HEALTH_SERVER_ADDRESS'='127.0.0.1:9999'
  -e 'HEALTH_ADDRESS_TO_PING'='github.com'
  -e 'HEALTH_VPN_DURATION_INITIAL'='6s'
  -e 'HEALTH_VPN_DURATION_ADDITION'='5s'
  -e 'UPDATER_PERIOD'='0'
  -e 'PUBLICIP_FILE'='/gluetun/ip'
  -e 'PUBLICIP_PERIOD'='12h'
  -e 'VERSION_INFORMATION'='on'
  -e 'HTTP_CONTROL_SERVER_LOG'='on'
  -e 'PUID'='1000'
  -e 'PGID'='1000'
  -l net.unraid.docker.managed=dockerman
  -l net.unraid.docker.webui='http://[IP]:[PORT:8000]'
  -l net.unraid.docker.icon='https://raw.githubusercontent.com/qdm12/gluetun/master/doc/logo_256.png'
  -p '8080:8080/tcp'
  -p '8081:8081/tcp'
  -p '8000:8000/tcp'
  -v '/mnt/user/appdata/gluetun':'/gluetun':'rw'
  --cap-add=NET_ADMIN
  --restart always 'qmcgaw/gluetun:v3'
github-actions[bot] commented 3 months ago

@qdm12 is more or less the only maintainer of this project and works on it in his free time. Please:

qdm12 commented 3 months ago

My bad, this should fix it: 8454123caeb0c19c288f66e8c02b1904582425c0 On the latest image. I'll close this assuming it's fixed, if not create a (drafty quickly written) issue referencing this one, thanks!

github-actions[bot] commented 3 months ago

Closed issues are NOT monitored, so commenting here is likely to be not seen. If you think this is still unresolved and have more information to bring, please create another issue.

This is an automated comment setup because @qdm12 is the sole maintainer of this project which became too popular to monitor issues closed.