HEX
Server: Apache/2.4.65 (Debian)
System: Linux kubikelcreative 5.10.0-35-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User: www-data (33)
PHP: 8.4.13
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/fail2ban/server/__pycache__/jails.cpython-39.pyc
a

��_�
�@sTdZdZdZddlmZddlmZddlmZm	Z	dd	l
mZGd
d�de�ZdS)
z!Cyril Jaquier, Yaroslav Halchenkoz:Copyright (c) 2004 Cyril Jaquier, 2013- Yaroslav HalchenkoZGPL�)�Lock)�Mapping�)�DuplicateJailException�UnknownJailException�)�Jailc@sJeZdZdZdd�Zddd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dS)�JailsaBHandles the jails.

	This class handles the jails. Creation, deletion or access to a jail
	must be done through this class. This class is thread-safe which is
	not the case of the jail itself, including filter and actions. This
	class is based on Mapping type, and the `add` method must be used to
	add additional jails.
	cCst�|_t�|_dS�N)r�_Jails__lock�dict�_jails��self�r�7/usr/lib/python3/dist-packages/fail2ban/server/jails.py�__init__)szJails.__init__NcCsT|j�:||jvr tr2t|��nt|||�|j|<Wd�n1sF0YdS)aUAdds a jail.

		Adds a new jail if not already present which should use the
		given backend.

		Parameters
		----------
		name : str
			The name of the jail.
		backend : str
			The backend to use.
		db : Fail2BanDb
			Fail2Ban's persistent database instance.

		Raises
		------
		DuplicateJailException
			If jail name is already present.
		N)rr
Znoduplicatesrr)r�nameZbackendZdbrrr�add-s


z	Jails.addcCs
||jvSr
)r
�rrrrr�existsHszJails.existscCs^zLz"|j��|j|WW|j��Sty>t|��Yn0W|j��n|j��0dSr
)r�acquirer
�release�KeyErrorrrrrr�__getitem__Ks

�zJails.__getitem__cCsRz@z|j��|j|=Wnty2t|��Yn0W|j��n|j��0dSr
)rrr
rrrrrrr�__delitem__Ts
zJails.__delitem__cCs2z |j��t|j�W|j��S|j��0dSr
)rr�lenr
rrrrr�__len__]s


�z
Jails.__len__cCs2z |j��t|j�W|j��S|j��0dSr
)rr�iterr
rrrrr�__iter__ds


�zJails.__iter__)N)�__name__�
__module__�__qualname__�__doc__rrrrrrrrrrrr	s	
		r	N)
�
__author__Z
__copyright__Z__license__Z	threadingr�collectionsr�
exceptionsrrZjailrr	rrrr�<module>s