mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2026-11-20 06:56:17 -05:00
feat: add the -i/--interface option (#512)
This commit is contained in:
1 parent
ea9819d161
commit
c1ab26aef3
5 files changed
+19
-1
No files matched your search
@@ -16,6 +16,7 @@ pub struct Vpn {
|
||||
cookie: CString,
|
||||
user_agent: CString,
|
||||
script: CString,
|
||||
interface: Option<CString>,
|
||||
os: CString,
|
||||
certificate: Option<CString>,
|
||||
sslkey: Option<CString>,
|
||||
@@ -65,6 +66,7 @@ impl Vpn {
|
||||
cookie: self.cookie.as_ptr(),
|
||||
user_agent: self.user_agent.as_ptr(),
|
||||
script: self.script.as_ptr(),
|
||||
interface: Self::option_to_ptr(&self.interface),
|
||||
os: self.os.as_ptr(),
|
||||
|
||||
certificate: Self::option_to_ptr(&self.certificate),
|
||||
@@ -113,6 +115,7 @@ pub struct VpnBuilder {
|
||||
server: String,
|
||||
cookie: String,
|
||||
script: Option<String>,
|
||||
interface: Option<String>,
|
||||
|
||||
user_agent: Option<String>,
|
||||
os: Option<String>,
|
||||
@@ -136,6 +139,7 @@ impl VpnBuilder {
|
||||
server: server.to_string(),
|
||||
cookie: cookie.to_string(),
|
||||
script: None,
|
||||
interface: None,
|
||||
|
||||
user_agent: None,
|
||||
os: None,
|
||||
@@ -159,6 +163,11 @@ impl VpnBuilder {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn interface<T: Into<Option<String>>>(mut self, interface: T) -> Self {
|
||||
self.interface = interface.into();
|
||||
self
|
||||
}
|
||||
|
||||
pub fn user_agent<T: Into<Option<String>>>(mut self, user_agent: T) -> Self {
|
||||
self.user_agent = user_agent.into();
|
||||
self
|
||||
@@ -235,6 +244,7 @@ impl VpnBuilder {
|
||||
cookie: Self::to_cstring(&self.cookie),
|
||||
user_agent: Self::to_cstring(&user_agent),
|
||||
script: Self::to_cstring(&script),
|
||||
interface: self.interface.as_deref().map(Self::to_cstring),
|
||||
os: Self::to_cstring(&os),
|
||||
|
||||
certificate: self.certificate.as_deref().map(Self::to_cstring),
|
||||
|
||||
Reference in new issue
Block a user