modified: CloudFlare/cloudflare_ddns.ps1

Add
            'https://api.ipify.org'
            'https://ip2location.io/ip'
This commit is contained in:
Tomasz Kostrzewa 2023-12-24 23:54:21 +01:00
parent 45edade6ad
commit ea97d760a7

View File

@ -33,6 +33,8 @@ if (-not (Test-Path $path_sites)) {
'http://ifconfig.me/ip'
'http://icanhazip.com'
'http://ident.me'
'https://api.ipify.org'
'https://ip2location.io/ip'
)
} else {
[array]$ip_sites = Get-Content $path_sites
@ -82,25 +84,47 @@ function get-ip {
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {
$global:logs += log -l_level 1 -l_message "IP: ERROR | URL: $($uri)"
$global:logs += log -l_level 1 -l_message "IP: $($Error[0].Exception) | URL: $($uri)"
continue
}
}
'http://ifconfig.me/ip' {
$uri = $ip_sites[$i]
try {
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 2
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 1
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {
$global:logs += log -l_level 1 -l_message "IP: ERROR | URL: $($uri)"
$global:logs += log -l_level 1 -l_message "IP: $($Error[0].Exception) | URL: $($uri)"
continue
}
}
'http://icanhazip.com' {
$uri = $ip_sites[$i]
try {
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 2
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 1
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {
$global:logs += log -l_level 1 -l_message "IP: $($Error[0].Exception) | URL: $($uri)"
continue
}
}
'http://ident.me' {
$uri = $ip_sites[$i]
try {
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 1
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {
$global:logs += log -l_level 1 -l_message "IP: $($Error[0].Exception) | URL: $($uri)"
continue
}
}
'https://api.ipify.org' {
$uri = $ip_sites[$i]
try {
$test = Test-Connection -TargetName $uri.Replace("https://","").Split("/")[0] -Count 1
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {
@ -108,10 +132,10 @@ function get-ip {
continue
}
}
'http://ident.me' {
'https://ip2location.io/ip' {
$uri = $ip_sites[$i]
try {
$test = Test-Connection -TargetName $uri.Replace("http://","").Split("/")[0] -Count 2
$test = Test-Connection -TargetName $uri.Replace("https://","").Split("/")[0] -Count 1
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
}
catch {