modified: CloudFlare/cloudflare_ddns.ps1
Add 'https://api.ipify.org' 'https://ip2location.io/ip'
This commit is contained in:
parent
45edade6ad
commit
ea97d760a7
@ -33,6 +33,8 @@ if (-not (Test-Path $path_sites)) {
|
|||||||
'http://ifconfig.me/ip'
|
'http://ifconfig.me/ip'
|
||||||
'http://icanhazip.com'
|
'http://icanhazip.com'
|
||||||
'http://ident.me'
|
'http://ident.me'
|
||||||
|
'https://api.ipify.org'
|
||||||
|
'https://ip2location.io/ip'
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
[array]$ip_sites = Get-Content $path_sites
|
[array]$ip_sites = Get-Content $path_sites
|
||||||
@ -82,43 +84,65 @@ function get-ip {
|
|||||||
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
|
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
|
||||||
}
|
}
|
||||||
catch {
|
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
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'http://ifconfig.me/ip' {
|
'http://ifconfig.me/ip' {
|
||||||
$uri = $ip_sites[$i]
|
$uri = $ip_sites[$i]
|
||||||
try {
|
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()
|
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
|
||||||
}
|
}
|
||||||
catch {
|
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
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'http://icanhazip.com' {
|
'http://icanhazip.com' {
|
||||||
$uri = $ip_sites[$i]
|
$uri = $ip_sites[$i]
|
||||||
try {
|
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()
|
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
|
||||||
}
|
}
|
||||||
catch {
|
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
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
'http://ident.me' {
|
'http://ident.me' {
|
||||||
$uri = $ip_sites[$i]
|
$uri = $ip_sites[$i]
|
||||||
try {
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
'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()
|
$ip = (Invoke-RestMethod -Uri $uri -Method Get).Trim()
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
$global:logs += log -l_level 1 -l_message "IP: ERROR | URL: $($uri)"
|
$global:logs += log -l_level 1 -l_message "IP: ERROR | URL: $($uri)"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
'https://ip2location.io/ip' {
|
||||||
|
$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 {
|
||||||
|
$global:logs += log -l_level 1 -l_message "IP: ERROR | URL: $($uri)"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($null -ne $ip) {
|
if ($null -ne $ip) {
|
||||||
$global:logs += log -l_level 0 -l_message "IP: $($ip) | URL: $($uri)"
|
$global:logs += log -l_level 0 -l_message "IP: $($ip) | URL: $($uri)"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user