client: remove useless ClientOptions
This commit is contained in:
parent
78a971908b
commit
ef3657aadb
|
@ -11,21 +11,17 @@ use js_sys::{ArrayBuffer, Uint8Array};
|
|||
use wasm_bindgen_futures::JsFuture;
|
||||
use web_sys::{Headers, Request, RequestInit, Response};
|
||||
|
||||
pub struct ClientOptions {
|
||||
pub upstream_urls: Vec<String>,
|
||||
}
|
||||
|
||||
// The DNS client implementation
|
||||
pub struct Client {
|
||||
options: ClientOptions,
|
||||
upstream_urls: Vec<String>,
|
||||
cache: DnsCache,
|
||||
override_resolver: OverrideResolver,
|
||||
}
|
||||
|
||||
impl Client {
|
||||
pub fn new(options: ClientOptions, override_resolver: OverrideResolver) -> Client {
|
||||
pub fn new(upstream_urls: Vec<String>, override_resolver: OverrideResolver) -> Client {
|
||||
Client {
|
||||
options,
|
||||
upstream_urls,
|
||||
cache: DnsCache::new(),
|
||||
override_resolver,
|
||||
}
|
||||
|
@ -78,8 +74,8 @@ impl Client {
|
|||
|
||||
// Select an upstream randomly
|
||||
fn select_upstream(&self) -> String {
|
||||
let idx = crate::util::random_range(0, self.options.upstream_urls.len() as u16);
|
||||
self.options.upstream_urls[idx as usize].clone()
|
||||
let idx = crate::util::random_range(0, self.upstream_urls.len() as u16);
|
||||
self.upstream_urls[idx as usize].clone()
|
||||
}
|
||||
|
||||
// Build UDP wireformat query from a list of questions
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::client::*;
|
||||
use crate::client::Client;
|
||||
use crate::r#override::OverrideResolver;
|
||||
use async_static::async_static;
|
||||
use domain::base::iana::{Opcode, Rcode};
|
||||
|
@ -60,9 +60,7 @@ impl Server {
|
|||
fn new(options: ServerOptions) -> Server {
|
||||
Server {
|
||||
client: Client::new(
|
||||
ClientOptions {
|
||||
upstream_urls: options.upstream_urls.clone(),
|
||||
},
|
||||
options.upstream_urls.clone(),
|
||||
OverrideResolver::new(options.overrides.clone(), options.override_ttl),
|
||||
),
|
||||
options,
|
||||
|
|
Loading…
Reference in New Issue