sirup.IPRotator
Rotate IP address with OpenVPN
Classes
Class to manage a set of VPN configuration files and rotate the IP by iterating across the configuration files. |
Module Contents
- class sirup.IPRotator.IPRotator(auth_file, config_location, pwd=None, seed=None, config_file_rule=None, track_ip=True)[source]
Class to manage a set of VPN configuration files and rotate the IP by iterating across the configuration files.
Note
When the class is instantiated, any existing openvpn processes are killed. This is for reasons of safety, simplicity and making sure that the VPN connector works as intended.
- Parameters:
auth_file (str) – Path to the file containing authentication credentials for VPN connections.
config_location (str) – Path to the directory where VPN configuration files are stored.
pwd (str, optional) – Sudo password. If not provided, the user is asked to provide it at class instantiation.
seed (int, optional) – Seed for the random number generator to shuffle config files.
config_file_rule (str, optional) – Rule to filter config files in the config_location.
track_ip (bool, optional) – If True, the IP address is queried after each connect and disconnect. For long-running programs, it is better to set track_ip=False in order to respect the query limits of the IP address API.
- config_queue
List of OpenVPN configuration files.
- Type:
- randomizer
Pseudo-random number generator to shuffle the config_queue.
- Type:
- track_ip
Indicates whether the IP address should be tracked between connections, disconnections and rotations. If True, queries https://ifconfig.me for the IP address after each change of the IP address, which is not recommended for long-running programs.
- Type:
- connector
If a VPN tunnel is active, the sirup.VPNConnector object that is responsible for the connection.
- Type:
None or sirup.VPNConnector.VPNConnector