1
1
Fork 0
mirror of https://github.com/DNSCrypt/encrypted-dns-server.git synced 2024-04-27 05:45:00 +02:00
This commit is contained in:
Frank Denis 2022-05-14 01:30:16 +02:00
parent 9e52627655
commit 9a3cde4ba5
13 changed files with 100 additions and 93 deletions

View File

@ -1,14 +1,15 @@
use crate::errors::*;
use crate::*;
use std::hash::Hasher;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use std::sync::Arc;
use byteorder::{BigEndian, ByteOrder};
use ipext::IpExt;
use siphasher::sip128::Hasher128;
use std::hash::Hasher;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use std::sync::Arc;
use tokio::net::UdpSocket;
use crate::errors::*;
use crate::*;
pub const ANONYMIZED_DNSCRYPT_QUERY_MAGIC: [u8; 10] =
[0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00];

View File

@ -1,11 +1,12 @@
use crate::errors::*;
use rustc_hash::FxHashMap;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::path::Path;
use std::sync::Arc;
use rustc_hash::FxHashMap;
use crate::errors::*;
const MAX_ITERATIONS: usize = 5;
#[derive(Debug)]

View File

@ -1,9 +1,10 @@
use crate::dns;
use std::sync::Arc;
use clockpro_cache::ClockProCache;
use coarsetime::{Duration, Instant};
use parking_lot::{Mutex, MutexGuard};
use std::sync::Arc;
use crate::dns;
#[derive(Clone, Debug)]
pub struct CachedResponse {

View File

@ -1,13 +1,14 @@
use crate::crypto::*;
use crate::dnscrypt_certs::*;
use crate::errors::*;
use std::fs;
use std::mem;
use std::net::{IpAddr, SocketAddr};
use std::path::{Path, PathBuf};
use tokio::io::AsyncWriteExt;
use crate::crypto::*;
use crate::dnscrypt_certs::*;
use crate::errors::*;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct AccessControlConfig {
pub enabled: bool,

View File

@ -1,11 +1,12 @@
use crate::errors::*;
use std::ffi::CStr;
use std::hash::Hasher;
use std::ptr;
use libsodium_sys::*;
use serde_big_array::BigArray;
use siphasher::sip::SipHasher13;
use std::ffi::CStr;
use std::hash::Hasher;
use std::ptr;
use crate::errors::*;
#[derive(Derivative)]
#[derivative(Default)]

View File

@ -1,10 +1,11 @@
use crate::dnscrypt_certs::*;
use crate::errors::*;
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
use std::net::IpAddr;
use std::sync::Arc;
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
use crate::dnscrypt_certs::*;
use crate::errors::*;
pub const DNS_MAX_HOSTNAME_SIZE: usize = 256;
pub const DNS_HEADER_SIZE: usize = 12;
pub const DNS_OFFSET_FLAGS: usize = 2;

View File

@ -1,12 +1,13 @@
use std::sync::Arc;
use libsodium_sys::*;
use rand::prelude::*;
use crate::crypto::*;
use crate::dns::*;
use crate::dnscrypt_certs::*;
use crate::errors::*;
use libsodium_sys::*;
use rand::prelude::*;
use std::sync::Arc;
pub const DNSCRYPT_FULL_NONCE_SIZE: usize =
crypto_box_curve25519xchacha20poly1305_NONCEBYTES as usize;
pub const DNSCRYPT_MAC_SIZE: usize = crypto_box_curve25519xchacha20poly1305_MACBYTES as usize;

View File

@ -1,18 +1,19 @@
use crate::anonymized_dns::*;
use crate::config::*;
use crate::crypto::*;
use crate::dnscrypt::*;
use crate::globals::*;
use std::mem;
use std::slice;
use std::sync::Arc;
use std::time::SystemTime;
use byteorder::{BigEndian, ByteOrder};
use clockpro_cache::ClockProCache;
use parking_lot::Mutex;
use rand::prelude::*;
use serde_big_array::BigArray;
use std::mem;
use std::slice;
use std::sync::Arc;
use std::time::SystemTime;
use crate::anonymized_dns::*;
use crate::config::*;
use crate::crypto::*;
use crate::dnscrypt::*;
use crate::globals::*;
pub const DNSCRYPT_CERTS_TTL: u32 = 86400;
pub const DNSCRYPT_CERTS_RENEWAL: u32 = 28800;

View File

@ -1,21 +1,22 @@
use crate::blacklist::*;
use crate::cache::*;
use crate::crypto::*;
use crate::dnscrypt_certs::*;
#[cfg(feature = "metrics")]
use crate::varz::*;
use parking_lot::{Mutex, RwLock};
use siphasher::sip128::SipHasher13;
use std::collections::vec_deque::VecDeque;
use std::net::{IpAddr, SocketAddr};
use std::path::PathBuf;
use std::sync::atomic::AtomicU32;
use std::sync::Arc;
use std::time::Duration;
use parking_lot::{Mutex, RwLock};
use siphasher::sip128::SipHasher13;
use tokio::runtime::Handle;
use tokio::sync::oneshot;
use crate::blacklist::*;
use crate::cache::*;
use crate::crypto::*;
use crate::dnscrypt_certs::*;
#[cfg(feature = "metrics")]
use crate::varz::*;
#[derive(Clone, Derivative)]
#[derivative(Debug)]
pub struct Globals {

View File

@ -35,30 +35,6 @@ mod resolver;
#[cfg(feature = "metrics")]
mod varz;
use anonymized_dns::*;
use blacklist::*;
use cache::*;
use config::*;
use crypto::*;
use dns::*;
use dnscrypt::*;
use dnscrypt_certs::*;
use errors::*;
use globals::*;
#[cfg(feature = "metrics")]
use varz::*;
use byteorder::{BigEndian, ByteOrder};
use clap::Arg;
use clockpro_cache::ClockProCache;
use dnsstamps::{InformalProperty, WithInformalProperty};
use futures::join;
use futures::prelude::*;
use parking_lot::Mutex;
use parking_lot::RwLock;
use privdrop::PrivDrop;
use rand::prelude::*;
use siphasher::sip128::SipHasher13;
use std::collections::vec_deque::VecDeque;
use std::convert::TryFrom;
use std::fs::File;
@ -68,10 +44,34 @@ use std::path::Path;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use std::time::Duration;
use anonymized_dns::*;
use blacklist::*;
use byteorder::{BigEndian, ByteOrder};
use cache::*;
use clap::Arg;
use clockpro_cache::ClockProCache;
use config::*;
use crypto::*;
use dns::*;
use dnscrypt::*;
use dnscrypt_certs::*;
use dnsstamps::{InformalProperty, WithInformalProperty};
use errors::*;
use futures::join;
use futures::prelude::*;
use globals::*;
use parking_lot::Mutex;
use parking_lot::RwLock;
use privdrop::PrivDrop;
use rand::prelude::*;
use siphasher::sip128::SipHasher13;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, TcpSocket, TcpStream, UdpSocket};
use tokio::runtime::Handle;
use tokio::sync::oneshot;
#[cfg(feature = "metrics")]
use varz::*;
const TCP_BACKLOG: i32 = 1024;

View File

@ -1,6 +1,6 @@
use crate::config::*;
use crate::errors::*;
use crate::varz::*;
use std::mem;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
#[allow(unused_imports)]
use futures::prelude::*;
@ -9,12 +9,13 @@ use hyper::server::conn::Http;
use hyper::service::service_fn;
use hyper::{Body, Request, Response, StatusCode};
use prometheus::{self, Encoder, TextEncoder};
use std::mem;
use std::sync::atomic::{AtomicU32, Ordering};
use std::sync::Arc;
use tokio::net::TcpListener;
use tokio::runtime::Handle;
use crate::config::*;
use crate::errors::*;
use crate::varz::*;
const METRICS_CONNECTION_TIMEOUT_SECS: u64 = 10;
const METRICS_MAX_CONCURRENT_CONNECTIONS: u32 = 2;

View File

@ -1,18 +1,19 @@
use std::cmp;
use std::hash::Hasher;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use byteorder::{BigEndian, ByteOrder};
use rand::prelude::*;
use siphasher::sip128::Hasher128;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpSocket, UdpSocket};
use crate::cache::*;
use crate::dns::{self, *};
use crate::errors::*;
use crate::globals::*;
use crate::ClientCtx;
use byteorder::{BigEndian, ByteOrder};
use rand::prelude::*;
use siphasher::sip128::Hasher128;
use std::cmp;
use std::hash::Hasher;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpSocket, UdpSocket};
pub async fn resolve_udp(
globals: &Globals,
packet: &mut Vec<u8>,

View File

@ -1,6 +1,7 @@
use std::sync::Arc;
use coarsetime::Instant;
use prometheus::{Histogram, IntCounter, IntGauge};
use std::sync::Arc;
pub struct StartInstant(pub Instant);
@ -64,22 +65,19 @@ impl Inner {
.unwrap(),
client_queries_udp: register_int_counter!(opts!(
"encrypted_dns_client_queries_udp",
"Number of client queries received \
using UDP",
"Number of client queries received using UDP",
labels! {"handler" => "all",}
))
.unwrap(),
client_queries_tcp: register_int_counter!(opts!(
"encrypted_dns_client_queries_tcp",
"Number of client queries received \
using TCP",
"Number of client queries received using TCP",
labels! {"handler" => "all",}
))
.unwrap(),
client_queries_cached: register_int_counter!(opts!(
"encrypted_dns_client_queries_cached",
"Number of client queries sent from \
the cache",
"Number of client queries sent from the cache",
labels! {"handler" => "all",}
))
.unwrap(),
@ -91,9 +89,7 @@ impl Inner {
.unwrap(),
client_queries_offline: register_int_counter!(opts!(
"encrypted_dns_client_queries_offline",
"Number of client queries answered \
while upstream resolvers are \
unresponsive",
"Number of client queries answered while upstream resolvers are unresponsive",
labels! {"handler" => "all",}
))
.unwrap(),