Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Connect ¶
func Connect(profile string)
Connect establishes a VPN connection using the specified profile. It reads the VPN profile script from a hidden path, replaces placeholders with credentials, and executes the VPN command with the provided script.
func Disconnect ¶
func Disconnect()
func DisconnectWithKillPid ¶
func DisconnectWithKillPid()
Disconnect terminates the current VPN connection and kills the Cisco Secure Client GUI. It runs the `vpn disconnect` command to disconnect the VPN. After disconnecting, it attempts to kill the Cisco Secure Client GUI process using `pkill`.
func Info ¶
func Info()
Info prints the information about the vpnctl CLI tool. It displays the banner, author information, email, version, and a message indicating that the version is up to date. It also provides a hint to run 'vpnctl help' for available commands. This function is useful for providing users with basic information about the tool and how to get started.
func KillCiscoProcesses ¶ added in v1.0.7
func KillCiscoProcesses() error
func KillGUI ¶
func KillGUI()
KillGUI kills the Cisco Secure Client GUI and optionally the VPN process It uses `pkill` to find and terminate the GUI process by name. It also retrieves the VPN process IDs using `pgrep` and sends an interrupt signal to them. This function is useful for cleaning up the GUI and VPN processes when they are no longer needed.
func LaunchGUI ¶
func LaunchGUI()
LaunchGUI starts the Cisco Secure Client GUI application. It uses the `open` command to launch the GUI application. If an error occurs while launching the GUI, it logs the error. This function is useful for starting the GUI after a successful VPN connection.
func ShowHelp ¶
func ShowHelp()
ShowHelp prints the help message for the vpnctl CLI tool. It lists all available commands and their descriptions. This function is useful for users to understand how to use the tool and what commands are available.
func Status ¶
func Status()
Status checks the current VPN connection status using the Cisco Secure Client command line tool. It runs the command with a timeout to avoid hanging indefinitely. If the command times out, it logs an error and returns. If the command fails, it logs the error and prints the output. If the command succeeds, it logs the success and prints the output. This function is useful for checking if the VPN is currently connected or disconnected.
Types ¶
This section is empty.