File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -17,4 +17,6 @@ clap = "2.32"
17
17
lazy_static = " 1.4"
18
18
ajson = " 0.2"
19
19
async-std = { version = " 1.5" , features = [" std" ], default-features = false }
20
+
21
+ [target .'cfg(not(windows))' .dependencies ]
20
22
rlimit = " 0.3"
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ use tokio_io_timeout::TimeoutReader;
18
18
19
19
use async_std:: sync:: { Arc , RwLock } ;
20
20
use clap:: { value_t, Arg } ;
21
- use rlimit;
22
21
use std:: collections:: HashMap ;
23
22
use twoway:: find_bytes;
24
23
extern crate ajson;
@@ -27,6 +26,9 @@ extern crate lazy_static;
27
26
#[ macro_use]
28
27
extern crate clap;
29
28
29
+ #[ cfg( not( windows) ) ]
30
+ use rlimit;
31
+
30
32
type HttpClient = Client < hyper:: client:: HttpConnector > ;
31
33
type HttpsClient = Client < HttpsConnector < hyper:: client:: HttpConnector > > ;
32
34
static mut DOH_ENDPOINT : & ' static str = "https://1.1.1.1/dns-query" ;
@@ -149,7 +151,10 @@ async fn main() {
149
151
} ) )
150
152
}
151
153
} ) ;
154
+
155
+ #[ cfg( not( windows) ) ]
152
156
set_max_rlimit_nofile ( ) ;
157
+
153
158
let server = Server :: bind ( & SocketAddr :: from ( (
154
159
[ 127 , 0 , 0 , 1 ] ,
155
160
value_t ! ( matches, "port" , u16 ) . unwrap ( ) ,
@@ -373,6 +378,7 @@ where
373
378
}
374
379
}
375
380
381
+ #[ cfg( not( windows) ) ]
376
382
fn set_max_rlimit_nofile ( ) {
377
383
if rlimit:: Resource :: NOFILE
378
384
. set ( rlimit:: RLIM_INFINITY , rlimit:: RLIM_INFINITY )
You can’t perform that action at this time.
0 commit comments