I am writing a script that basically scans OpenVPN servers using the openvpn client. By scanning I mean it checks whether if the server is accepting connections or not by attempting a connection, ping time and internet speed.
By default, when you connect to an OpenVPN server all your traffic gets sent to it, unless you change a setting in the config file. Because the scan is slow and to avoid disturbing the user's browsing and etc..., I can change the setting in the config file and use "ping -I " instead of the regular ping.
However, testing the internet speed is a problem. If I don't change the setting in the config file and all my traffic goes through the VPN, I can successfully use the speedtest-cli command to get the download and upload speeds.
However, speedtest-cli doesn't have any option to specify the interface.
Is there any command that allows me to specify the interface on which to conduct the speed test?
Also, the script is written in python, so I am looking for either a python command or a terminal command to accomplish this.
Also, please note that what I am looking for is download and upload speeds, not NIC speed.