From 426810c029cd9a48510b32abd0411efe05278d13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Tue, 1 Aug 2023 12:06:42 -0300 Subject: [PATCH] core: services: beacon: Improve documentation --- core/services/beacon/settings.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/services/beacon/settings.py b/core/services/beacon/settings.py index df924769a5..45b4b125c1 100644 --- a/core/services/beacon/settings.py +++ b/core/services/beacon/settings.py @@ -41,7 +41,11 @@ def get_phys(self) -> List[psutil._common.snicaddr]: def get_ip_strs(self) -> List[str]: """ - get ip as a string. this also translates 'ips[n]' to the n-th ip in that interface + gets a list of the interface IPs (IPv4 only) as a list of strings: + - if self.ip is "ips[*]", it returns all ips of that interface + - if self.ip is "ips[n]", it returns the n-th ip of that interface + - if self.ip is a single ipv4 (like "192.168.2.2"), it returns that ip as a string + - if self.ip is (mistakenly) an IPv6, it raises an InvalidIpAddress error """ address = str(self.ip) # Check for 'ips[n]' @@ -71,7 +75,7 @@ def get_ip_strs(self) -> List[str]: def get_ips(self) -> List[bytes]: """ - returns the ip as 4 bytes + returns a list of the interface IPs (IPv4 only) as a list of 4 bytes """ return [socket.inet_aton(ip) for ip in self.get_ip_strs()]