mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
refactor: rewrite
This commit is contained in:
1
gpclient/.gitignore
vendored
Normal file
1
gpclient/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/target
|
10
gpclient/Cargo.toml
Normal file
10
gpclient/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "gpclient"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
common = { path = "../common" }
|
||||
tokio = { version = "1.0", features = ["full"] }
|
25
gpclient/src/main.rs
Normal file
25
gpclient/src/main.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use common::{Client, SOCKET_PATH};
|
||||
use tokio::{io::AsyncReadExt, net::UnixStream, sync::mpsc};
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
// let mut stream = UnixStream::connect(SOCKET_PATH).await.unwrap();
|
||||
|
||||
// let mut buf = [0u8; 34];
|
||||
// let _ = stream.read(&mut buf).await.unwrap();
|
||||
|
||||
// // The first two bytes are the port number, the rest is the AES key
|
||||
// let http_port = u16::from_be_bytes([buf[0], buf[1]]);
|
||||
// let aes_key = &buf[2..];
|
||||
|
||||
// println!("http_port: {http_port}");
|
||||
// println!("aes_key: {aes_key:?}");
|
||||
let (output_tx, mut output_rx) = mpsc::channel::<String>(32);
|
||||
let client = Client::default();
|
||||
|
||||
tokio::select! {
|
||||
_ = client.run() => {
|
||||
println!("Client finished");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user