mirror of
https://github.com/qdm12/ddns-updater.git
synced 2026-04-05 08:54:09 -04:00
Added DDNSS ip methods (#41)
This commit is contained in:
@@ -128,6 +128,9 @@ For all record update configuration, you need the following:
|
||||
- `"ipinfo"` using [https://ipinfo.io/ip](https://ipinfo.io/ip) (may be rate limited)
|
||||
- `"ipify"` using [https://api.ipify.org](https://api.ipify.org) (may be rate limited)
|
||||
- `"ipify6"` using [https://api6.ipify.org](https://api.ipify.org) for IPv6 only (may be rate limited)
|
||||
- `"ddnss"` using [https://ddnss.de/meineip.php](https://ddnss.de/meineip.php)
|
||||
- `"ddnss4"` using [https://ip4.ddnss.de/meineip.php](https://ip4.ddnss.de/meineip.php) for IPv4 only
|
||||
- `"ddnss6"` using [https://ip6.ddnss.de/meineip.php](https://ip6.ddnss.de/meineip.php) for IPv6 only
|
||||
- `"cycle"` to cycle between each external methods, in order to avoid being rate limited
|
||||
- You can also specify an HTTPS URL to obtain your public IP address (i.e. `"ip_method": "https://ipinfo.io/ip"`)
|
||||
|
||||
|
||||
@@ -26,7 +26,10 @@ const (
|
||||
HTML_OPENDNS models.HTML = "<a href=\"https://diagnostic.opendns.com/myip\">OpenDNS</a>"
|
||||
HTML_IFCONFIG models.HTML = "<a href=\"https://ifconfig.io\">ifconfig.io</a>"
|
||||
HTML_IPINFO models.HTML = "<a href=\"https://ipinfo.io\">ipinfo.io</a>"
|
||||
HTML_IPIFY models.HTML = "<a href=\"https://api.ipify.org\">ipify.org</a>"
|
||||
HTML_IPIFY6 models.HTML = "<a href=\"https://api6.ipify.org\">ipify.org</a>"
|
||||
HTML_IPIFY models.HTML = "<a href=\"https://api.ipify.org\">api.ipify.org</a>"
|
||||
HTML_IPIFY6 models.HTML = "<a href=\"https://api6.ipify.org\">api6.ipify.org</a>"
|
||||
HTML_DDNSS models.HTML = "<a href=\"https://ddnss.de/meineip.php\">ddns.de</a>"
|
||||
HTML_DDNSS4 models.HTML = "<a href=\"https://ip4.ddnss.de/meineip.php\">ip4.ddns.de</a>"
|
||||
HTML_DDNSS6 models.HTML = "<a href=\"https://ip6.ddnss.de/meineip.php\">ip6.ddns.de</a>"
|
||||
HTML_CYCLE models.HTML = "Cycling"
|
||||
)
|
||||
|
||||
@@ -12,6 +12,9 @@ const (
|
||||
IPIFY models.IPMethod = "ipify"
|
||||
IPIFY6 models.IPMethod = "ipify6"
|
||||
CYCLE models.IPMethod = "cycle"
|
||||
DDNSS models.IPMethod = "ddnss"
|
||||
DDNSS4 models.IPMethod = "ddnss4"
|
||||
DDNSS6 models.IPMethod = "ddnss6"
|
||||
// Retro compatibility only
|
||||
GOOGLE models.IPMethod = "google"
|
||||
)
|
||||
@@ -25,6 +28,9 @@ func IPMethodMapping() map[models.IPMethod]string {
|
||||
IPINFO: "https://ipinfo.io/ip",
|
||||
IPIFY: "https://api.ipify.org",
|
||||
IPIFY6: "https://api6.ipify.org",
|
||||
DDNSS: "https://ip4.ddnss.de/meineip.php",
|
||||
DDNSS4: "https://ip4.ddnss.de/meineip.php",
|
||||
DDNSS6: "https://ip6.ddnss.de/meineip.php",
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@ import (
|
||||
func Test_IPMethodChoices(t *testing.T) {
|
||||
t.Parallel()
|
||||
choices := IPMethodChoices()
|
||||
assert.ElementsMatch(t, []models.IPMethod{"ipinfo", "ipify", "ipify6", "provider", "cycle", "opendns", "ifconfig"}, choices)
|
||||
assert.ElementsMatch(t, []models.IPMethod{"ipinfo", "ipify", "ipify6", "provider", "cycle", "opendns", "ifconfig", "ddnss", "ddnss4", "ddnss6"}, choices)
|
||||
}
|
||||
|
||||
func Test_IPMethodExternalChoices(t *testing.T) {
|
||||
t.Parallel()
|
||||
choices := IPMethodExternalChoices()
|
||||
assert.ElementsMatch(t, []models.IPMethod{"ipinfo", "ipify", "ipify6", "ifconfig", "opendns"}, choices)
|
||||
assert.ElementsMatch(t, []models.IPMethod{"ipinfo", "ipify", "ipify6", "ifconfig", "opendns", "ddnss", "ddnss4", "ddnss6"}, choices)
|
||||
}
|
||||
|
||||
@@ -113,6 +113,12 @@ func convertIPMethod(IPMethod models.IPMethod, provider models.Provider) models.
|
||||
return constants.HTML_IPIFY
|
||||
case constants.IPIFY6:
|
||||
return constants.HTML_IPIFY6
|
||||
case constants.DDNSS:
|
||||
return constants.HTML_DDNSS
|
||||
case constants.DDNSS4:
|
||||
return constants.HTML_DDNSS4
|
||||
case constants.DDNSS6:
|
||||
return constants.HTML_DDNSS6
|
||||
case constants.CYCLE:
|
||||
return constants.HTML_CYCLE
|
||||
default:
|
||||
|
||||
@@ -25,12 +25,12 @@ func (p *params) isConsistent(settings models.Settings) error {
|
||||
switch settings.IPVersion {
|
||||
case constants.IPv4:
|
||||
switch settings.IPMethod {
|
||||
case constants.IPIFY6:
|
||||
case constants.IPIFY6, constants.DDNSS6:
|
||||
return fmt.Errorf("IP method %s is only for IPv6 addresses", settings.IPMethod)
|
||||
}
|
||||
case constants.IPv6:
|
||||
switch settings.IPMethod {
|
||||
case constants.IPIFY:
|
||||
case constants.IPIFY, constants.DDNSS4:
|
||||
return fmt.Errorf("IP method %s is only for IPv4 addresses", settings.IPMethod)
|
||||
}
|
||||
switch settings.Provider {
|
||||
|
||||
Reference in New Issue
Block a user