summaryrefslogtreecommitdiffhomepage
path: root/mullvad-encrypted-dns-proxy/src
diff options
context:
space:
mode:
authorMarkus Pettersson <markus.pettersson@mullvad.net>2024-10-18 11:08:31 +0200
committerMarkus Pettersson <markus.pettersson@mullvad.net>2024-10-23 14:59:43 +0200
commit9e99d2aa2d9df2d39002c15e75ccf44ccb7ead20 (patch)
tree269885bcb0735cf3ac1a3538e4619d69ed0387bd /mullvad-encrypted-dns-proxy/src
parent4d51fe6c0df45ee6ec911a67421d7994d9993cc5 (diff)
downloadmullvadvpn-9e99d2aa2d9df2d39002c15e75ccf44ccb7ead20.tar.xz
mullvadvpn-9e99d2aa2d9df2d39002c15e75ccf44ccb7ead20.zip
Enable Encrypted DNS proxy access method in the daemon
Diffstat (limited to 'mullvad-encrypted-dns-proxy/src')
-rw-r--r--mullvad-encrypted-dns-proxy/src/config/mod.rs5
-rw-r--r--mullvad-encrypted-dns-proxy/src/config/xor.rs4
2 files changed, 6 insertions, 3 deletions
diff --git a/mullvad-encrypted-dns-proxy/src/config/mod.rs b/mullvad-encrypted-dns-proxy/src/config/mod.rs
index bd75fd25eb..70f3b62af4 100644
--- a/mullvad-encrypted-dns-proxy/src/config/mod.rs
+++ b/mullvad-encrypted-dns-proxy/src/config/mod.rs
@@ -7,6 +7,7 @@ use std::net::{Ipv6Addr, SocketAddrV4};
mod plain;
mod xor;
+use serde::{Deserialize, Serialize};
pub use xor::XorKey;
/// All the errors that can happen during deserialization of a [`ProxyConfig`].
@@ -67,7 +68,7 @@ pub trait Obfuscator: Send {
/// Represents a Mullvad Encrypted DNS proxy configuration. Created by parsing
/// the config out of an IPv6 address resolved over DoH.
-#[derive(Debug, Clone, Eq, PartialEq, Hash)]
+#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct ProxyConfig {
/// The remote address to connect to the proxy over. This is the address
/// on the internet where the proxy is listening.
@@ -77,7 +78,7 @@ pub struct ProxyConfig {
pub obfuscation: Option<ObfuscationConfig>,
}
-#[derive(Debug, Clone, Eq, PartialEq, Hash)]
+#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub enum ObfuscationConfig {
XorV2(xor::XorKey),
}
diff --git a/mullvad-encrypted-dns-proxy/src/config/xor.rs b/mullvad-encrypted-dns-proxy/src/config/xor.rs
index b4dd2dbdf2..eb4f314e13 100644
--- a/mullvad-encrypted-dns-proxy/src/config/xor.rs
+++ b/mullvad-encrypted-dns-proxy/src/config/xor.rs
@@ -1,6 +1,8 @@
use core::fmt;
use std::net::{Ipv4Addr, SocketAddrV4};
+use serde::{Deserialize, Serialize};
+
/// Parse a proxy config that XORs all traffic with the given key.
///
/// A Xor configuration is represented by the proxy type `ProxyType::XorV2`. There used to be a `XorV1`, but it
@@ -37,7 +39,7 @@ pub fn parse_xor(data: [u8; 12]) -> Result<super::ProxyConfig, super::Error> {
/// A bunch of bytes, representing a "key" Simply meaning a slice of bytes that the data
/// will be XORed with.
-#[derive(Copy, Clone, Eq, PartialEq, Hash)]
+#[derive(Copy, Clone, Eq, PartialEq, Hash, Serialize, Deserialize)]
pub struct XorKey {
data: [u8; 6],
len: usize,