pub const LOG_CAP: usize = 200;
pub const TAB_TITLES: [&str; 3] = ["建房", "加入", "中继"];
pub const RELAYS: [&str; 2] = ["n0 默认中继", "自建中继"];
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ActiveTab {
Host,
Join,
Relay,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum FocusPane {
Profile,
Logs,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum InputMode {
Normal,
Editing,
}
pub enum Step {
Continue,
Exit,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum LifecycleState {
Idle,
Starting,
Active,
Stopping,
}
pub type TunnelPhase = LifecycleState;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HostField {
Port,
Password,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum JoinField {
Ticket,
Port,
Password,
}
impl ActiveTab {
pub fn index(self) -> usize {
match self {
ActiveTab::Host => 0,
ActiveTab::Join => 1,
ActiveTab::Relay => 2,
}
}
pub fn next(self) -> Self {
match self {
ActiveTab::Host => ActiveTab::Join,
ActiveTab::Join => ActiveTab::Relay,
ActiveTab::Relay => ActiveTab::Relay,
}
}
pub fn prev(self) -> Self {
match self {
ActiveTab::Host => ActiveTab::Host,
ActiveTab::Join => ActiveTab::Host,
ActiveTab::Relay => ActiveTab::Join,
}
}
}