Skip to content

Commit

Permalink
࿓❯ do: Removed try: except: block catching an error checked for prior…
Browse files Browse the repository at this point in the history
… in the code

Signed-off-by: Victor-ray, S <owl@zendai.net.eu.org>
  • Loading branch information
victor-rays committed Mar 5, 2024
1 parent b03ca66 commit 992241a
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions server.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
# § Victor-ray, S.
# § Victor-ray, S. owl@zendai.net.eu.org

from sanic import Sanic
from sanic.response import json
Expand Down Expand Up @@ -126,14 +126,11 @@ async def validate_ip(incoming_ip):
return validation

async def get_ip_version(incoming_ip):
try:
ip = ipaddress.ip_address(incoming_ip)
if isinstance(ip, ipaddress.IPv4Address):
ip = ipaddress.ip_address(incoming_ip)
if isinstance(ip, ipaddress.IPv4Address):
protocol = 4
elif isinstance(ip, ipaddress.IPv6Address):
elif isinstance(ip, ipaddress.IPv6Address):
protocol = 6
except:
protocol = "error"
return protocol

async def check_ip_v4(IPv4, portIPv4):
Expand Down

0 comments on commit 992241a

Please sign in to comment.