From 992241ae0800827e6d3e717341bc9d55fcea3b0e Mon Sep 17 00:00:00 2001 From: "Victor-ray, S" Date: Tue, 5 Mar 2024 22:04:15 +0100 Subject: [PATCH] =?UTF-8?q?=E0=BF=93=E2=9D=AF=20do:=20Removed=20try:=20exc?= =?UTF-8?q?ept:=20block=20catching=20an=20error=20checked=20for=20prior=20?= =?UTF-8?q?in=20the=20code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Victor-ray, S --- server.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/server.py b/server.py index cc6bd27..c72469c 100755 --- a/server.py +++ b/server.py @@ -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 @@ -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):