mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
20 lines
450 B
Rust
20 lines
450 B
Rust
use super::lock_file::gpservice_lock_info;
|
|
|
|
async fn read_port() -> anyhow::Result<String> {
|
|
let lock_info = gpservice_lock_info().await?;
|
|
|
|
Ok(lock_info.port.to_string())
|
|
}
|
|
|
|
pub async fn http_endpoint() -> anyhow::Result<String> {
|
|
let port = read_port().await?;
|
|
|
|
Ok(format!("http://127.0.0.1:{}", port))
|
|
}
|
|
|
|
pub async fn ws_endpoint() -> anyhow::Result<String> {
|
|
let port = read_port().await?;
|
|
|
|
Ok(format!("ws://127.0.0.1:{}/ws", port))
|
|
}
|