Skip to content

Commit ef17630

Browse files
hatooclaude
andcommitted
drop termux resolv.conf handling
hickory-resolver 0.26 removed `parse_resolv_conf` on Android, so the termux-specific path can no longer be supported via hickory. Fall back to plain `read_system_conf` on all platforms. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8cbe96b commit ef17630

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use rand_regex::Regex;
1414
use ratatui::crossterm;
1515
use result_data::ResultData;
1616
use std::{
17-
env,
1817
fs::File,
1918
io::{BufRead, BufReader, Read},
2019
path::{Path, PathBuf},
@@ -890,21 +889,9 @@ pub async fn run(mut opts: Opts) -> anyhow::Result<()> {
890889
}
891890

892891
pub(crate) fn system_resolv_conf() -> anyhow::Result<(ResolverConfig, ResolverOpts)> {
893-
// check if we are running in termux https://github.com/termux/termux-app
894-
// `parse_resolv_conf` in hickory 0.26 is only available on non-Apple/non-Android Unix.
895-
#[cfg(all(unix, not(any(target_os = "android", target_vendor = "apple"))))]
896-
if env::var("TERMUX_VERSION").is_ok() {
897-
let prefix = env::var("PREFIX")?;
898-
let path = format!("{prefix}/etc/resolv.conf");
899-
return match std::fs::read(&path) {
900-
Ok(conf_data) => hickory_resolver::system_conf::parse_resolv_conf(conf_data)
901-
.context(format!("DNS: failed to parse {path}")),
902-
Err(err) => {
903-
fallback_resolver_config(anyhow::anyhow!("DNS: failed to load {path}: {err}"))
904-
}
905-
};
906-
}
907-
892+
// Termux (https://github.com/termux/termux-app) is no longer supported:
893+
// hickory-resolver 0.26 removed `parse_resolv_conf` on Android, so we can
894+
// no longer read `$PREFIX/etc/resolv.conf` via hickory.
908895
match hickory_resolver::system_conf::read_system_conf() {
909896
Ok(conf) => Ok(conf),
910897
Err(err) => fallback_resolver_config(anyhow::anyhow!(

0 commit comments

Comments
 (0)