Closed ccaviness closed 2 years ago
Thanks for this @ccaviness !
Can you elaborate what this means?
For backwards compatibility, copy the first item in netmasks and broadcasts to netmask and broadcast respectively.
@benjaoming Sure. The current code returns a dict
containing netmask
and broadcast
, as a single str
. My change adds netmasks
and broadcasts
as list
s of str
s. To make sure existing code that relies on the singular netmask
and broadcast
keys being str
, I copy the first item in netmasks
and broadcasts
to netmask
and broadcast
respectively. This is similar to what was done in #27 when support for multiple IPv4 addresses was added.
Thanks for explaining, I get it now :) Tests are working and since it has backwards compatibility I woulds say :+1:
Not sure if having a list of these properties in separate lists create the right kind of association with the IPv4/6 addresses that they associate to -- I guess that could change. But I also guess this library could do with a major rewrite :)
@ftao any comments? Am happy to merge and release.
Not sure if having a list of these properties in separate lists create the right kind of association with the IPv4/6 addresses that they associate to -- I guess that could change. But I also guess this library could do with a major rewrite :)
Yeah, a better/more formal structure for the interface data would be a great idea, but would probably be best as a backwards-compatibility-breaking re-write as you suggest.
@ftao any comments? Am happy to merge and release. I woulds say 👍 too ~~
Hi @ccaviness - the changes are now released in 0.23 :)
Excellent, thanks!
This adds
netmasks
,broadcasts
, andprefixlens
attributes as lists. For backwards compatibility, copy the first item innetmasks
andbroadcasts
tonetmask
andbroadcast
respectively.Also:
tools_test.py
, which fails when run on macOS. (I believe this is likely due to the ancient version ofbash
that/bin/sh
is.)hex2dotted
to usestruct
/socket
to convert from hex to dotted quad