File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -1970,12 +1970,21 @@ def __init__(self, address):
19701970 def _explode_shorthand_ip_string (self ):
19711971 ipv4_mapped = self .ipv4_mapped
19721972 if ipv4_mapped is None :
1973- long_form = super ()._explode_shorthand_ip_string ()
1974- else :
1975- prefix_len = 30
1976- raw_exploded_str = super ()._explode_shorthand_ip_string ()
1977- long_form = "%s%s" % (raw_exploded_str [:prefix_len ], str (ipv4_mapped ))
1978- return long_form
1973+ return super ()._explode_shorthand_ip_string ()
1974+ prefix_len = 30
1975+ raw_exploded_str = super ()._explode_shorthand_ip_string ()
1976+ return f"{ raw_exploded_str [:prefix_len ]} { ipv4_mapped !s} "
1977+
1978+ def _reverse_pointer (self ):
1979+ ipv4_mapped = self .ipv4_mapped
1980+ if ipv4_mapped is None :
1981+ return super ()._reverse_pointer ()
1982+ prefix_len = 30
1983+ raw_exploded_str = super ()._explode_shorthand_ip_string ()[:prefix_len ]
1984+ # ipv4 encoded using hexadecimal nibbles instead of decimals
1985+ ipv4_int = ipv4_mapped ._ip
1986+ reverse_chars = f"{ raw_exploded_str } { ipv4_int :008x} " [::- 1 ].replace (':' , '' )
1987+ return '.' .join (reverse_chars ) + '.ip6.arpa'
19791988
19801989 def _ipv4_mapped_ipv6_to_str (self ):
19811990 """Return convenient text representation of IPv4-mapped IPv6 address
You can’t perform that action at this time.
0 commit comments