mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
use hickory-dns resovler
This commit is contained in:
parent
732679feb9
commit
70ddb2ac21
5 changed files with 366 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
|||
use std::{collections::HashMap, ops::RangeInclusive, path::PathBuf};
|
||||
use std::{collections::HashMap, net::IpAddr, ops::RangeInclusive, path::PathBuf};
|
||||
|
||||
use cfg_if::cfg_if;
|
||||
use clap::{Parser, ValueEnum};
|
||||
|
@ -11,7 +11,7 @@ use wisp_mux::extensions::{
|
|||
ProtocolExtensionBuilder,
|
||||
};
|
||||
|
||||
use crate::{CLI, CONFIG};
|
||||
use crate::{CLI, CONFIG, RESOLVER};
|
||||
|
||||
#[derive(Serialize, Deserialize, Default, Debug)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
|
@ -114,6 +114,9 @@ pub struct StreamConfig {
|
|||
#[cfg(feature = "twisp")]
|
||||
pub allow_twisp: bool,
|
||||
|
||||
/// DNS servers to resolve with. Will default to system configuration.
|
||||
pub dns_servers: Vec<IpAddr>,
|
||||
|
||||
/// Whether or not to allow connections to IP addresses.
|
||||
pub allow_direct_ip: bool,
|
||||
/// Whether or not to allow connections to loopback IP addresses.
|
||||
|
@ -200,8 +203,12 @@ lazy_static! {
|
|||
}
|
||||
|
||||
pub fn validate_config_cache() {
|
||||
// constructs regexes
|
||||
let _ = CONFIG_CACHE.allowed_ports;
|
||||
// constructs wisp config
|
||||
CONFIG.wisp.to_opts().unwrap();
|
||||
// constructs resolver
|
||||
RESOLVER.clear_cache();
|
||||
}
|
||||
|
||||
impl Default for ServerConfig {
|
||||
|
@ -274,6 +281,8 @@ impl Default for StreamConfig {
|
|||
#[cfg(feature = "twisp")]
|
||||
allow_twisp: false,
|
||||
|
||||
dns_servers: Vec::new(),
|
||||
|
||||
allow_direct_ip: true,
|
||||
allow_loopback: true,
|
||||
allow_multicast: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue