Skip to content

Commit a911e54

Browse files
committed
Resolve direct domains with direct DNS servers
1 parent d82a54e commit a911e54

7 files changed

Lines changed: 254 additions & 112 deletions

File tree

leaf/src/app/dispatcher.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ fn log_request(sess: &Session, outbound_tag: &str, handshake_time: Option<u128>)
129129
}
130130

131131
pub struct Dispatcher {
132-
outbound_manager: Arc<RwLock<OutboundManager>>,
133-
router: Arc<RwLock<Router>>,
132+
pub(crate) outbound_manager: Arc<RwLock<OutboundManager>>,
133+
pub(crate) router: Arc<RwLock<Router>>,
134134
dns_client: SyncDnsClient,
135135
stat_manager: SyncStatManager,
136136
dns_sniffer: DnsSniffer,
@@ -448,4 +448,12 @@ impl Dispatcher {
448448
}
449449
}
450450
}
451+
452+
pub async fn is_direct_outbound(&self, tag: &str) -> bool {
453+
if let Some(h) = self.outbound_manager.read().await.get(tag) {
454+
h.is_direct()
455+
} else {
456+
false
457+
}
458+
}
451459
}

0 commit comments

Comments
 (0)