Skip to content

Commit

Permalink
chore(deps): Update to latest released iroh crate
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Dec 11, 2024
1 parent 77222ae commit 858f583
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion h3-iroh/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ http-body = { version = "1", optional = true }
http-body-util = { version = "0.1", optional = true }
hyper = { version = "1.5", optional = true }
hyper-util = { version = "0.1", optional = true }
iroh-net = { git = "http://github.com/n0-computer/iroh/", branch = "main" }
iroh = "0.29"
tokio = { version = "1", features = ["io-util"], default-features = false}
tokio-util = "0.7"
tower = { version = "0.5", optional = true }
Expand Down
8 changes: 4 additions & 4 deletions h3-iroh/examples/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::str::FromStr;

use anyhow::{bail, Context, Result};
use clap::Parser;
use iroh_net::ticket::NodeTicket;
use iroh_net::NodeAddr;
use iroh::ticket::NodeTicket;
use iroh::NodeAddr;
use tokio::io::AsyncWriteExt;
use tracing::info;

Expand All @@ -31,7 +31,7 @@ async fn main() -> Result<()> {
let ticket = NodeTicket::from_str(ticket)?;
let addr: NodeAddr = ticket.into();

let ep = iroh_net::Endpoint::builder()
let ep = iroh::Endpoint::builder()
.keylog(args.keylogfile)
.bind()
.await?;
Expand Down Expand Up @@ -75,7 +75,7 @@ async fn main() -> Result<()> {
drive_res?;

info!("closing ep");
ep.close(1u8.into(), b"ep closing").await?;
ep.close().await?;
info!("ep closed");

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions h3-iroh/examples/server-axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use axum::response::Html;
use axum::routing::get;
use axum::Router;
use futures::StreamExt;
use iroh_net::ticket::NodeTicket;
use iroh::ticket::NodeTicket;
use tracing::info;

#[tokio::main]
Expand All @@ -16,7 +16,7 @@ async fn main() -> Result<()> {

let app = Router::new().route("/", get(handler));

let ep = iroh_net::Endpoint::builder()
let ep = iroh::Endpoint::builder()
.alpns(vec![b"iroh+h3".to_vec()])
.bind()
.await?;
Expand Down
8 changes: 4 additions & 4 deletions h3-iroh/examples/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use h3::error::ErrorLevel;
use h3::quic::BidiStream;
use h3::server::RequestStream;
use http::{Request, StatusCode};
use iroh_net::endpoint::{self, Incoming};
use iroh_net::ticket::NodeTicket;
use iroh::endpoint::{self, Incoming};
use iroh::ticket::NodeTicket;
use tokio::fs::File;
use tokio::io::AsyncReadExt;
use tracing::{debug, error, field, info, info_span, Instrument, Span};
Expand Down Expand Up @@ -48,7 +48,7 @@ async fn main() -> Result<()> {
Arc::new(None)
};

let ep = iroh_net::Endpoint::builder()
let ep = iroh::Endpoint::builder()
.alpns(vec![b"iroh+h3".to_vec()])
.bind()
.await?;
Expand All @@ -73,7 +73,7 @@ async fn main() -> Result<()> {
.instrument(info_span!("conn", remote_node_id = field::Empty))
});
}
ep.close(1u8.into(), b"ep closing").await?;
ep.close().await?;

Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions h3-iroh/src/axum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::Result;
use axum::Router;
use bytes::{Buf, Bytes};
use http::{Request, Response, Version};
use iroh_net::Endpoint;
use iroh::Endpoint;
use tracing::{debug, error, info_span, trace, warn, Instrument};

use h3::{error::ErrorLevel, quic::BidiStream, server::RequestStream};
Expand All @@ -31,11 +31,11 @@ pub async fn serve(endpoint: Endpoint, router: axum::Router) -> Result<()> {
.instrument(info_span!("h3-connection")),
);
}
endpoint.close(0u8.into(), b"server exiting").await?;
endpoint.close().await?;
Ok(())
}

async fn handle_connection(incoming: iroh_net::endpoint::Incoming, router: Router) -> Result<()> {
async fn handle_connection(incoming: iroh::endpoint::Incoming, router: Router) -> Result<()> {
debug!("new connection established");
let conn = incoming.await?;
let conn = crate::Connection::new(conn);
Expand Down
8 changes: 4 additions & 4 deletions h3-iroh/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ use bytes::{Buf, Bytes, BytesMut};
use futures::{ready, stream, Stream, StreamExt};
use h3::ext::Datagram;
use h3::quic::{self, Error, StreamId, WriteBuf};
use iroh_net::endpoint::{self, ApplicationClose, ClosedStream, ReadDatagram};
use iroh::endpoint::{self, ApplicationClose, ClosedStream, ReadDatagram};
use tokio_util::sync::ReusableBoxFuture;
use tracing::instrument;

pub use iroh_net::endpoint::{AcceptBi, AcceptUni, Endpoint, OpenBi, OpenUni, VarInt, WriteError};
pub use iroh::endpoint::{AcceptBi, AcceptUni, Endpoint, OpenBi, OpenUni, VarInt, WriteError};

#[cfg(feature = "axum")]
pub mod axum;
Expand All @@ -30,7 +30,7 @@ type BoxStreamSync<'a, T> = Pin<Box<dyn Stream<Item = T> + Sync + Send + 'a>>;
///
/// Implements a [`quic::Connection`] backed by a [`endpoint::Connection`].
pub struct Connection {
conn: iroh_net::endpoint::Connection,
conn: iroh::endpoint::Connection,
incoming_bi: BoxStreamSync<'static, <AcceptBi<'static> as Future>::Output>,
opening_bi: Option<BoxStreamSync<'static, <OpenBi<'static> as Future>::Output>>,
incoming_uni: BoxStreamSync<'static, <AcceptUni<'static> as Future>::Output>,
Expand All @@ -40,7 +40,7 @@ pub struct Connection {

impl Connection {
/// Create a [`Connection`] from a [`endpoint::Connection`]
pub fn new(conn: iroh_net::endpoint::Connection) -> Self {
pub fn new(conn: iroh::endpoint::Connection) -> Self {
Self {
conn: conn.clone(),
incoming_bi: Box::pin(stream::unfold(conn.clone(), |conn| async {
Expand Down

0 comments on commit 858f583

Please sign in to comment.