Added some checks for "Yggdrasil only" zones.

This commit is contained in:
Revertron
2021-04-10 20:02:51 +02:00
parent 04189f319a
commit f671de3746
5 changed files with 68 additions and 4 deletions
+19
View File
@@ -7,6 +7,7 @@ use std::net::IpAddr;
#[cfg(not(target_os = "macos"))]
use thread_priority::*;
use crate::dns::protocol::DnsRecord;
/// Convert bytes array to HEX format
pub fn to_hex(buf: &[u8]) -> String {
@@ -94,6 +95,24 @@ pub fn is_yggdrasil(addr: &IpAddr) -> bool {
false
}
/// Checks if this record has IP from Yggdrasil network
/// https://yggdrasil-network.github.io
pub fn is_yggdrasil_record(record: &DnsRecord) -> bool {
match record {
DnsRecord::UNKNOWN { .. } => {}
DnsRecord::A { .. } => { return false }
DnsRecord::NS { .. } => {}
DnsRecord::CNAME { .. } => {}
DnsRecord::SOA { .. } => {}
DnsRecord::MX { .. } => {}
DnsRecord::TXT { .. } => {}
DnsRecord::AAAA { addr, .. } => { return is_yggdrasil(&IpAddr::from(*addr))}
DnsRecord::SRV { .. } => {}
DnsRecord::OPT { .. } => {}
}
true
}
#[cfg(target_os = "windows")]
#[allow(unused_variables)]
pub fn setup_miner_thread(cpu: u32) {