feat: add the -i/--interface option (#512)

This commit is contained in:
Kevin Yue authored and GitHub committed 2025-06-10 22:12:14 +08:00
1 parent ea9819d161
commit c1ab26aef3
5 files changed
+19 -1

No files matched your search

+1
View File
@@ -12,6 +12,7 @@ pub(crate) struct ConnectOptions {
pub user_agent: *const c_char,
pub script: *const c_char,
pub interface: *const c_char,
pub os: *const c_char,
pub certificate: *const c_char,
pub sslkey: *const c_char,
+3 -1
View File
@@ -11,6 +11,7 @@ void *g_user_data;
static int g_cmd_pipe_fd;
static const char *g_vpnc_script;
static const char *g_vpnc_interface;
static vpn_connected_callback on_vpn_connected;
/* Validate the peer certificate */
@@ -38,7 +39,7 @@ static void print_progress(__attribute__((unused)) void *_vpninfo, int level, co
static void setup_tun_handler(void *_vpninfo)
{
int ret = openconnect_setup_tun_device(_vpninfo, g_vpnc_script, NULL);
int ret = openconnect_setup_tun_device(_vpninfo, g_vpnc_script, g_vpnc_interface);
if (!ret) {
on_vpn_connected(g_cmd_pipe_fd, g_user_data);
}
@@ -53,6 +54,7 @@ int vpn_connect(const vpn_options *options, vpn_connected_callback callback)
g_user_data = options->user_data;
g_vpnc_script = options->script;
g_vpnc_interface = options->interface;
on_vpn_connected = callback;
INFO("User agent: %s", options->user_agent);
+1
View File
@@ -13,6 +13,7 @@ typedef struct vpn_options
const char *user_agent;
const char *script;
const char *interface;
const char *os;
const char *certificate;
const char *sslkey;