MCPcopy Create free account
hub / github.com/ceph/ceph / _ip_lookup

Function _ip_lookup

src/python-common/ceph/deployment/utils.py:82–88  ·  view source on GitHub ↗
(addr: str, port: Optional[int])

Source from the content-addressed store, hash-verified

80 return True, 'Name:Port' if port else 'Name'
81
82 def _ip_lookup(addr: str, port: Optional[int]) -> Tuple[bool, str]:
83 unwrapped = unwrap_ipv6(addr)
84 try:
85 ip_addr = ipaddress.ip_address(unwrapped)
86 except ValueError:
87 return False, 'Invalid IP v4 or v6 address format'
88 return True, f'IPv{ip_addr.version}:Port' if port else f'IPv{ip_addr.version}'
89
90 dots = addr.count('.')
91 colons = addr.count(':')

Callers 1

valid_addrFunction · 0.85

Calls 2

ip_addressMethod · 0.80
unwrap_ipv6Function · 0.70

Tested by

no test coverage detected