| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Adds the `IPv4Address.ipv6_mapped` property.
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#29345)
Represent IPv4-mapped IPv6 address as x:x:x:x:x:x:d.d.d.d,
where the 'x's are the hexadecimal values
of the six high-order 16-bit pieces of the address,
and the 'd's are the decimal values
of the four low-order 8-bit pieces of the address
(standard IPv4 representation).
---------
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
|
| |
|
|
|
| |
Fixes private checks for network objects. The previous method would incorrectly return True for a private check in cases such as "0.0.0.0/0".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ipaddress.ip_{address,network,interface} helper functions (#30642)
`IPv*Network` and `IPv*Interface` constructors accept a 2-tuple of
(address description, netmask) as the address parameter.
When the tuple-based address is used errors are not propagated
correctly through the `ipaddress.ip_*` helper because of the %-formatting now expecting several arguments:
In [7]: ipaddress.ip_network(("192.168.100.0", "fooo"))
...
TypeError: not all arguments converted during string formatting
Compared to:
In [8]: ipaddress.IPv4Network(("192.168.100.0", "foo"))
...
NetmaskValueError: 'foo' is not a valid netmask
Use an f-string to make sure the error is always properly formatted.
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
| |
|
|
|
|
|
| |
For IPv4 mapped IPv6 addresses, defer privacy check to the mapped IPv4 address. Solves bug where public mapped IPv4 addresses are considered private by the IPv6 check.
Automerge-Triggered-By: GH:gpshead
|
|
|
|
|
|
|
|
|
| |
Reverts commit e653d4d8e820a7a004ad399530af0135b45db27a and makes
parsing even more strict. Like socket.inet_pton() any leading zero
is now treated as invalid input.
Signed-off-by: Christian Heimes <christian@python.org>
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
|
|
|
| |
Automerge-Triggered-By: @tiran
|
| |
|
|
|
|
|
|
|
|
| |
(GH-21033)
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
|
|
|
| |
These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
|
| |
|
|
|
|
|
|
| |
networks (GH-18757)
The `.hosts()` method now returns the single address present in a /32 or /128 network.
|
|
|
|
| |
deprecation warning (GH-13195)
|
|
|
| |
Automerge-Triggered-By: @asvetlov
|
|
|
|
| |
Also cache the compiled RE for parsing the format specifier.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bits method and test_bits
* Cleaned up assert string
* blurb
* added docstring
* Faster method, per Eric Smith
* redoing as __format__
* added ipv6 method
* test cases and cleanup
* updated news
* cleanup and NEWS.d
* cleaned up old NEWS
* removed cut and paste leftover
* one more cleanup
* moved to regexp, moved away from v4- and v6-specific versions of __format__
* More cleanup, added ipv6 test cases
* more cleanup
* more cleanup
* cleanup
* cleanup
* cleanup per review, part 1
* addressed review comments around help string and regexp matching
* wrapped v6 test strings. contiguous integers: break at 72char. with underscores: break so that it looks clean.
* 's' and '' tests for pv4 and ipv6
* whitespace cleanup
* Remove trailing whitespace
* Remove more trailing whitespace
* Remove an excess blank line
|
|
|
|
| |
(GH-13298)
|
|
|
| |
make a compare in bit-operation manner.
|
|
|
|
|
|
|
| |
IPv4Interface and IPv6Interface did not has netmask and hostmask
attributes when its argument is bytes or int.
This commit extracts method for constructors of Network and Interface,
and ensure Interface class always provides them.
|
|
|
|
| |
* cached_property is more efficient than hand crafted cache.
* In IPv[46]Network, `self.network.prefixlen` is same to `self._prefixlen`.
|
| |
|
|
|
|
|
|
|
|
|
| |
Stop rejecting IPv4 octets with leading zeroes as ambiguously octal.
Plenty of other tools generate decimal IPv4 octets with leading zeroes,
so keeping this check hurts interoperability.
Patch by Joel Croteau.
|
|
|
|
|
|
| |
The result of host() was not empty when the network is constructed by a tuple containing an
integer mask and only 1 bit left for addresses.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
the original logic was just comparing the network address
but this is wrong because if the network address is equal then
we need to compare the ip address for breaking the tie
add more ip_interface comparison tests
|
|
|
|
| |
Patch by Gareth Rees.
|
|
|
|
|
|
| |
It was documented since 07a5610bae9d.
Initial patch by Roger Luethi.
|
|
|
|
|
| |
when resulting prefix length is equal to maximal prefix length.
Based on patch by Xiang Zhang.
|
|
|
|
| |
with specified exception type. Original patch by Ramchandra Apte.
|
| |
|
|\ |
|
| | |
|
| |
| |
| |
| | |
duplicated addresses and simplify the code.
|
| |
| |
| |
| | |
portable representation.
|
| |
| |
| |
| | |
when there are many non-consecutive addresses.
|
| |
| |
| |
| | |
generators.
|
| | |
|
|\ \
| |/
| |
| | |
Patch by Févry Thibault.
|
| |
| |
| |
| | |
Patch by Févry Thibault.
|
| |
| |
| |
| | |
Charles-François)
|
| |
| |
| |
| | |
IPv6Address) such as .is_private or .is_multicast.
|
| | |
|
| |
| |
| |
| | |
ipaddress.{IPv4Network,IPv6Network}.subnets().
|
| |
| |
| |
| | |
ipaddress.IPv6Network.
|
| |
| |
| |
| | |
(address, netmask) tuple argument, so as to easily construct network objects from existing addresses.
|
|/ |
|