detect and ignore teredo/6to4 (#57)

This commit is contained in:
Nikolay Shopik 2017-05-11 16:29:32 +03:00 committed by ValdikSS
parent 2bdf2492f0
commit d12a787aca

View File

@ -105,6 +105,7 @@ isup_fmt = 'http://isup.me/{}'
disable_isup = False #If true, presume that all sites are available
disable_report = False
disable_ipv6 = False
force_ipv6 = False
force_dpi_check = False
# End configuration
@ -790,8 +791,14 @@ def check_ipv6_availability():
if (v6addr):
v6 = _get_url("http://ipv6.icanhazip.com/", ip=v6addr[0])
if len(v6[1]):
print(": IPv6 доступен!")
return v6[1].strip()
v6src = v6[1].strip()
if force_ipv6 or (not ipaddress.IPv6Address(v6src).teredo
and not ipaddress.IPv6Address(v6src).sixtofour):
print(": IPv6 доступен!")
return v6src
else:
print (": обнаружен туннель Teredo или 6to4, игнорируем.")
return False
print(": IPv6 недоступен.")
return False
@ -977,6 +984,7 @@ if __name__ == "__main__":
.format(isup_server))
parser.add_argument('--force-dpi-check', action='store_true', help='Выполнить проверку DPI, даже если провайдер не блокирует сайты.')
parser.add_argument('--disable-ipv6', action='store_true', help='Отключить поддержку IPv6.')
parser.add_argument('--force-ipv6', action='store_true', help='Игнорировать обнаружение туннелей.')
parser.add_argument('--debug', action='store_true', help='Включить режим отладки (и --no-report).')
args = parser.parse_args()
@ -994,6 +1002,9 @@ if __name__ == "__main__":
if args.disable_ipv6:
disable_ipv6 = True
if args.force_ipv6:
force_ipv6 = True
if args.debug:
debug = True