mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-05-07 10:14:35 +00:00
update rust to 1.93 (#1865)
This commit is contained in:
@@ -636,12 +636,13 @@ impl ConfigLoader for TomlConfigLoader {
|
||||
|
||||
fn get_id(&self) -> uuid::Uuid {
|
||||
let mut locked_config = self.config.lock().unwrap();
|
||||
if locked_config.instance_id.is_none() {
|
||||
let id = uuid::Uuid::new_v4();
|
||||
locked_config.instance_id = Some(id);
|
||||
id
|
||||
} else {
|
||||
*locked_config.instance_id.as_ref().unwrap()
|
||||
match locked_config.instance_id {
|
||||
Some(id) => id,
|
||||
None => {
|
||||
let id = uuid::Uuid::new_v4();
|
||||
locked_config.instance_id = Some(id);
|
||||
id
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -484,18 +484,14 @@ impl StunNatTypeDetectResult {
|
||||
if self.public_ips().len() != 1
|
||||
|| self.usable_stun_resp_count() <= 1
|
||||
|| self.max_port() - self.min_port() > 15
|
||||
|| self.extra_bind_test.is_none()
|
||||
|| self
|
||||
.extra_bind_test
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.mapped_socket_addr
|
||||
.is_none()
|
||||
{
|
||||
NatType::Symmetric
|
||||
} else {
|
||||
let extra_bind_test = self.extra_bind_test.as_ref().unwrap();
|
||||
let extra_port = extra_bind_test.mapped_socket_addr.unwrap().port();
|
||||
} else if let Some(extra_bind_mapped) = self
|
||||
.extra_bind_test
|
||||
.as_ref()
|
||||
.and_then(|extra| extra.mapped_socket_addr)
|
||||
{
|
||||
let extra_port = extra_bind_mapped.port();
|
||||
|
||||
let max_port_diff = extra_port.saturating_sub(self.max_port());
|
||||
let min_port_diff = self.min_port().saturating_sub(extra_port);
|
||||
@@ -506,6 +502,8 @@ impl StunNatTypeDetectResult {
|
||||
} else {
|
||||
NatType::Symmetric
|
||||
}
|
||||
} else {
|
||||
NatType::Symmetric
|
||||
}
|
||||
} else {
|
||||
NatType::Unknown
|
||||
|
||||
Reference in New Issue
Block a user