FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-74713: Update ipaddress.py with reverse_pointer method for networks by OtherSystems · Pull Request #25371 · python/cpython · GitHub

Repository navigation

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
13 changes: 13 additions & 0 deletions Lib/ipaddress.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1525,6 +1525,14 @@ def is_global(self):
self.broadcast_address in IPv4Network('100.64.0.0/10')) and
not self.is_private)

def _reverse_pointer(self):
"""Return the reverse DNS pointer name for the IPv4 network.

This implements the method described in RFC1035 3.5.

"""
return self.network_address.reverse_pointer.split(".", int((self.max_prefixlen - self.prefixlen) / 8))[-1]


class _IPv4Constants:
_linklocal_network = IPv4Network('169.254.0.0/16')
Expand Down Expand Up @@ -2243,6 +2251,11 @@ def is_site_local(self):
return (self.network_address.is_site_local and
self.broadcast_address.is_site_local)

def _reverse_pointer(self):
"""Return the reverse DNS pointer name for the IPv6 address.

"""
return self.network_address.reverse_pointer.split(".", int((self.max_prefixlen - self.prefixlen) / 4))[-1]

class _IPv6Constants:

Expand Down

Back | FazBrowse Home | New Git URL