Q2YTDYKLSHITWAY5RNXWDWHZTOQG4JQSVF4BQAPFAIS3LSPOEKNAC
23WYPLCLKYBCCDRXA4GCYETSMTTMQO4QABH4GFLJRWVGGBEMOMMAC
4NIOFTQTOZU6AD3O4TSVE7TJWQMBTNVEYTJ3AVSPPGGDBPRMP67AC
CHTEJVPDN5R2SQTOCK3SNAME5V5XCB6TRGRBCY55DJ3UQJ73QG6AC
VJWQP4DXJRA4UJRYBWIRFT5T76ZO6KE2IQCLAO5EAXWOZH2LRAVQC
NJJQVY7HLGSS3EHEWFUDZQ2FDZOSC3ZONE4IKGPHER26SDLCEM7QC
UKVJ7HJMKO4XDQGIUFPCFZASXFL2FRPXE5LU72YJYB3Q6WMMYYOAC
async fn main() {
let r = StubResolver::from_conf(ResolvConf {
servers: vec![ServerConf::new(
"1.1.1.1:53".parse().unwrap(),
Transport::Udp,
)],
options: ResolvOptions::default(),
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let args = parse_args()?;
let q = naughty_question(args.rtype);
let server = args.server;
let mut server = ServerConf::new(format!("{server}:53").parse().unwrap(), Transport::Udp);
server.request_timeout = core::time::Duration::from_millis(100);
let options = ResolvOptions {
attempts: 0,
..Default::default()
};
let resolv = StubResolver::from_conf(ResolvConf {
servers: vec![server],
options,
let a = r.lookup_host(Dname::vec_from_str("example.com.").unwrap(/*valid */)).await.unwrap(/*nothing */);
for n in a.iter() {
dbg!(n);
assert!(resolv.query(q).await.is_err());
Ok(())
}
fn naughty_question(rtype: Rtype) -> Question<Dname<Vec<u8>>> {
let name = Dname::vec_from_str("example.").unwrap();
let mut bytes = name.into_octets();
bytes.push(0);
Question::new_in(
// Safety: I want to do it wrong
unsafe { Dname::from_octets_unchecked(bytes) },
rtype,
)
}
fn parse_args() -> Result<Args, lexopt::Error> {
use lexopt::prelude::*;
let mut server = "1.1.1.3".into();
let mut rtype = Rtype::A;
let mut parser = lexopt::Parser::from_env();
while let Some(arg) = parser.next()? {
match arg {
Long("help") => {
println!("Usage: wrong-dns [-s|--server=SERVER|@SERVER] RTYPE");
std::process::exit(0);
}
Value(val) => {
let val = val.into_string()?;
if val.starts_with('@') {
server = val[1..].into();
} else {
rtype = val.parse().unwrap();
}
}
Short('s') | Long("server") => {
server = parser.value()?.into_string()?;
}
_ => return Err(arg.unexpected()),
}
'(ansible lsp-mode rustic markdown-mode markdownfmt mermaid-mode tree-sitter-langs json-mode eglot rust-mode go-mode jinja2-mode dockerfile-mode company-shell groovy-mode rainbow-delimiters yaml-mode modus-themes magit-delta use-package))
'(
ansible
company-ansible
company-mode
company-shell
dockerfile-mode
eglot
go-mode
groovy-mode
jinja2-mode
magit
magit-delta
markdown-mode
markdownfmt
mermaid-mode
modus-themes
rainbow-delimiters
rustic
tree-sitter-langs
use-package
yaml-mode
))
("C-c C-c a" . lsp-execute-code-action)
("C-c C-c r" . lsp-rename)
("C-c C-c q" . lsp-workspace-restart)
("C-c C-c Q" . lsp-workspace-shutdown)
("C-c C-c s" . lsp-rust-analyzer-status))
;; ("C-c C-c a" . lsp-execute-code-action)
;; ("C-c C-c r" . lsp-rename)
;; ("C-c C-c q" . lsp-workspace-restart)
;; ("C-c C-c Q" . lsp-workspace-shutdown)
;; ("C-c C-c s" . lsp-rust-analyzer-status))
)