Skip to content

Commit cec3bcf

Browse files
fix IPv6 multicast
1 parent 1739204 commit cec3bcf

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

.ruff.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ ignore = [
3030
# https://docs.astral.sh/ruff/rules/#flake8-bandit-s
3131
"S311", # Standard pseudo-random generators are not suitable for cryptographic purposes
3232

33-
# https://docs.astral.sh/ruff/rules/#pyupgrade-up
34-
"UP038", # Use X | Y in {} call instead of (X, Y)
35-
3633
# https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
3734
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed in {name}
3835

src/pyartnet/impl_sacn/node.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,13 @@ def _get_universe_ip_port(self, universe: int) -> tuple[str, int] | str:
150150

151151
u = self._validate_universe_nr(universe)
152152

153-
universe_high = u // 255
154-
universe_low = u % 255
155-
156153
# IPv6 multicast address
157154
if ':' in self._ip:
158155
IPv6Address(self._ip) # validate IP
159-
return f'FF18::83:00:{universe_high:d}:{universe_low:d}'
156+
return f'FF18::8300:{u:04X}'
160157

161158
# IPv4 multicast address
162-
return f'239.255.{universe_high:d}.{universe_low:d}'
159+
return f'239.255.{u // 255:d}.{u % 255:d}'
163160

164161
@override
165162
def set_multicast_mode(self, enabled: bool) -> Self:

0 commit comments

Comments
 (0)