InetAddressMask#
Added in version 2.32.
Superclasses: Object
Implemented Interfaces: Initable
GInetAddressMask
represents a range of IPv4 or IPv6 addresses
described by a base address and a length indicating how many bits
of the base address are relevant for matching purposes. These are
often given in string form. For example, 10.0.0.0/8
, or fe80::/10
.
Constructors#
- class InetAddressMask
- classmethod new(addr: InetAddress, length: int) InetAddressMask #
Creates a new
InetAddressMask
representing all addresses whose firstlength
bits matchaddr
.Added in version 2.32.
- Parameters:
addr – a
InetAddress
length – number of bits of
addr
to use
- classmethod new_from_string(mask_string: str) InetAddressMask #
Parses
mask_string
as an IP address and (optional) length, and creates a newInetAddressMask
. The length, if present, is delimited by a “/”. If it is not present, then the length is assumed to be the full length of the address.Added in version 2.32.
- Parameters:
mask_string – an IP address or address/length string
Methods#
- class InetAddressMask
- equal(mask2: InetAddressMask) bool #
Tests if
mask
andmask2
are the same mask.Added in version 2.32.
- Parameters:
mask2 – another
InetAddressMask
- get_address() InetAddress #
Gets
mask
’s base addressAdded in version 2.32.
- get_family() SocketFamily #
Gets the
SocketFamily
ofmask
’s addressAdded in version 2.32.
- matches(address: InetAddress) bool #
Tests if
address
falls within the range described bymask
.Added in version 2.32.
- Parameters:
address – a
InetAddress
Properties#
- class InetAddressMask
- props.address: InetAddress#
The type of the None singleton.
Added in version 2.32.
- props.family: SocketFamily#
The type of the None singleton.
Added in version 2.32.