Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/pyroute2/__pycache__/wiset.cpython-39.pyc
Ðазад
a ]�h�L � @ sz d Z ddlZddlZddlmZ ddlmZ ddlmZ ddl m Z ddlmZ ddl mZ dd lmZmZmZmZmZ dd lmZ ddiZdd � ZG dd� dedg d���ZG dd� de�Zededdfdd��Zed.dd��Zed/dd��Zed0dd��Zed1dd��Z ed2dd��Z!ed3d d!��Z"ed4d"d#��Z#ed5d$d%��Z$ed6d&d'��Z%ed7d(d)��Z&ed8d*d+��Z'd,d-� Z(dS )9a� High level ipset support. When :doc:`ipset` is providing a direct netlink socket with low level functions, a :class:`WiSet` object is built to map ipset objects from kernel. It helps to add/remove entries, list content, etc. For example, adding an entry with :class:`pyroute2.ipset.IPSet` object implies to set a various number of parameters: .. doctest:: :skipif: True >>> ipset = IPSet() >>> ipset.add("foo", "1.2.3.4/24", etype="net") >>> ipset.close() When they are discovered by a :class:`WiSet`: .. doctest:: :skipif: True >>> wiset = load_ipset("foo") >>> wiset.add("1.2.3.4/24") Listing entries is also easier using :class:`WiSet`, since it parses for you netlink messages: .. doctest:: :skipif: True >>> wiset.content {'1.2.3.0/24': IPStats(packets=None, bytes=None, comment=None, timeout=None, skbmark=None, physdev=False)} � N)� namedtuple)�getcallargs)�AF_INET)� basestring��IPSet)� IPSetError)�IPSET_FLAG_IFACE_WILDCARD�IPSET_FLAG_PHYSDEV�IPSET_FLAG_WITH_COMMENT�IPSET_FLAG_WITH_COUNTERS�IPSET_FLAG_WITH_SKBINFO)�IP_PROTOCOLS�countc s � fdd�}|S )a� Decorator to create netlink socket if needed. In many of our helpers, we need to open a netlink socket. This can be expensive for someone using many times the functions: instead to have only one socket and use several requests, we will open it again and again. This helper allow our functions to be flexible: the caller can pass an optional socket, or do nothing. In this last case, this decorator will open a socket for the caller (and close it after call) It also help to mix helpers. One helper can call another one: the socket will be opened only once. We just have to pass the ipset variable. Note that all functions using this helper *must* use ipset as variable name for the socket. c s� t � g| �R i |��}|d d u r�td d7 <