mirror of
https://github.com/EasyTier/EasyTier.git
synced 2026-08-07 21:19:51 +00:00
use sanitize in get_hostname
fmt config
This commit is contained in:
@@ -13,6 +13,8 @@ use serde::{Deserialize, Serialize};
|
|||||||
use strum::{Display, EnumString, VariantArray};
|
use strum::{Display, EnumString, VariantArray};
|
||||||
use tokio::io::AsyncReadExt as _;
|
use tokio::io::AsyncReadExt as _;
|
||||||
|
|
||||||
|
use super::env_parser;
|
||||||
|
use crate::utils::dns::sanitize;
|
||||||
use crate::{
|
use crate::{
|
||||||
common::stun::StunInfoCollector,
|
common::stun::StunInfoCollector,
|
||||||
proto::{
|
proto::{
|
||||||
@@ -22,8 +24,6 @@ use crate::{
|
|||||||
tunnel::generate_digest_from_str,
|
tunnel::generate_digest_from_str,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::env_parser;
|
|
||||||
|
|
||||||
pub type Flags = crate::proto::common::FlagsInConfig;
|
pub type Flags = crate::proto::common::FlagsInConfig;
|
||||||
|
|
||||||
pub fn gen_default_flags() -> Flags {
|
pub fn gen_default_flags() -> Flags {
|
||||||
@@ -575,13 +575,8 @@ impl ConfigLoader for TomlConfigLoader {
|
|||||||
.lock()
|
.lock()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.hostname
|
.hostname
|
||||||
.clone()
|
.as_ref()
|
||||||
.map(|h| {
|
.map(sanitize)
|
||||||
h.chars()
|
|
||||||
.filter(|c| !c.is_control())
|
|
||||||
.take(32)
|
|
||||||
.collect::<String>()
|
|
||||||
})
|
|
||||||
.filter(|h| !h.is_empty());
|
.filter(|h| !h.is_empty());
|
||||||
|
|
||||||
self.set_hostname(hostname.clone());
|
self.set_hostname(hostname.clone());
|
||||||
|
|||||||
Reference in New Issue
Block a user