Skip to content

Commit

Permalink
chore: doclinks and clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Frando committed Apr 10, 2024
1 parent ea8ef72 commit da3630d
Showing 6 changed files with 19 additions and 26 deletions.
4 changes: 2 additions & 2 deletions iroh-dns-server/examples/publish.rs
Original file line number Diff line number Diff line change
@@ -71,11 +71,11 @@ async fn main() -> Result<()> {

println!("announce {node_id}:");
println!(" relay={}", args.relay_url);
println!("");
println!();
println!("publish to {pkarr_relay} ...");

let pkarr = PkarrRelayClient::new(pkarr_relay);
let node_info = NodeInfo::new(node_id, Some(args.relay_url.into()));
let node_info = NodeInfo::new(node_id, Some(args.relay_url));
let signed_packet = node_info.to_pkarr_signed_packet(&secret_key, 30)?;
pkarr.publish(&signed_packet).await?;

6 changes: 3 additions & 3 deletions iroh-dns-server/src/http/doh.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! DNS over HTTPS
//!
//! Mostly copied from
//! https://github.com/fission-codes/fission-server/blob/main/fission-server/src/routes/doh.rs
// This module is mostly copied from
// https://github.com/fission-codes/fission-server/blob/main/fission-server/src/routes/doh.rs

use anyhow::anyhow;
use axum::{
8 changes: 4 additions & 4 deletions iroh-dns-server/src/http/doh/extract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Extractors for DNS-over-HTTPS requests
//!
//! Copied from
//! https://github.com/fission-codes/fission-server/blob/394de877fad021260c69fdb1edd7bb4b2f98108c/fission-server/src/extract/doh.rs
// This module is mostly copied from
// https://github.com/fission-codes/fission-server/blob/394de877fad021260c69fdb1edd7bb4b2f98108c/fission-server/src/extract/doh.rs

use async_trait::async_trait;
use axum::{
@@ -61,7 +61,7 @@ struct DnsMessageQuery {
dns: String,
}

/// See: https://developers.google.com/speed/public-dns/docs/doh/json#supported_parameters
// See: https://developers.google.com/speed/public-dns/docs/doh/json#supported_parameters
#[derive(Debug, Deserialize)]
pub struct DnsQuery {
/// Record name to look up, e.g. example.com
10 changes: 5 additions & 5 deletions iroh-dns-server/src/http/doh/response.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
//! DNS Response
//!
//! Copied from
//! https://github.com/fission-codes/fission-server/blob/394de877fad021260c69fdb1edd7bb4b2f98108c/fission-core/src/dns.rs
// This module is mostly copied from
// https://github.com/fission-codes/fission-server/blob/394de877fad021260c69fdb1edd7bb4b2f98108c/fission-core/src/dns.rs

use anyhow::{anyhow, ensure, Result};
use hickory_proto as proto;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize)]
/// JSON representation of a DNS response
/// See: https://developers.google.com/speed/public-dns/docs/doh/json
/// See: <https://developers.google.com/speed/public-dns/docs/doh/json>
pub struct DnsResponse {
/// Standard DNS response code
#[serde(rename = "Status")]
@@ -40,7 +40,7 @@ pub struct DnsResponse {
#[serde(rename = "Comment")]
pub comment: Option<String>,
/// IP Address / scope prefix-length of the client
/// See: https://tools.ietf.org/html/rfc7871
/// See: <https://tools.ietf.org/html/rfc7871>
pub edns_client_subnet: Option<String>,
}

2 changes: 1 addition & 1 deletion iroh-dns-server/src/http/tls.rs
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ pub enum CertMode {

impl CertMode {
/// Build the [`TlsAcceptor`] for this mode.
pub async fn build(
pub(crate) async fn build(
&self,
domains: Vec<String>,
cert_cache: PathBuf,
15 changes: 4 additions & 11 deletions iroh-dns-server/src/lib.rs
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ mod tests {
async fn integration_smoke() -> Result<()> {
tracing_subscriber::fmt::init();
let (server, nameserver, http_url) = Server::spawn_for_tests().await?;
println!("server spawned {nameserver} {http_url}");

let pkarr_relay = {
let mut url = http_url.clone();
@@ -53,19 +52,13 @@ mod tests {
let node_info = NodeInfo::new(node_id, Some(relay_url.clone()));
let signed_packet = node_info.to_pkarr_signed_packet(&secret_key, 30)?;

println!("now publish");
pkarr.publish(&signed_packet).await?;
println!("published");

let resolver = test_resolver(nameserver);
println!("now resolve");
let resolved = lookup_by_id(&resolver, &node_id, origin).await?;
println!("resolved {resolved:?}");
assert_eq!(resolved.node_id, node_id);
assert_eq!(
resolved.info.relay_url.map(|u| Url::from(u)),
Some(relay_url)
);
let res = lookup_by_id(&resolver, &node_id, origin).await?;

assert_eq!(res.node_id, node_id);
assert_eq!(res.info.relay_url.map(Url::from), Some(relay_url));

server.shutdown().await?;
Ok(())

0 comments on commit da3630d

Please sign in to comment.