add new function to Connector to allow for custom resolver
@@ -49,6 +49,7 @@ use tokio_timer::Delay;
use trust_dns_resolver::config::{ResolverConfig, ResolverOpts};
use trust_dns_resolver::lookup_ip::LookupIpFuture;
use trust_dns_resolver::ResolverFuture;
+use trust_dns_resolver::error::ResolveError;
use prelude::*;
@@ -145,6 +146,17 @@ pub struct Connector {
resolver: Option<ResolverFuture>,
}
+impl Connector {
+ pub fn new(config: ResolverConfig, options: ResolverOpts) -> Result<Connector, ResolveError> {
+ Ok(Connector{
+ resolver: Some(ResolverFuture::new(
+ config,
+ options,
+ ).wait()?)
+ })
+ }
+}
+
impl Actor for Connector {
type Context = Context<Self>;
