HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/proxy.cpython-310.pyc
o

�N�g��@sBdZddlZddlZe�e�ZdZdd�Z					d	dd�Z	dS)
a
Allows you to manage proxy settings on minions
==============================================

Setup proxy settings on minions

.. code-block:: yaml

    192.168.1.4:
      proxy.managed:
        - port: 3128
        - bypass_domains:
            - localhost
            - 127.0.0.1
�N�proxycCs tjj��stjj��rdSdS)z)
    Only work on Mac OS and Windows
    T)Fz!Only Mac OS and Windows supported)�salt�utils�platformZ	is_darwinZ
is_windows�rr�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/proxy.py�__virtual__sr�Ethernetc
Cs�|ddid�}gd�}|dur|}tddvr�dgi|d	<|D][}	td
|	�d��}
|
�d�|krF|
�d
�t|�krF|d|	�d�7<qtd|	�d�|||||�rn|dd�|	�7<|d	d�|	|||d��qd|d<|dd7<q|dur�td�}tt|��|��t|�kr�|dd7<n.td||�r�|dd7<|d	d�dt	t|��
|��i�nd|d<|dd7<t|d	d�dkr�|d	d=|Stddv�rOd}td�}
td�}|
�dd�du�r|D]#}	|	|
v�rd}n|
|	d|k�s|
|	d
t|�k�rd}nq�nd}tt|��|��t|�k�r.d}|�rKtd ||||��rAd!|d<|Sd|d<d"|d<|Sd#|d<|S)$a�
    Manages proxy settings for this mininon

    name
        The proxy server to use

    port
        The port used by the proxy server

    services
        A list of the services that should use the given proxy settings, valid services include http, https and ftp.
        If no service is given all of the valid services will be used.

    user
        The username to use for the proxy server if required

    password
        The password to use for the proxy server if required

    bypass_domains
        An array of the domains that should bypass the proxy

    network_service
        The network service to apply the changes to, this only necessary on
        macOS
    T�)�name�result�comment�changes)�http�https�ftpN�os)ZMacOS�Darwin�newrz
proxy.get_�_proxy�server�portr
z proxy settings already set.
z
proxy.set_z${} proxy settings updated correctly
)�servicerr�userFrz"Failed to set {0} proxy settings.
zproxy.get_proxy_bypassz0Proxy bypass domains are already set correctly.
zproxy.set_proxy_bypassz'Proxy bypass domains updated correctly
�bypass_domainsz$Failed to set bypass proxy domains.
r)�Windowszproxy.get_proxy_win�enabledzproxy.set_proxy_winz Proxy settings updated correctlyz!Failed to set {0} proxy settings.zProxy settings already correct.)Z
__grains__Z__salt__�get�str�format�append�len�set�intersection�list�
difference)
rrZservicesr�passwordrZnetwork_service�retZvalid_servicesrZcurrent_settingsZcurrent_domainsZchanges_neededrrr�managed"s�#��
���
����



��������r()NNNNr	)
�__doc__�loggingZsalt.utils.platformr�	getLogger�__name__�logZ__virtualname__rr(rrrr�<module>s
�