Making sure Tor is recognized in location checking

This commit is contained in:
SimplifiedPrivacy 2026-11-02 14:53:51 -05:00
parent 7390939291
commit a9f45b43aa

View file

@ -58,12 +58,14 @@ class Location(BaseModel):
def supports_protocol(self, enum_value: ProtocolChoice|str) -> bool: def supports_protocol(self, enum_value: ProtocolChoice|str) -> bool:
"""Check if a given location supports a given protocol""" """Check if a given location supports a given protocol"""
print(f"enum_value is {enum_value}")
if enum_value is None: if enum_value is None:
return False return False
# socks5 proxy name doesn't match 'proxy' # socks5 proxy name doesn't match 'proxy'
if enum_value == ProtocolChoice.SOCK5_PROXY: if enum_value in (ProtocolChoice.TOR, "tor", ProtocolChoice.SOCK5_PROXY):
return self.is_proxy_capable return self.is_proxy_capable
if isinstance(enum_value, ProtocolChoice): if isinstance(enum_value, ProtocolChoice):
@ -72,8 +74,11 @@ class Location(BaseModel):
string_version = enum_value string_version = enum_value
field_name = f'is_{string_version}_capable' field_name = f'is_{string_version}_capable'
return bool(getattr(self, field_name)) try:
return bool(getattr(self, field_name))
except Exception as e:
print(str(e))
return False
# to use: # to use:
# Lookup by location/city codes # Lookup by location/city codes