feat: add IPv6 endpoint

This commit is contained in:
Daniel Langbein 2023-06-24 14:43:41 +02:00
parent 0485c33ec1
commit 3ce2caede5
2 changed files with 21 additions and 4 deletions

View File

@ -5,7 +5,7 @@
_name=netcup-dns
pkgname="python-$_name-git"
pkgver=r16.4b5193e
pkgver=r18.0485c33
pkgrel=1
pkgdesc='update DNS records with your current external IP address using the netcup DNS API'
arch=(any)

View File

@ -104,7 +104,11 @@ def ipv4_endpoints() -> list[str]:
:return: List of services that return your external IPv4 address.
"""
# IPv4 only.
endpoints = ['https://checkipv4.dedyn.io', 'https://api.ipify.org', 'https://v4.ident.me/']
endpoints = [
'https://checkipv4.dedyn.io',
'https://api.ipify.org',
'https://v4.ident.me/',
]
# Not sure if they return IPv4 addresses only.
endpoints += ['https://ipinfo.io/ip', 'https://ifconfig.me/ip']
return endpoints
@ -115,11 +119,24 @@ def ipv6_endpoints() -> list[str]:
:return: List of services that return your external IPv6 address.
"""
# IPv6 only.
endpoints = ['https://checkipv6.dedyn.io', 'https://api6.ipify.org', 'https://v6.ident.me/']
endpoints = [
'https://checkipv6.dedyn.io',
'https://api6.ipify.org',
'https://v6.ident.me/',
'https://ipv6.icanhazip.com',
]
# Returns either IPv4 or IPv6.
endpoints += []
endpoints += ['https://ifconfig.co/ip']
# Not sure if they return IPv6.
endpoints += ['https://ipinfo.io/ip']
# https://ifconfig.co
# - if it detects `curl`, only the IP is returned
# - but on a normal request, a HTML website is given
# https://ifconfig.co/ip
# - returns only the ip
# - `curl -4/-6 https://ifconfig.co/ip` -> returns IPv4/IPv6
return endpoints