@@ -2,7 +2,9 @@ use std::{collections::HashSet, io, ops::Range, path::PathBuf};
22
33use bao_tree:: ChunkRanges ;
44use bytes:: Bytes ;
5- use iroh:: { discovery:: static_provider:: StaticProvider , protocol:: Router , Endpoint , EndpointId } ;
5+ use iroh:: {
6+ discovery:: static_provider:: StaticProvider , protocol:: Router , Endpoint , EndpointId , RelayMode ,
7+ } ;
68use irpc:: RpcMessage ;
79use n0_future:: { task:: AbortOnDropHandle , StreamExt } ;
810use tempfile:: TempDir ;
@@ -500,7 +502,10 @@ pub async fn node_test_setup_with_events_fs(
500502) -> TestResult < ( Router , FsStore , PathBuf , StaticProvider ) > {
501503 let store = crate :: store:: fs:: FsStore :: load ( & db_path) . await ?;
502504 let sp = StaticProvider :: new ( ) ;
503- let ep = Endpoint :: builder ( ) . discovery ( sp. clone ( ) ) . bind ( ) . await ?;
505+ let ep = Endpoint :: empty_builder ( RelayMode :: Default )
506+ . discovery ( sp. clone ( ) )
507+ . bind ( )
508+ . await ?;
504509 let blobs = BlobsProtocol :: new ( & store, Some ( events) ) ;
505510 let router = Router :: builder ( ep) . accept ( crate :: ALPN , blobs) . spawn ( ) ;
506511 Ok ( ( router, store, db_path, sp) )
@@ -515,7 +520,10 @@ pub async fn node_test_setup_with_events_mem(
515520) -> TestResult < ( Router , MemStore , StaticProvider ) > {
516521 let store = MemStore :: new ( ) ;
517522 let sp = StaticProvider :: new ( ) ;
518- let ep = Endpoint :: builder ( ) . discovery ( sp. clone ( ) ) . bind ( ) . await ?;
523+ let ep = Endpoint :: empty_builder ( RelayMode :: Default )
524+ . discovery ( sp. clone ( ) )
525+ . bind ( )
526+ . await ?;
519527 let blobs = BlobsProtocol :: new ( & store, Some ( events) ) ;
520528 let router = Router :: builder ( ep) . accept ( crate :: ALPN , blobs) . spawn ( ) ;
521529 Ok ( ( router, store, sp) )
@@ -612,14 +620,14 @@ async fn node_serve_hash_seq() -> TestResult<()> {
612620 let hash_seq = tts. iter ( ) . map ( |x| x. hash ) . collect :: < HashSeq > ( ) ;
613621 let root_tt = store. add_bytes ( hash_seq) . await ?;
614622 let root = root_tt. hash ;
615- let endpoint = Endpoint :: builder ( ) . bind ( ) . await ?;
623+ let endpoint = Endpoint :: bind ( ) . await ?;
616624 let blobs = crate :: net_protocol:: BlobsProtocol :: new ( & store, None ) ;
617625 let r1 = Router :: builder ( endpoint)
618626 . accept ( crate :: protocol:: ALPN , blobs)
619627 . spawn ( ) ;
620628 let addr1 = r1. endpoint ( ) . addr ( ) ;
621629 info ! ( "node addr: {addr1:?}" ) ;
622- let endpoint2 = Endpoint :: builder ( ) . bind ( ) . await ?;
630+ let endpoint2 = Endpoint :: bind ( ) . await ?;
623631 let conn = endpoint2. connect ( addr1, crate :: protocol:: ALPN ) . await ?;
624632 let ( hs, sizes) = get:: request:: get_hash_seq_and_sizes ( & conn, & root, 1024 , None ) . await ?;
625633 println ! ( "hash seq: {hs:?}" ) ;
@@ -643,14 +651,14 @@ async fn node_serve_blobs() -> TestResult<()> {
643651 for size in sizes {
644652 tts. push ( store. add_bytes ( test_data ( size) ) . await ?) ;
645653 }
646- let endpoint = Endpoint :: builder ( ) . bind ( ) . await ?;
654+ let endpoint = Endpoint :: bind ( ) . await ?;
647655 let blobs = crate :: net_protocol:: BlobsProtocol :: new ( & store, None ) ;
648656 let r1 = Router :: builder ( endpoint)
649657 . accept ( crate :: protocol:: ALPN , blobs)
650658 . spawn ( ) ;
651659 let addr1 = r1. endpoint ( ) . addr ( ) ;
652660 info ! ( "node addr: {addr1:?}" ) ;
653- let endpoint2 = Endpoint :: builder ( ) . bind ( ) . await ?;
661+ let endpoint2 = Endpoint :: bind ( ) . await ?;
654662 let conn = endpoint2. connect ( addr1, crate :: protocol:: ALPN ) . await ?;
655663 for size in sizes {
656664 let expected = test_data ( size) ;
@@ -683,14 +691,14 @@ async fn node_smoke_mem() -> TestResult<()> {
683691async fn node_smoke ( store : & Store ) -> TestResult < ( ) > {
684692 let tt = store. add_bytes ( b"hello world" . to_vec ( ) ) . temp_tag ( ) . await ?;
685693 let hash = tt. hash ( ) ;
686- let endpoint = Endpoint :: builder ( ) . bind ( ) . await ?;
694+ let endpoint = Endpoint :: bind ( ) . await ?;
687695 let blobs = crate :: net_protocol:: BlobsProtocol :: new ( store, None ) ;
688696 let r1 = Router :: builder ( endpoint)
689697 . accept ( crate :: protocol:: ALPN , blobs)
690698 . spawn ( ) ;
691699 let addr1 = r1. endpoint ( ) . addr ( ) ;
692700 info ! ( "node addr: {addr1:?}" ) ;
693- let endpoint2 = Endpoint :: builder ( ) . bind ( ) . await ?;
701+ let endpoint2 = Endpoint :: bind ( ) . await ?;
694702 let conn = endpoint2. connect ( addr1, crate :: protocol:: ALPN ) . await ?;
695703 let ( size, stats) = get:: request:: get_unverified_size ( & conn, & hash) . await ?;
696704 info ! ( "size: {} stats: {:?}" , size, stats) ;
0 commit comments