mirror of
https://github.com/yuezk/GlobalProtect-openconnect.git
synced 2025-05-20 07:26:58 -04:00
Refactor using Tauri (#278)
This commit is contained in:
41
crates/gpapi/src/gateway/mod.rs
Normal file
41
crates/gpapi/src/gateway/mod.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
mod login;
|
||||
mod parse_gateways;
|
||||
|
||||
pub use login::*;
|
||||
pub(crate) use parse_gateways::*;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use specta::Type;
|
||||
|
||||
use std::fmt::Display;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Type, Clone)]
|
||||
pub(crate) struct PriorityRule {
|
||||
pub(crate) name: String,
|
||||
pub(crate) priority: u32,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Type, Clone)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Gateway {
|
||||
pub(crate) name: String,
|
||||
pub(crate) address: String,
|
||||
pub(crate) priority: u32,
|
||||
pub(crate) priority_rules: Vec<PriorityRule>,
|
||||
}
|
||||
|
||||
impl Display for Gateway {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{} ({})", self.name, self.address)
|
||||
}
|
||||
}
|
||||
|
||||
impl Gateway {
|
||||
pub fn name(&self) -> &str {
|
||||
&self.name
|
||||
}
|
||||
|
||||
pub fn server(&self) -> &str {
|
||||
&self.address
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user