Verified Commit 433cefa1 authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Generation reverse IPv6 DNS zone with hex characters

parent 61f8f933
Pipeline #33589 passed with stages
in 24 minutes and 25 seconds
# ----------------------------------------------------------------------
# RR helper class
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# python modules
import string
# NOC modules
from .encoding import to_idna
......@@ -96,4 +99,9 @@ class RR(object):
try:
return int(v)
except ValueError:
return v
return int(v, base=16) if RR.is_hex(v) else v
@staticmethod
def is_hex(s):
hex_digits = set(string.hexdigits)
return all(c in hex_digits for c in s)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment