Skip to content

Commit

Permalink
Update ipv4_check_script.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Suysker authored Nov 10, 2023
1 parent c1625ba commit 21904b6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Gcore/ipv4_check_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@

def is_ip_reachable(ip):
try:
#result = subprocess.run(["curl", "/dev/null", "-I", f"https://{ip}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=2)
result = subprocess.run(["curl", "/dev/null", "-I", "https://gcore.com",f"--resolve gcore.com:443:{ip}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=2)
return result.returncode == 200
result = subprocess.run(["curl", "-o", "/dev/null", "-s", "-w", "%{http_code}", "https://gcore.com","--resolve", f"gcore.com:443:{ip}"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=2)
return result.stdout.decode().strip() == "200"
except subprocess.TimeoutExpired:
return False

Expand Down

0 comments on commit 21904b6

Please sign in to comment.