mirror of https://gitlab.com/bashrc2/epicyon
Parsing yggdrasil addresses
parent
8b762a2733
commit
7d40d5aac4
4
tests.py
4
tests.py
|
|
@ -9661,6 +9661,10 @@ def _test_yggdrasil_addresses() -> None:
|
||||||
text = 'http://[203:abcd:abcd:abcd:abcd:abcd:abcd]/something'
|
text = 'http://[203:abcd:abcd:abcd:abcd:abcd:abcd]/something'
|
||||||
assert not is_yggdrasil_url(text)
|
assert not is_yggdrasil_url(text)
|
||||||
assert get_port_from_domain(text) is None
|
assert get_port_from_domain(text) is None
|
||||||
|
text = 'http://[302:abcd:abcd:abcd::abc]'
|
||||||
|
assert is_yggdrasil_url(text)
|
||||||
|
text = 'http://[302:abcd:abcd:abcd:abc]'
|
||||||
|
assert not is_yggdrasil_url(text)
|
||||||
|
|
||||||
|
|
||||||
def run_all_tests():
|
def run_all_tests():
|
||||||
|
|
|
||||||
8
utils.py
8
utils.py
|
|
@ -3374,8 +3374,12 @@ def is_yggdrasil_address(domain: str) -> bool:
|
||||||
domain = domain.split(']:')[0] + ']'
|
domain = domain.split(']:')[0] + ']'
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
if domain.count(':') != 7:
|
if domain.startswith('[2'):
|
||||||
return False
|
if domain.count(':') != 7:
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
if domain.count(':') != 5:
|
||||||
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue