mirror of https://github.com/rapiz1/rathole.git
fix: clippy (#187)
This commit is contained in:
parent
67182fbc10
commit
064bdcab8e
|
@ -15,7 +15,7 @@ const DEFAULT_HEARTBEAT_TIMEOUT_SECS: u64 = 40;
|
||||||
|
|
||||||
/// String with Debug implementation that emits "MASKED"
|
/// String with Debug implementation that emits "MASKED"
|
||||||
/// Used to mask sensitive strings when logging
|
/// Used to mask sensitive strings when logging
|
||||||
#[derive(Serialize, Deserialize, Default, PartialEq, Clone)]
|
#[derive(Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
|
||||||
pub struct MaskedString(String);
|
pub struct MaskedString(String);
|
||||||
|
|
||||||
impl Debug for MaskedString {
|
impl Debug for MaskedString {
|
||||||
|
@ -37,7 +37,7 @@ impl From<&str> for MaskedString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone, PartialEq, Eq)]
|
||||||
pub enum TransportType {
|
pub enum TransportType {
|
||||||
#[serde(rename = "tcp")]
|
#[serde(rename = "tcp")]
|
||||||
Tcp,
|
Tcp,
|
||||||
|
@ -53,7 +53,7 @@ impl Default for TransportType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Default)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ClientServiceConfig {
|
pub struct ClientServiceConfig {
|
||||||
#[serde(rename = "type", default = "default_service_type")]
|
#[serde(rename = "type", default = "default_service_type")]
|
||||||
|
@ -74,7 +74,7 @@ impl ClientServiceConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum ServiceType {
|
pub enum ServiceType {
|
||||||
#[serde(rename = "tcp")]
|
#[serde(rename = "tcp")]
|
||||||
Tcp,
|
Tcp,
|
||||||
|
@ -92,7 +92,7 @@ fn default_service_type() -> ServiceType {
|
||||||
Default::default()
|
Default::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Default)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq, Default)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ServerServiceConfig {
|
pub struct ServerServiceConfig {
|
||||||
#[serde(rename = "type", default = "default_service_type")]
|
#[serde(rename = "type", default = "default_service_type")]
|
||||||
|
@ -112,7 +112,7 @@ impl ServerServiceConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct TlsConfig {
|
pub struct TlsConfig {
|
||||||
pub hostname: Option<String>,
|
pub hostname: Option<String>,
|
||||||
|
@ -125,7 +125,7 @@ fn default_noise_pattern() -> String {
|
||||||
String::from("Noise_NK_25519_ChaChaPoly_BLAKE2s")
|
String::from("Noise_NK_25519_ChaChaPoly_BLAKE2s")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct NoiseConfig {
|
pub struct NoiseConfig {
|
||||||
#[serde(default = "default_noise_pattern")]
|
#[serde(default = "default_noise_pattern")]
|
||||||
|
@ -147,7 +147,7 @@ fn default_keepalive_interval() -> u64 {
|
||||||
DEFAULT_KEEPALIVE_INTERVAL
|
DEFAULT_KEEPALIVE_INTERVAL
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct TcpConfig {
|
pub struct TcpConfig {
|
||||||
#[serde(default = "default_nodelay")]
|
#[serde(default = "default_nodelay")]
|
||||||
|
@ -170,7 +170,7 @@ impl Default for TcpConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone, Default)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Default)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct TransportConfig {
|
pub struct TransportConfig {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
@ -185,7 +185,7 @@ fn default_heartbeat_timeout() -> u64 {
|
||||||
DEFAULT_HEARTBEAT_TIMEOUT_SECS
|
DEFAULT_HEARTBEAT_TIMEOUT_SECS
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ClientConfig {
|
pub struct ClientConfig {
|
||||||
pub remote_addr: String,
|
pub remote_addr: String,
|
||||||
|
@ -201,7 +201,7 @@ fn default_heartbeat_interval() -> u64 {
|
||||||
DEFAULT_HEARTBEAT_INTERVAL_SECS
|
DEFAULT_HEARTBEAT_INTERVAL_SECS
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Default, PartialEq, Eq, Clone)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct ServerConfig {
|
pub struct ServerConfig {
|
||||||
pub bind_addr: String,
|
pub bind_addr: String,
|
||||||
|
@ -213,7 +213,7 @@ pub struct ServerConfig {
|
||||||
pub heartbeat_interval: u64,
|
pub heartbeat_interval: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
|
||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
pub server: Option<ServerConfig>,
|
pub server: Option<ServerConfig>,
|
||||||
|
|
|
@ -14,13 +14,13 @@ use tracing::{error, info, instrument};
|
||||||
#[cfg(feature = "notify")]
|
#[cfg(feature = "notify")]
|
||||||
use notify::{EventKind, RecursiveMode, Watcher};
|
use notify::{EventKind, RecursiveMode, Watcher};
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum ConfigChange {
|
pub enum ConfigChange {
|
||||||
General(Box<Config>), // Trigger a full restart
|
General(Box<Config>), // Trigger a full restart
|
||||||
ServiceChange(ServiceChange),
|
ServiceChange(ServiceChange),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq, Eq)]
|
||||||
pub enum ServiceChange {
|
pub enum ServiceChange {
|
||||||
ClientAdd(ClientServiceConfig),
|
ClientAdd(ClientServiceConfig),
|
||||||
ClientDelete(String),
|
ClientDelete(String),
|
||||||
|
|
Loading…
Reference in New Issue