clean up unused import and code
This commit is contained in:
parent
aae2e94cc8
commit
cf16efcf7a
|
@ -1,7 +1,6 @@
|
||||||
use domain_core::bits::message::Message;
|
use domain_core::bits::message::Message;
|
||||||
use domain_core::bits::message_builder::MessageBuilder;
|
use domain_core::bits::message_builder::MessageBuilder;
|
||||||
use domain_core::bits::question::Question;
|
use domain_core::bits::question::Question;
|
||||||
use domain_core::bits::record::ParsedRecord;
|
|
||||||
use domain_core::bits::record::Record;
|
use domain_core::bits::record::Record;
|
||||||
use domain_core::bits::{ParsedDname, SectionBuilder};
|
use domain_core::bits::{ParsedDname, SectionBuilder};
|
||||||
use domain_core::iana::Opcode;
|
use domain_core::iana::Opcode;
|
||||||
|
@ -40,7 +39,7 @@ impl Client {
|
||||||
retries: usize,
|
retries: usize,
|
||||||
) -> Result<Vec<Record<ParsedDname, AllRecordData<ParsedDname>>>, String> {
|
) -> Result<Vec<Record<ParsedDname, AllRecordData<ParsedDname>>>, String> {
|
||||||
let mut last_res = Err("Dummy".to_string());
|
let mut last_res = Err("Dummy".to_string());
|
||||||
for i in (0..retries) {
|
for _ in 0..retries {
|
||||||
last_res = self.query(questions.clone()).await;
|
last_res = self.query(questions.clone()).await;
|
||||||
if last_res.is_ok() {
|
if last_res.is_ok() {
|
||||||
break;
|
break;
|
||||||
|
@ -77,7 +76,7 @@ impl Client {
|
||||||
|
|
||||||
async fn do_query(upstream: &str, msg: Message) -> Result<Message, String> {
|
async fn do_query(upstream: &str, msg: Message) -> Result<Message, String> {
|
||||||
let body = Uint8Array::from(msg.as_slice());
|
let body = Uint8Array::from(msg.as_slice());
|
||||||
let mut headers = Headers::new().map_err(|_| "Could not create headers".to_string())?;
|
let headers = Headers::new().map_err(|_| "Could not create headers".to_string())?;
|
||||||
headers
|
headers
|
||||||
.append("Accept", "application/dns-message")
|
.append("Accept", "application/dns-message")
|
||||||
.map_err(|_| "Could not append header".to_string())?;
|
.map_err(|_| "Could not append header".to_string())?;
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
use crate::client::*;
|
use crate::client::*;
|
||||||
use async_static::async_static;
|
use async_static::async_static;
|
||||||
use bytes::Bytes;
|
|
||||||
use domain_core::bits::message::Message;
|
use domain_core::bits::message::Message;
|
||||||
use domain_core::bits::message_builder::MessageBuilder;
|
use domain_core::bits::message_builder::MessageBuilder;
|
||||||
use domain_core::bits::question::Question;
|
use domain_core::bits::question::Question;
|
||||||
use domain_core::bits::record::Record;
|
use domain_core::bits::record::Record;
|
||||||
use domain_core::bits::ParsedRecord;
|
|
||||||
use domain_core::bits::{ParsedDname, RecordSectionBuilder, SectionBuilder};
|
use domain_core::bits::{ParsedDname, RecordSectionBuilder, SectionBuilder};
|
||||||
use domain_core::rdata::AllRecordData;
|
use domain_core::rdata::AllRecordData;
|
||||||
use js_sys::{ArrayBuffer, Uint8Array};
|
use js_sys::{ArrayBuffer, Uint8Array};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
use wasm_bindgen::prelude::*;
|
|
||||||
use wasm_bindgen_futures::JsFuture;
|
use wasm_bindgen_futures::JsFuture;
|
||||||
use web_sys::*;
|
use web_sys::*;
|
||||||
|
|
||||||
|
@ -94,7 +91,7 @@ impl Server {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Build the response
|
// Build the response
|
||||||
let mut resp_headers =
|
let resp_headers =
|
||||||
err_response!(Headers::new().map_err(|_| "Could not create headers".to_string()));
|
err_response!(Headers::new().map_err(|_| "Could not create headers".to_string()));
|
||||||
err_response!(resp_headers
|
err_response!(resp_headers
|
||||||
.append("Content-Type", resp_content_type)
|
.append("Content-Type", resp_content_type)
|
||||||
|
|
Loading…
Reference in a new issue