:right-sidebar: True InetAddressMask =================================================================== .. currentmodule:: gi.repository.Gio .. versionadded:: 2.32 .. class:: InetAddressMask(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Implemented Interfaces: :class:`~gi.repository.Gio.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 ------------ .. rst-class:: interim-class .. class:: InetAddressMask :no-index: .. classmethod:: new(addr: ~gi.repository.Gio.InetAddress, length: int) -> ~gi.repository.Gio.InetAddressMask Creates a new :obj:`~gi.repository.Gio.InetAddressMask` representing all addresses whose first ``length`` bits match ``addr``\. .. versionadded:: 2.32 :param addr: a :obj:`~gi.repository.Gio.InetAddress` :param length: number of bits of ``addr`` to use .. classmethod:: new_from_string(mask_string: str) -> ~gi.repository.Gio.InetAddressMask Parses ``mask_string`` as an IP address and (optional) length, and creates a new :obj:`~gi.repository.Gio.InetAddressMask`\. 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. .. versionadded:: 2.32 :param mask_string: an IP address or address/length string Methods ------- .. rst-class:: interim-class .. class:: InetAddressMask :no-index: .. method:: equal(mask2: ~gi.repository.Gio.InetAddressMask) -> bool Tests if ``mask`` and ``mask2`` are the same mask. .. versionadded:: 2.32 :param mask2: another :obj:`~gi.repository.Gio.InetAddressMask` .. method:: get_address() -> ~gi.repository.Gio.InetAddress Gets ``mask``\'s base address .. versionadded:: 2.32 .. method:: get_family() -> ~gi.repository.Gio.SocketFamily Gets the :obj:`~gi.repository.Gio.SocketFamily` of ``mask``\'s address .. versionadded:: 2.32 .. method:: get_length() -> int Gets ``mask``\'s length .. versionadded:: 2.32 .. method:: matches(address: ~gi.repository.Gio.InetAddress) -> bool Tests if ``address`` falls within the range described by ``mask``\. .. versionadded:: 2.32 :param address: a :obj:`~gi.repository.Gio.InetAddress` .. method:: to_string() -> str Converts ``mask`` back to its corresponding string form. .. versionadded:: 2.32 Properties ---------- .. rst-class:: interim-class .. class:: InetAddressMask :no-index: .. attribute:: props.address :type: ~gi.repository.Gio.InetAddress The type of the None singleton. .. versionadded:: 2.32 .. attribute:: props.family :type: ~gi.repository.Gio.SocketFamily The type of the None singleton. .. versionadded:: 2.32 .. attribute:: props.length :type: int The type of the None singleton. .. versionadded:: 2.32 Fields ------ .. rst-class:: interim-class .. class:: InetAddressMask :no-index: .. attribute:: parent_instance .. attribute:: priv