mirror of
https://github.com/bolucat/Archive.git
synced 2025-10-10 02:20:33 +08:00
Update On Sun May 12 20:29:14 CEST 2024
This commit is contained in:
@@ -301,6 +301,15 @@ impl Default for ServerUserManager {
|
||||
}
|
||||
}
|
||||
|
||||
/// The source of the ServerConfig
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum ServerSource {
|
||||
Default, //< Default source, created in code
|
||||
Configuration, //< Created from configuration
|
||||
CommandLine, //< Created from command line
|
||||
OnlineConfig, //< Created from online configuration (SIP008)
|
||||
}
|
||||
|
||||
/// Configuration for a server
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct ServerConfig {
|
||||
@@ -340,6 +349,9 @@ pub struct ServerConfig {
|
||||
|
||||
/// Weight
|
||||
weight: ServerWeight,
|
||||
|
||||
/// Source
|
||||
source: ServerSource,
|
||||
}
|
||||
|
||||
#[cfg(feature = "aead-cipher-2022")]
|
||||
@@ -452,6 +464,7 @@ impl ServerConfig {
|
||||
id: None,
|
||||
mode: Mode::TcpAndUdp, // Server serves TCP & UDP by default
|
||||
weight: ServerWeight::new(),
|
||||
source: ServerSource::Default,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,6 +631,16 @@ impl ServerConfig {
|
||||
self.weight = weight;
|
||||
}
|
||||
|
||||
/// Get server's source
|
||||
pub fn source(&self) -> ServerSource {
|
||||
self.source
|
||||
}
|
||||
|
||||
/// Set server's source
|
||||
pub fn set_source(&mut self, source: ServerSource) {
|
||||
self.source = source;
|
||||
}
|
||||
|
||||
/// Get URL for QRCode
|
||||
/// ```plain
|
||||
/// ss:// + base64(method:password@host:port)
|
||||
|
Reference in New Issue
Block a user