diff --git a/Cargo.lock b/Cargo.lock index e865bd7c..47ee8c45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1533,6 +1533,7 @@ dependencies = [ "futures", "httparse", "iced", + "num_cpus", "parking_lot 0.12.4", "plotters", "plotters-iced", diff --git a/emissary-cli/Cargo.toml b/emissary-cli/Cargo.toml index e7d48d54..d728427c 100644 --- a/emissary-cli/Cargo.toml +++ b/emissary-cli/Cargo.toml @@ -26,6 +26,7 @@ thiserror = "2.0.12" tokio-tungstenite = { version = "0.27.0", default-features = false, features = ["native-tls"], optional = true } url = "2.5.4" base64 = "0.21" +num_cpus = "1.16" # workspace dependencies anyhow = { workspace = true } diff --git a/emissary-cli/assets/index.html b/emissary-cli/assets/index.html index 3736897a..f16a916f 100644 --- a/emissary-cli/assets/index.html +++ b/emissary-cli/assets/index.html @@ -169,7 +169,7 @@

Client destinations

data.server_destinations.forEach(([key, value]) => { const div = document.createElement("div"); - div.textContent = `${key}: http://${value}.b32.i2p`; + div.textContent = `${key}: http://${value}.b32.echo`; destContainer.appendChild(div); }); } diff --git a/emissary-cli/src/address_book.rs b/emissary-cli/src/address_book.rs index b01a51d5..1e750cc3 100644 --- a/emissary-cli/src/address_book.rs +++ b/emissary-cli/src/address_book.rs @@ -286,8 +286,8 @@ impl AddressBookManager { } } - // save hosts to disk at this point as subscriptions might contain .i2p addresses - // which the http proxy must be able to resolve to .b32.i2p addresses + // save hosts to disk at this point as subscriptions might contain .echo addresses + // which the http proxy must be able to resolve to .b32.echo addresses self.save_to_disk(addresses.clone()).await; for subscription in &self.subscriptions { @@ -313,7 +313,7 @@ impl AddressBookManager { /// Save `addresses` to disk. /// - /// Parses each destination in `addresses` into its .b32.i2p address, stores all .b32.i2p + /// Parses each destination in `addresses` into its .b32.echo address, stores all .b32.echo /// addresses along with their hostnames into a file and stores all .Base64-encoded destinations /// into a separate directory where each destination is indexed by their hostname. async fn save_to_disk(&self, addresses: HashMap) { @@ -525,7 +525,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let hosts = "tracker2.postman.echo=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ J50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqle\ E16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1\ umYKpur3G~FxBuqtHAsDRICrsRuil8qK~whOvj8uNTv~ohZnTZHxTLgi~sDyo98BwJ-4Y4NMSuF4GLzcgLypcR1D1WY2tDqMKRYFVyLE~MTPVjRRgXfc\ @@ -540,12 +540,12 @@ mod tests { PUlGlh9yIfBY40CQ0Ermy8gzjHLayUpypDJFv2V6rHLwxAQeaXJu8YXbyvCucEu9i6HVO49akXW9YSxcZEqxK04wZnjBqhHGlVbehleMqTx9nkd0pUpB\ Zz~vIaG9matUSHinopEo6Wegml9FEz~FEaQpPknKuMAGGSNFVJb0NtaOQSAocAOg1nLKh80v232Y8sJOHG63asSJoBa6bGwjIHftsqD~lEmVV4NkgNPy\ bmvsD1SCbMQ2ExaCXFPVQV-yJhIAPN9MRVT9cSBT2GCq-vpMwdJ5Nf0iPR3M-Ak961JUwWXPYTL79toXCgxDX2~nZ5QFRV490YNnfB7LQu10G89wG8lz\ - S9GWf2i-nk~~ez0Lq0dH7qQokFXdUkPc7bvSrxqkytrbd-h8O8AAAA\nzerobin.i2p=Jf64hlpW8ILKZGDe61ljHU5wzmUYwN2klOyhM2iR-8VkUEVg\ + S9GWf2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Iq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpn\ @@ -558,7 +558,7 @@ mod tests { .collect::>(); assert_eq!( - addresses.get(&String::from("tracker2.postman.i2p")), + addresses.get(&String::from("tracker2.postman.echo")), Some(&String::from( "lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDaJ50lUZg\ VPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaT\ @@ -571,7 +571,7 @@ mod tests { ); assert_eq!( - addresses.get(&String::from("psi.i2p")), + addresses.get(&String::from("psi.echo")), Some( &String::from( "a11l91etedRW5Kl2GhdDI9qiRBbDRAQY6TWJb8KlSc0P9WUrEviABAAltqDU1DFJrRhMAZg5i6rWGszkJrF-pWLQK9JOH3\ @@ -585,7 +585,7 @@ mod tests { ); assert_eq!( - addresses.get(&String::from("zerobin.i2p")), + addresses.get(&String::from("zerobin.echo")), Some( &String::from( "Jf64hlpW8ILKZGDe61ljHU5wzmUYwN2klOyhM2iR-8VkUEVgDZRuaToRlXIFW4k5J1ccTzGzMxR518BkCAE3jCFIyrbF0Mj\ @@ -599,7 +599,7 @@ mod tests { ); assert_eq!( - addresses.get(&String::from("zzz.i2p")), + addresses.get(&String::from("zzz.echo")), Some( &String::from( "GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~\ @@ -630,7 +630,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let h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_book.handle(); // try to find base32 address and base64-encoded destination of a saved destination - let host = handle.resolve_base32("zzz.i2p").expect("to find base32 address for zzz.i2p"); + let host = handle.resolve_base32("zzz.echo").expect("to find base32 address for zzz.echo"); assert_eq!( host, "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua".to_string() ); let destination = handle - .resolve_base64("zzz.i2p".to_string()) + .resolve_base64("zzz.echo".to_string()) .await - .expect("expected to find destination for zzz.i2p"); + .expect("expected to find destination for zzz.echo"); assert_eq!(destination, "GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dmXl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpne8cuesn3NDXIpNnqEE6Oe5Qm5YOJykrX~Vx~cFFT3QzDGkIjjxlFBsjUJyYkFjBQAEAAcAAA=="); // attempt to find base32 address for an unknown hostname - assert!(handle.resolve_base32("test.i2p").is_none()); - assert!(handle.resolve_base64("test.i2p".to_string()).await.is_none()); + assert!(handle.resolve_base32("test.echo").is_none()); + assert!(handle.resolve_base64("test.echo".to_string()).await.is_none()); } #[tokio::test] @@ -706,7 +706,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczN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zASqTOOlNzdpn\ @@ -737,9 +737,9 @@ mod tests { // verify all base64 destinations have been saved under correct keys for (key, (_, value)) in addresses { - let key = key.strip_suffix(".i2p").unwrap(); + let key = key.strip_suffix(".echo").unwrap(); - let path = dir.join("addressbook/destinations").join(format!("{key}.i2p.txt")); + let path = dir.join("addressbook/destinations").join(format!("{key}.echo.txt")); assert_eq!(std::fs::read_to_string(&path).unwrap(), value); } @@ -747,19 +747,19 @@ mod tests { let content = std::fs::read_to_string(dir.join("addressbook/addresses")).unwrap(); let mut expected = HashMap::<&str, &str>::from_iter([ ( - "psi.i2p", + "psi.echo", "avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a", ), ( - "zerobin.i2p", + "zerobin.echo", "3564erslxzaoucqasxsjerk4jz2xril7j2cbzd4p7flpb4ut67hq", ), ( - "tracker2.postman.i2p", + "tracker2.postman.echo", "6a4kxkg5wp33p25qqhgwl6sj4yh4xuf5b3p3qldwgclebchm3eea", ), ( - "zzz.i2p", + "zzz.echo", "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua", ), ]); @@ -789,7 +789,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let hosts = "tracker2.postman.echo=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ J50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqle\ E16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD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nGKPEBD31hVLd\ JuVId9RND7lQy5BZJHQss5HSxMWTszAnWJDwmxqzMHHCiL6BMpZnkz8znwPDSkUwEs3P6-ba7mDKKt8EPCG0nM6l~BvPl2OKQIBhXIxJLOOavGyqmmYm\ - AAAA\nzzz.i2p=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ + AAAA\nzzz.echo=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ Xl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2\ pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6\ Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpn\ @@ -836,7 +836,7 @@ mod tests { let handle = address_book.handle(); // verify all hosts are found - for host in ["psi.i2p", "zerobin.i2p", "tracker2.postman.i2p", "zzz.i2p"] { + for host in ["psi.echo", "zerobin.echo", "tracker2.postman.echo", "zzz.echo"] { assert!(handle.resolve_base32(host).is_some()); assert!(handle.resolve_base64(host.to_string()).await.is_some()); } @@ -845,19 +845,19 @@ mod tests { // // verify that the new destinations are stored on disk, theb base32 address book is // updated and that `AddressBookHandle` has the new base32 addresses - let new_hosts = "echo.idk.i2p=75Mgd8DeYkNAdk6mrF0rOt3WuM6bYi3k7n3BRIp-np5-5-py1YTmBJSRq9E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Zxgqu4sN6MbPVaW2X7x3ldq3~UwG~HXvdvA7wP-sBq3uEshPCuVhJD8ojUD\ qm9prLIVuLWt2pIiVbz-l4P-jx769A0OoN8-Z6j5b7zLNdd~QX0NPfXVMp1V~Z4fFBQAEAAcAAA==\ngts.varikvalef\ - or.i2p=cqwoYXfztQTzDKaPMsElmgfflDLLRBBvQSTgHfhBKnGkT-lKzL659h480A9YQuZfmKSzaplidYTvMPIrS4lhh4\ + or.echo=cqwoYXfztQTzDKaPMsElmgfflDLLRBBvQSTgHfhBKnGkT-lKzL659h480A9YQuZfmKSzaplidYTvMPIrS4lhh4\ m7ybvkt3Dv9bLd8QR7k14gw~arshKakr6HgkpUXU8uwA6ns45bsLKe~PbASIGbPEIudRjtrvmRpXxqy~0mpjkXkhhm8RJ\ x3CM7iO62ZyspCXTI2GV2rbvcxyD6kEcQd-YrU5tnimSUN8b1WqbkoQBvEn1JR~mn-KJzR4RUpKd~FgqPesMI2rM8dyl4\ bQkHv3XrWU3YZ75bsXaht80Ii6rrcPrD3LCERIC43rII0Y1UQarpij2ZyC508ccveIbGroUWOsrPz8tLklnIuvZIor~2M\ @@ -870,13 +870,13 @@ mod tests { // verify all old and new hosts are found for host in [ - "psi.i2p", - "zerobin.i2p", - "tracker2.postman.i2p", - "zzz.i2p", - "echo.idk.i2p", - "3chelectricboogaloo.i2p", - "gts.varikvalefor.i2p", + "psi.echo", + "zerobin.echo", + "tracker2.postman.echo", + "zzz.echo", + "echo.idk.echo", + "3chelectricboogaloo.echo", + "gts.varikvalefor.echo", ] { assert!(handle.resolve_base32(host).is_some()); assert!(handle.resolve_base64(host.to_string()).await.is_some()); @@ -896,13 +896,13 @@ mod tests { let handle = address_book.handle(); for host in [ - "psi.i2p", - "zerobin.i2p", - "tracker2.postman.i2p", - "zzz.i2p", - "echo.idk.i2p", - "3chelectricboogaloo.i2p", - "gts.varikvalefor.i2p", + "psi.echo", + "zerobin.echo", + "tracker2.postman.echo", + "zzz.echo", + "echo.idk.echo", + "3chelectricboogaloo.echo", + "gts.varikvalefor.echo", ] { assert!(handle.resolve_base32(host).is_some()); assert!(handle.resolve_base64(host.to_string()).await.is_some()); @@ -927,7 +927,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let hosts = "tracker2.postman.echo=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ J50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqle\ E16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1\ umYKpur3G~FxBuqtHAsDRICrsRuil8qK~whOvj8uNTv~ohZnTZHxTLgi~sDyo98BwJ-4Y4NMSuF4GLzcgLypcR1D1WY2tDqMKRYFVyLE~MTPVjRRgXfc\ @@ -942,12 +942,12 @@ mod tests { PUlGlh9yIfBY40CQ0Ermy8gzjHLayUpypDJFv2V6rHLwxAQeaXJu8YXbyvCucEu9i6HVO49akXW9YSxcZEqxK04wZnjBqhHGlVbehleMqTx9nkd0pUpB\ Zz~vIaG9matUSHinopEo6Wegml9FEz~FEaQpPknKuMAGGSNFVJb0NtaOQSAocAOg1nLKh80v232Y8sJOHG63asSJoBa6bGwjIHftsqD~lEmVV4NkgNPy\ bmvsD1SCbMQ2ExaCXFPVQV-yJhIAPN9MRVT9cSBT2GCq-vpMwdJ5Nf0iPR3M-Ak961JUwWXPYTL79toXCgxDX2~nZ5QFRV490YNnfB7LQu10G89wG8lz\ - S9GWf2i-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ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6\ Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpn\ @@ -972,20 +972,20 @@ mod tests { let handle = address_book.handle(); handle.add_base32( - "i2pd.i2p".to_string(), + "i2pd.echo".to_string(), "4bpcp4fmvyr46vb4kqjvtxlst6puz4r3dld24umooiy5mesxzspa".to_string(), ); // verify that base32 address for i2pd is found assert_eq!( - handle.resolve_base32("i2pd.i2p"), + handle.resolve_base32("i2pd.echo"), Some(String::from( "4bpcp4fmvyr46vb4kqjvtxlst6puz4r3dld24umooiy5mesxzspa" )) ); } - // simulate another boot and verify i2pd.i2p has been stored on disk + // simulate another boot and verify i2pd.echo has been stored on disk let address_book = AddressBookManager::new( dir.clone(), AddressBookConfig { @@ -996,7 +996,7 @@ mod tests { .await; assert_eq!( - address_book.handle().resolve_base32("i2pd.i2p"), + address_book.handle().resolve_base32("i2pd.echo"), Some(String::from( "4bpcp4fmvyr46vb4kqjvtxlst6puz4r3dld24umooiy5mesxzspa" )) @@ -1020,7 +1020,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let hosts = "tracker2.postman.echo=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ J50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqle\ E16fI8CVFOV18j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PIn3IlMXHK5AKRVxAbCQ5GkS8KdkvNL7FsQ~EiElGzZId4wenraHMHL0destUDmuwGdHKA7YdtovXD~OnaBvIbl36iuIduZnGKPEBD31hVLd\ JuVId9RND7lQy5BZJHQss5HSxMWTszAnWJDwmxqzMHHCiL6BMpZnkz8znwPDSkUwEs3P6-ba7mDKKt8EPCG0nM6l~BvPl2OKQIBhXIxJLOOavGyqmmYm\ - AAAA\nzzz.i2p=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ + AAAA\nzzz.echo=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ Xl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2\ pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6\ Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpn\ @@ -1074,24 +1074,24 @@ mod tests { let deserialized = base64_decode(&base64_destination).unwrap(); let destination = Destination::parse(&deserialized).unwrap(); - handle.add_base64("echo.idk.i2p".to_string(), destination); + handle.add_base64("echo.idk.echo".to_string(), destination); // verify that base32 address for echo.idk is found assert_eq!( - handle.resolve_base32("echo.idk.i2p"), + handle.resolve_base32("echo.idk.echo"), Some(String::from( "63sgpiu6f33arldcxkbjsn3jgf6asyx3onjmz6j6gsk7hgbiehkq" )) ); assert_eq!( - handle.resolve_base64("echo.idk.i2p".to_string()).await, + handle.resolve_base64("echo.idk.echo".to_string()).await, Some(base64_destination.to_string()) ); base64_destination }; - // simulate another boot and verify i2pd.i2p has been stored on disk + // simulate another boot and verify i2pd.echo has been stored on disk let address_book = AddressBookManager::new( dir.clone(), AddressBookConfig { @@ -1103,20 +1103,20 @@ mod tests { let handle = address_book.handle(); assert_eq!( - handle.resolve_base32("echo.idk.i2p"), + handle.resolve_base32("echo.idk.echo"), Some(String::from( "63sgpiu6f33arldcxkbjsn3jgf6asyx3onjmz6j6gsk7hgbiehkq" )) ); assert_eq!( - handle.resolve_base64("echo.idk.i2p".to_string()).await, + handle.resolve_base64("echo.idk.echo".to_string()).await, Some(base64_destination.to_string()) ); } #[tokio::test] async fn remove_host() { - // create address book and remove zzz.i2p from it + // create address book and remove zzz.echo from it let dir = { let dir = tempdir().unwrap().keep(); tokio::fs::create_dir_all(&dir.join("addressbook")).await.unwrap(); @@ -1131,7 +1131,7 @@ mod tests { .await; let mut addresses = HashMap::::new(); - let hosts = "tracker2.postman.i2p=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ + let hosts = "tracker2.postman.echo=lnQ6yoBTxQuQU8EQ1FlF395ITIQF-HGJxUeFvzETLFnoczNjQvKDbtSB7aHhn853zjVXrJBgwlB9sO57KakBDa\ J50lUZgVPhjlI19TgJ-CxyHhHSCeKx5JzURdEW-ucdONMynr-b2zwhsx8VQCJwCEkARvt21YkOyQDaB9IdV8aTAmP~PUJQxRwceaTMn96FcVenwdXqle\ E16fI8CVFOV18jbJKrhTOYpTtcZKV4l1wNYBDwKgwPx5c0kcrRzFyw5~bjuAKO~GJ5dR7BQsL7AwBoQUS4k1lwoYrG1kOIBeDD3XF8BWb6K3GOOoyjc1\ umYKpur3G~FxBuqtHAsDRICrsRuil8qK~whOvj8uNTv~ohZnTZHxTLgi~s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UwEs3P6-ba7mDKKt8EPCG0nM6l~BvPl2OKQIBhXIxJLOOavGyqmmYm\ - AAAA\nzzz.i2p=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ + AAAA\nzzz.echo=GKapJ8koUcBj~jmQzHsTYxDg2tpfWj0xjQTzd8BhfC9c3OS5fwPBNajgF-eOD6eCjFTqTlorlh7Hnd8kXj1qblUGXT-tDoR9~YV8dm\ Xl51cJn9MVTRrEqRWSJVXbUUz9t5Po6Xa247Vr0sJn27R4KoKP8QVj1GuH6dB3b6wTPbOamC3dkO18vkQkfZWUdRMDXk0d8AdjB0E0864nOT~J9Fpnd2\ pQE5uoFT6P0DqtQR2jsFvf9ME61aqLvKPPWpkgdn4z6Zkm-NJOcDz2Nv8Si7hli94E9SghMYRsdjU-knObKvxiagn84FIwcOpepxuG~kFXdD5NfsH0v6\ Uri3usE3XWD7Pw6P8qVYF39jUIq4OiNMwPnNYzy2N4mDMQdsdHO3LUVh~DEppOy9AAmEoHDjjJxt2BFBbGxfdpZCpENkwvmZeYUyNCCzASqTOOlNzdpn\ @@ -1161,19 +1161,19 @@ mod tests { address_book.save_to_disk(addresses).await; let handle = address_book.handle(); - assert!(handle.resolve_base32("zzz.i2p").is_some()); - assert!(handle.resolve_base64("zzz.i2p".to_string()).await.is_some()); + assert!(handle.resolve_base32("zzz.echo").is_some()); + assert!(handle.resolve_base64("zzz.echo".to_string()).await.is_some()); // remove host and verify it's no longer found - handle.remove("zzz.i2p"); + handle.remove("zzz.echo"); - assert!(handle.resolve_base32("zzz.i2p").is_none()); - assert!(handle.resolve_base64("zzz.i2p".to_string()).await.is_none()); + assert!(handle.resolve_base32("zzz.echo").is_none()); + assert!(handle.resolve_base64("zzz.echo".to_string()).await.is_none()); dir }; - // simulate another boot and verify zzz.i2p is not found in the address book + // simulate another boot and verify zzz.echo is not found in the address book let address_book = AddressBookManager::new( dir.clone(), AddressBookConfig { @@ -1184,7 +1184,7 @@ mod tests { .await; let handle = address_book.handle(); - assert!(handle.resolve_base32("zzz.i2p").is_none()); - assert!(handle.resolve_base64("zzz.i2p".to_string()).await.is_none()); + assert!(handle.resolve_base32("zzz.echo").is_none()); + assert!(handle.resolve_base64("zzz.echo".to_string()).await.is_none()); } } diff --git a/emissary-cli/src/config.rs b/emissary-cli/src/config.rs index d0850eed..63df0b8b 100644 --- a/emissary-cli/src/config.rs +++ b/emissary-cli/src/config.rs @@ -215,7 +215,7 @@ impl Default for EmissaryConfig { address_book: None, // address_book: Some(AddressBookConfig { // default: Some(String::from( - // "http://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p/hosts.txt", + // "http://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.echo/hosts.txt", // )), // subscriptions: None, // }), diff --git a/emissary-cli/src/main.rs b/emissary-cli/src/main.rs index d51408a4..8d7502ca 100644 --- a/emissary-cli/src/main.rs +++ b/emissary-cli/src/main.rs @@ -38,7 +38,7 @@ use emissary_util::{ port_mapper::PortMapper, reseeder::Reseeder, runtime::tokio::Runtime, storage::Storage, su3::ReseedRouterInfo, }; -use futures::{channel::oneshot, StreamExt}; +use futures::{channel::oneshot, future, StreamExt}; use tokio::sync::mpsc::{channel, Receiver}; use std::{fs::File, io::Write, mem, pin::Pin, sync::Arc, path::PathBuf}; @@ -361,7 +361,7 @@ async fn setup_router(arguments: Arguments) -> anyhow::Result { // been built), it'll signal the address book that it can start download hosts file(s) // // additionally, acquire handle to address book which is passed to http proxy so it can - // resolve .i2p hosts to .b32.i2p hosts + // resolve .echo hosts to .b32.echo hosts let (http_proxy_ready_tx, address_book_handle) = match address_book_manager { None => (None, None), Some(address_book_manager) => { @@ -537,21 +537,15 @@ async fn router_event_loop( // router.add_external_address(address.expect("value")); }, _ = async { - loop { - let mut router_guard = router.lock().await; - let mut pinned_router = Pin::new(&mut *router_guard); - let waker = futures::task::noop_waker(); - let mut cx = std::task::Context::from_waker(&waker); - match pinned_router.as_mut().poll(&mut cx) { - std::task::Poll::Ready(()) => return (), - std::task::Poll::Pending => { - drop(router_guard); - tokio::task::yield_now().await; - } - } - } - } => { - // _ = &mut router => { + // Poll router properly using tokio's async mechanism + future::poll_fn(|cx| { + let mut router_guard = match router.try_lock() { + Ok(guard) => guard, + Err(_) => return std::task::Poll::Pending, + }; + Pin::new(&mut *router_guard).poll(cx) + }).await + } => { tracing::info!( target: LOG_TARGET, "emissary shut down", @@ -580,7 +574,13 @@ fn main() -> anyhow::Result<()> { #[cfg(feature = "web-ui")] fn main() -> anyhow::Result<()> { - let runtime = tokio::runtime::Runtime::new()?; + // let runtime = tokio::runtime::Runtime::new()?; + let runtime = tokio::runtime::Builder::new_multi_thread() + .worker_threads(num_cpus::get()) // Use all CPU cores + .enable_all() + .thread_stack_size(4 * 1024 * 1024) // 4MB stack per thread + .build()?; + let (shutdown_tx, shutdown_rx) = channel(1); let arguments = runtime.block_on(parse_arguments()); let RouterContext { diff --git a/emissary-cli/src/proxy/http/error.rs b/emissary-cli/src/proxy/http/error.rs index 0d5d994b..0d8397b3 100644 --- a/emissary-cli/src/proxy/http/error.rs +++ b/emissary-cli/src/proxy/http/error.rs @@ -72,7 +72,7 @@ impl std::fmt::Display for HttpError { HttpError::MethodNotSupported(method) => write!(f, "Method not supported: {method}"), HttpError::HostNotFound => write!(f, "Host not found in address book"), HttpError::AddressBookNotEnabled => - write!(f, "Cannot connect to .i2p host, address book not enabled"), + write!(f, "Cannot connect to .echo host, address book not enabled"), HttpError::OutproxyNotEnabled => write!( f, "Cannot connect to clearnet address, outproxy not enabled" diff --git a/emissary-cli/src/proxy/http/mod.rs b/emissary-cli/src/proxy/http/mod.rs index 77c63df2..7f9b9d68 100644 --- a/emissary-cli/src/proxy/http/mod.rs +++ b/emissary-cli/src/proxy/http/mod.rs @@ -108,9 +108,9 @@ impl HttpProxy { // validate outproxy // - // if the outproxy is given as a .b32.i2p host, it can be used as-is + // if the outproxy is given as a .b32.echo host, it can be used as-is // - // if it's given as a .i2p host, it must be converted into a .b32.i2p host by doing a host + // if it's given as a .echo host, it must be converted into a .b32.echo host by doing a host // lookup into address book // // if either address book is disabled or hostname is not found in it, outproxy is disabled @@ -120,19 +120,19 @@ impl HttpProxy { let outproxy = outproxy.strip_prefix("http://").unwrap_or(&outproxy); let outproxy = outproxy.strip_prefix("www.").unwrap_or(outproxy); - match outproxy.ends_with(".i2p") { + match outproxy.ends_with(".echo") { false => { tracing::warn!( target: LOG_TARGET, %outproxy, - "outproxy must be .b32.i2p or .i2p hostname", + "outproxy must be .b32.echo or .echo hostname", ); None } - true => match (outproxy.ends_with(".b32.i2p"), &address_book_handle) { + true => match (outproxy.ends_with(".b32.echo"), &address_book_handle) { (true, _) => Some(outproxy.to_owned()), (false, Some(handle)) => match handle.resolve_base32(outproxy) { - Some(host) => Some(format!("{host}.b32.i2p")), + Some(host) => Some(format!("{host}.b32.echo")), None => { tracing::warn!( target: LOG_TARGET, @@ -197,8 +197,8 @@ impl HttpProxy { /// Handle `request`. /// - /// Assembles the validated request into an actual HTTP request and resolves a .i2p host into a - /// .b32.i2p host if a .i2p host was used and if address book was enabled. + /// Assembles the validated request into an actual HTTP request and resolves a .echo host into a + /// .b32.echo host if a .echo host was used and if address book was enabled. /// /// If the outbound request was for an outproxy, ensures that an outproxy has been configured. /// @@ -457,7 +457,7 @@ mod tests { .expect("to succeed"); match client - .get("http://zzz.i2p") + .get("http://zzz.echo") .headers(HeaderMap::from_iter([( CONNECTION, HeaderValue::from_static("close"), @@ -472,7 +472,7 @@ mod tests { .text() .await .unwrap() - .contains("Cannot connect to .i2p host, address book not enabled")); + .contains("Cannot connect to .echo host, address book not enabled")); } }; } @@ -526,7 +526,7 @@ mod tests { .expect("to succeed"); match client - .get("http://zzz.i2p") + .get("http://zzz.echo") .headers(HeaderMap::from_iter([( CONNECTION, HeaderValue::from_static("close"), @@ -608,7 +608,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("outproxy.i2p".to_string()), + outproxy: Some("outproxy.echo".to_string()), }, sam_port, None, @@ -677,7 +677,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("outproxy.i2p".to_string()), + outproxy: Some("outproxy.echo".to_string()), }, sam_port, None, @@ -727,10 +727,10 @@ mod tests { // create empty address book let address_book = { - let hosts = "psi.i2p=avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a\n\ - zerobin.i2p=3564erslxzaoucqasxsjerk4jz2xril7j2cbzd4p7flpb4ut67hq\n\ - tracker2.postman.i2p=6a4kxkg5wp33p25qqhgwl6sj4yh4xuf5b3p3qldwgclebchm3eea\n\ - zzz.i2p=lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua\n" + let hosts = "psi.echo=avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a\n\ + zerobin.echo=3564erslxzaoucqasxsjerk4jz2xril7j2cbzd4p7flpb4ut67hq\n\ + tracker2.postman.echo=6a4kxkg5wp33p25qqhgwl6sj4yh4xuf5b3p3qldwgclebchm3eea\n\ + zzz.echo=lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua\n" .to_string(); let dir = tempdir().unwrap().keep(); @@ -754,7 +754,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("zzz.i2p".to_string()), + outproxy: Some("zzz.echo".to_string()), }, sam_port, None, @@ -765,7 +765,7 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } @@ -775,7 +775,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("www.zzz.i2p".to_string()), + outproxy: Some("www.zzz.echo".to_string()), }, sam_port, None, @@ -786,7 +786,7 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } @@ -796,7 +796,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("http://zzz.i2p".to_string()), + outproxy: Some("http://zzz.echo".to_string()), }, sam_port, None, @@ -807,7 +807,7 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } @@ -817,7 +817,7 @@ mod tests { HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), - outproxy: Some("http://www.zzz.i2p".to_string()), + outproxy: Some("http://www.zzz.echo".to_string()), }, sam_port, None, @@ -828,18 +828,18 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } - // http://www. .b32.i2p host + // http://www. .b32.echo host { let proxy = HttpProxy::new( HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), outproxy: Some( - "http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" .to_string(), ), }, @@ -852,18 +852,18 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } - // http:// .b32.i2p host + // http:// .b32.echo host { let proxy = HttpProxy::new( HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), outproxy: Some( - "http://lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "http://lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" .to_string(), ), }, @@ -876,18 +876,18 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } - // http:// .b32.i2p host + // http:// .b32.echo host { let proxy = HttpProxy::new( HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), outproxy: Some( - "www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" .to_string(), ), }, @@ -900,18 +900,18 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } - // .b32.i2p host + // .b32.echo host { let proxy = HttpProxy::new( HttpProxyConfig { port: 0, host: "127.0.0.1".to_string(), outproxy: Some( - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string(), ), }, sam_port, @@ -923,7 +923,7 @@ mod tests { assert_eq!( proxy.outproxy.as_ref().unwrap().as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); } } diff --git a/emissary-cli/src/proxy/http/request.rs b/emissary-cli/src/proxy/http/request.rs index 5a31bdeb..f3bdfd6b 100644 --- a/emissary-cli/src/proxy/http/request.rs +++ b/emissary-cli/src/proxy/http/request.rs @@ -40,7 +40,7 @@ static ILLEGAL: LazyLock> = LazyLock::new(|| { /// Host kind. #[derive(Debug, PartialEq, Eq)] pub enum HostKind { - /// .i2p host. + /// .echo host. /// /// Address book must've been enabled and the host must exist in address book. I2p { @@ -48,7 +48,7 @@ pub enum HostKind { host: String, }, - /// .b32.i2p host + /// .b32.echo host B32 { /// Host. host: String, @@ -87,7 +87,7 @@ impl Request { /// be made to the request remote host. /// /// If the parsed is [`HostKind::Clearnet`], an outproxy must have been configured and if the - /// parsed host is [`HostKind::I2p`], address book must have been enabled and the .i2p host must + /// parsed host is [`HostKind::I2p`], address book must have been enabled and the .echo host must /// be found int the address book. pub fn parse(request: Vec) -> Result { // parse request and create a new request with sanitized headers @@ -131,9 +131,9 @@ impl Request { let host = std::str::from_utf8(host.value).map_err(|_| HttpError::Malformed)?; let host = host.strip_prefix("www.").unwrap_or(host).to_string(); - match host.ends_with(".i2p") { + match host.ends_with(".echo") { false => HostKind::Clearnet { host }, - true => match host.ends_with(".b32.i2p") { + true => match host.ends_with(".b32.echo") { false => HostKind::I2p { host }, true => HostKind::B32 { host }, }, @@ -151,17 +151,17 @@ impl Request { /// Attempt to assemble [`Request`] into a serialized request that can be sent to remote host. /// - /// Takes two parameters: `address_book` and `outproxy`. `address_book` is used to resolve .i2p - /// host into a .b32.i2p host, if host is [`HostKind::I2p`]. If `address_book` doesn't exist or - /// the .i2p host was not found in the address book, an error is returned to indicate that the - /// request could not be assmebled. `outproxy` is the .b32.i2p host of the outproxy, if + /// Takes two parameters: `address_book` and `outproxy`. `address_book` is used to resolve .echo + /// host into a .b32.echo host, if host is [`HostKind::I2p`]. If `address_book` doesn't exist or + /// the .echo host was not found in the address book, an error is returned to indicate that the + /// request could not be assmebled. `outproxy` is the .b32.echo host of the outproxy, if /// configured, and it must exist if host is [`HostKind::Clearnet`]. /// /// The function constructs a new HTTP request, setting the correct user agent and stripping any /// "illegal" headers before returning it to the caller, allowing them to send it to remote /// host. /// - /// Returns a `(host, request)` tuple where the `host` is the .b32.i2p address of the remote + /// Returns a `(host, request)` tuple where the `host` is the .b32.echo address of the remote /// host SAM should connect to (either an eepsite or an outproxy) and where `request` is a /// serialized HTTP request. pub async fn assemble( @@ -177,23 +177,23 @@ impl Request { // resolve host for the request // - // .b32.i2p: no modifications needed - // .i2p: attempt to resolve .i2p host to .b32.i2p host - // clearnet: ensure outproxy has been configured and return its .b32.i2p hostname + // .b32.echo: no modifications needed + // .echo: attempt to resolve .echo host to .b32.echo host + // clearnet: ensure outproxy has been configured and return its .b32.echo hostname // // if a clearnet address is used and an outproxy has been enabled, the host that is the // original request must be kept unmodified as the request is sent to clearnet and such - // an address obviously doesn't need to (and cannot be) resolved to a .b32.i2p hostname + // an address obviously doesn't need to (and cannot be) resolved to a .b32.echo hostname let (host, keep_original_host) = match (self.host, address_book, outproxy) { (HostKind::B32 { host }, _, _) => (host, false), (HostKind::I2p { host }, Some(address_book), _) => match address_book.resolve_base32(&host) { - Some(host) => (format!("{host}.b32.i2p"), false), + Some(host) => (format!("{host}.b32.echo"), false), None => { tracing::warn!( target: LOG_TARGET, %host, - ".i2p host not found in the address book", + ".echo host not found in the address book", ); return Err(HttpError::HostNotFound); } @@ -203,7 +203,7 @@ impl Request { tracing::warn!( target: LOG_TARGET, %host, - "cannot connect to .i2p host, address book not enabled" + "cannot connect to .echo host, address book not enabled" ); return Err(HttpError::AddressBookNotEnabled); } @@ -240,7 +240,7 @@ impl Request { // modify host if not explicitly forbidden // - // the host must be modified for .i2p requests as otherwise the request would leak + // the host must be modified for .echo requests as otherwise the request would leak // information about local addressbook // // the host must be kept unmodified for clearnet requests going through an outproxy @@ -317,10 +317,10 @@ mod tests { use tempfile::tempdir; async fn make_address_book() -> (Arc, PathBuf) { - let hosts = "psi.i2p=avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a\n\ - zerobin.i2p=3564erslxzaoucqasxsjerk4jz2xril7j2cbzd4p7flpb4ut67hq\n\ - tracker2.postman.i2p=6a4kxkg5wp33p25qqhgwl6sj4yh4xuf5b3p3qldwgclebchm3eea\n\ - zzz.i2p=lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua\n" + let hosts = "psi.echo=avviiexdngd32ccoy4kuckvc3mkf53ycvzbz6vz75vzhv4tbpk5a\n\ + zerobin.echo=3564erslxzaoucqasxsjerk4jz2xril7j2cbzd4p7flpb4ut67hq\n\ + tracker2.postman.echo=6a4kxkg5wp33p25qqhgwl6sj4yh4xuf5b3p3qldwgclebchm3eea\n\ + zzz.echo=lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua\n" .to_string(); let dir = tempdir().unwrap().keep(); @@ -342,7 +342,7 @@ mod tests { #[tokio::test] async fn get_accepted() { let request = "GET / HTTP/1.1\r\n\ - Host: lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p\r\n\r\n" + Host: lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo\r\n\r\n" .as_bytes() .to_vec(); @@ -356,7 +356,7 @@ mod tests { assert_eq!( host, HostKind::B32 { - host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() } ); assert_eq!(method, "GET".to_string()); @@ -368,14 +368,14 @@ mod tests { assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } #[tokio::test] async fn get_full_path() { - let request = "GET http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p HTTP/1.1\r\n\ - Host: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p\r\n\r\n" + let request = "GET http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo HTTP/1.1\r\n\ + Host: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo\r\n\r\n" .as_bytes() .to_vec(); let request = Request::parse(request).unwrap(); @@ -383,7 +383,7 @@ mod tests { assert_eq!( request.host, HostKind::B32 { - host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -398,18 +398,18 @@ mod tests { assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p", + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo", ); } #[tokio::test] async fn www_stripped_from_host() { let request = "GET / HTTP/1.1\r\nHost: \ - www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p\r\n\r\n" + www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo\r\n\r\n" .as_bytes() .to_vec(); let request = Request::parse(request).unwrap(); @@ -417,7 +417,7 @@ mod tests { assert_eq!( request.host, HostKind::B32 { - host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -432,24 +432,24 @@ mod tests { assert_eq!(req.path, Some("/")); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p", + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo", ); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } #[tokio::test] async fn converted_to_relative_path() { - let request = "GET http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p/topics/new-topic?query=1 \ - HTTP/1.1\r\nHost: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET http://www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo/topics/new-topic?query=1 \ + HTTP/1.1\r\nHost: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::B32 { - host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -464,18 +464,18 @@ mod tests { assert_eq!(req.path, Some("/topics/new-topic?query=1")); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p", + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo", ); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } #[tokio::test] async fn post_accepted() { let request = "POST /upload HTTP/1.1\r\n\ - Host: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p\r\n\ + Host: www.lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo\r\n\ Content-Type: text/plain\r\n\ Content-Length: 12\r\n\r\n\ hello, world" @@ -486,7 +486,7 @@ mod tests { assert_eq!( request.host, HostKind::B32 { - host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + host: "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() } ); assert_eq!(request.method, "POST".to_string()); @@ -505,11 +505,11 @@ mod tests { ); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p", + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo", ); assert_eq!( req.headers.iter().find(|header| header.name == "Content-Length").unwrap().value, @@ -526,13 +526,13 @@ mod tests { #[tokio::test] async fn i2p_host_address_book_disabled() { - let request = "GET / HTTP/1.1\r\nHost: host.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET / HTTP/1.1\r\nHost: host.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::I2p { - host: "host.i2p".to_string() + host: "host.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -546,13 +546,13 @@ mod tests { #[tokio::test] async fn i2p_host_not_found_in_address_book() { let address_book = make_address_book().await.0; - let request = "GET / HTTP/1.1\r\nHost: host.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET / HTTP/1.1\r\nHost: host.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::I2p { - host: "host.i2p".to_string() + host: "host.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -566,13 +566,13 @@ mod tests { #[tokio::test] async fn i2p_host_found_in_address_book() { let address_book = make_address_book().await.0; - let request = "GET / HTTP/1.1\r\nHost: zzz.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET / HTTP/1.1\r\nHost: zzz.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::I2p { - host: "zzz.i2p".to_string() + host: "zzz.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -581,7 +581,7 @@ mod tests { let (host, request) = request.assemble(&Some(address_book), &None).await.unwrap(); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); let mut headers = [httparse::EMPTY_HEADER; 64]; @@ -592,14 +592,14 @@ mod tests { assert_eq!(req.path, Some("/")); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } #[tokio::test] async fn converted_to_relative_path_host_lookup() { let address_book = make_address_book().await.0; - let request = "GET http://www.zzz.i2p.b32.i2p/topics/new-topic?query=1 HTTP/1.1\r\nHost: www.zzz.i2p\r\n\r\n" + let request = "GET http://www.zzz.echo.b32.echo/topics/new-topic?query=1 HTTP/1.1\r\nHost: www.zzz.echo\r\n\r\n" .as_bytes() .to_vec(); let request = Request::parse(request).unwrap(); @@ -607,7 +607,7 @@ mod tests { assert_eq!( request.host, HostKind::I2p { - host: "zzz.i2p".to_string() + host: "zzz.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -616,7 +616,7 @@ mod tests { let (host, request) = request.assemble(&Some(address_book), &None).await.unwrap(); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); let mut headers = [httparse::EMPTY_HEADER; 64]; @@ -627,7 +627,7 @@ mod tests { assert_eq!(req.path, Some("/topics/new-topic?query=1")); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } @@ -637,13 +637,13 @@ mod tests { // first query which does a lookup to disk { - let request = "GET / HTTP/1.1\r\nHost: zzz.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET / HTTP/1.1\r\nHost: zzz.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::I2p { - host: "zzz.i2p".to_string() + host: "zzz.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -653,7 +653,7 @@ mod tests { request.assemble(&Some(address_book.clone()), &None).await.unwrap(); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); let mut headers = [httparse::EMPTY_HEADER; 64]; @@ -664,22 +664,22 @@ mod tests { assert_eq!(req.path, Some("/")); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } // remove address book file tokio::fs::remove_file(path).await.unwrap(); - // address book is removed from disk but zzz.i2p has been cached + // address book is removed from disk but zzz.echo has been cached { - let request = "GET / HTTP/1.1\r\nHost: zzz.i2p\r\n\r\n".as_bytes().to_vec(); + let request = "GET / HTTP/1.1\r\nHost: zzz.echo\r\n\r\n".as_bytes().to_vec(); let request = Request::parse(request).unwrap(); assert_eq!( request.host, HostKind::I2p { - host: "zzz.i2p".to_string() + host: "zzz.echo".to_string() } ); assert_eq!(request.method, "GET".to_string()); @@ -688,7 +688,7 @@ mod tests { let (host, request) = request.assemble(&Some(address_book), &None).await.unwrap(); assert_eq!( host.as_str(), - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p" + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo" ); let mut headers = [httparse::EMPTY_HEADER; 64]; @@ -699,7 +699,7 @@ mod tests { assert_eq!(req.path, Some("/")); assert_eq!( req.headers.iter().find(|header| header.name == "Host").unwrap().value, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".as_bytes(), + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".as_bytes(), ); } } @@ -741,14 +741,14 @@ mod tests { let (host, request) = request .assemble( &None, - &Some("lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string()), + &Some("lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string()), ) .await .unwrap(); assert_eq!( host, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() ); let mut headers = [httparse::EMPTY_HEADER; 64]; @@ -786,14 +786,14 @@ mod tests { let (host, request) = request .assemble( &None, - &Some("lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string()), + &Some("lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string()), ) .await .unwrap(); assert_eq!( host, - "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.i2p".to_string() + "lhbd7ojcaiofbfku7ixh47qj537g572zmhdc4oilvugzxdpdghua.b32.echo".to_string() ); let mut headers = [httparse::EMPTY_HEADER; 64]; diff --git a/emissary-cli/src/proxy/socks.rs b/emissary-cli/src/proxy/socks.rs index 6737afd2..ed5ac291 100644 --- a/emissary-cli/src/proxy/socks.rs +++ b/emissary-cli/src/proxy/socks.rs @@ -292,7 +292,7 @@ mod tests { tokio::spawn(proxy.run()); assert!( - Socks4Stream::connect(address, "http://host.i2p".to_string(), 80, false) + Socks4Stream::connect(address, "http://host.echo".to_string(), 80, false) .await .is_err() ) @@ -322,7 +322,7 @@ mod tests { assert!(Socks5Stream::connect_with_password( address, - "http://host.i2p".to_string(), + "http://host.echo".to_string(), 80, "username".to_string(), "password".to_string(), diff --git a/emissary-cli/src/tunnel/server.rs b/emissary-cli/src/tunnel/server.rs index c9e294ea..0aec8ae9 100644 --- a/emissary-cli/src/tunnel/server.rs +++ b/emissary-cli/src/tunnel/server.rs @@ -173,6 +173,8 @@ impl ServerTunnelManager { destination: DestinationKind::Persistent { private_key: config.destination.clone(), }, + inbound_len: 1, //ToDo: make this configurable //current value test purpose + outbound_len: 1, //ToDo: make this configurable //current value test purpose ..Default::default() }) .await diff --git a/emissary-cli/src/ui/native/address_book/mod.rs b/emissary-cli/src/ui/native/address_book/mod.rs index 5d6f8870..87a45cf1 100644 --- a/emissary-cli/src/ui/native/address_book/mod.rs +++ b/emissary-cli/src/ui/native/address_book/mod.rs @@ -105,8 +105,8 @@ impl RouterUi { } pub fn save_destination(&mut self) -> Result<(), String> { - if !self.hostname.ends_with(".i2p") { - return Err(String::from("Hostname must end in .i2p")); + if !self.hostname.ends_with(".echo") { + return Err(String::from("Hostname must end in .echo")); } if self.destination.is_empty() { @@ -117,7 +117,7 @@ impl RouterUi { let destination = destination.strip_prefix("http://").unwrap_or(destination); let destination = destination.strip_prefix("https://").unwrap_or(destination); let destination = destination.strip_prefix("www.").unwrap_or(destination); - let destination = destination.strip_suffix(".b32.i2p").unwrap_or(destination); + let destination = destination.strip_suffix(".b32.echo").unwrap_or(destination); match emissary_core::crypto::base64_decode(destination) { Some(destination) => match Destination::parse(&destination) { @@ -159,10 +159,10 @@ impl RouterUi { let subscriptions = self.subscriptions.split(",").map(ToOwned::to_owned).collect::>(); - if !subscriptions.iter().all(|url| url.ends_with(".i2p/hosts.txt")) { + if !subscriptions.iter().all(|url| url.ends_with(".echo/hosts.txt")) { return Err(String::from( "All URLs are not valid I2P subscription URLs\n\n\ - Example: http://host1.i2p/hosts.txt,http://host2.i2p/hosts.txt", + Example: http://host1.echo/hosts.txt,http://host2.echo/hosts.txt", )); } diff --git a/emissary-cli/src/ui/native/config.rs b/emissary-cli/src/ui/native/config.rs index 18312a1f..54b092e3 100644 --- a/emissary-cli/src/ui/native/config.rs +++ b/emissary-cli/src/ui/native/config.rs @@ -44,7 +44,7 @@ pub fn load_addresses(path: PathBuf) -> BTreeMap, Arc> { let line = line.ok()?; let (key, value) = line.split_once('=')?; - Some((Arc::from(key), Arc::from(format!("http://{value}.b32.i2p")))) + Some((Arc::from(key), Arc::from(format!("http://{value}.b32.echo")))) }) .collect() } diff --git a/emissary-cli/src/ui/native/hidden_services/client.rs b/emissary-cli/src/ui/native/hidden_services/client.rs index 0160739e..a20c3fd6 100644 --- a/emissary-cli/src/ui/native/hidden_services/client.rs +++ b/emissary-cli/src/ui/native/hidden_services/client.rs @@ -104,7 +104,7 @@ impl RouterUi { ) .push(Text::new("Destination").size(15).color(Color::from_rgb8(0x9b, 0xa2, 0xae))) .push( - TextInput::new(".i2p or .b32.i2p address", &self.client_destination) + TextInput::new(".echo or .b32.echo address", &self.client_destination) .size(15) .on_input(Message::ClientDestinationChanged) .padding(10) @@ -269,7 +269,7 @@ impl RouterUi { ) .push(Text::new("Destination").size(15).color(Color::from_rgb8(0x9b, 0xa2, 0xae))) .push( - TextInput::new(".i2p or .b32.i2p address", &self.edit_client_destination) + TextInput::new(".echo or .b32.echo address", &self.edit_client_destination) .size(15) .on_input(Message::EditClientDestinationChanged) .padding(10) diff --git a/emissary-cli/src/ui/native/hidden_services/mod.rs b/emissary-cli/src/ui/native/hidden_services/mod.rs index c79f5569..21147f4f 100644 --- a/emissary-cli/src/ui/native/hidden_services/mod.rs +++ b/emissary-cli/src/ui/native/hidden_services/mod.rs @@ -77,7 +77,7 @@ impl RouterUi { } match read_b32_address(&self.server_path) { - Some(address) => Ok(format!("{address}.b32.i2p")), + Some(address) => Ok(format!("{address}.b32.echo")), None => Ok(String::from("Key file does not exist")), } } @@ -88,7 +88,7 @@ impl RouterUi { } match read_b32_address(&self.edit_server_path) { - Some(address) => Ok(format!("{address}.b32.i2p")), + Some(address) => Ok(format!("{address}.b32.echo")), None => Ok(String::from("Key file does not exist")), } } @@ -102,9 +102,9 @@ impl RouterUi { return Err(String::from("Invalid destination port")); } - if !self.client_destination.ends_with(".i2p") { + if !self.client_destination.ends_with(".echo") { return Err(String::from( - "Destination must be a .i2p or .b32.i2p address", + "Destination must be a .echo or .b32.echo address", )); } @@ -120,9 +120,9 @@ impl RouterUi { return Err(String::from("Invalid destination port")); } - if !self.edit_client_destination.ends_with(".i2p") { + if !self.edit_client_destination.ends_with(".echo") { return Err(String::from( - "Destination must be a .i2p or .b32.i2p address", + "Destination must be a .echo or .b32.echo address", )); } diff --git a/emissary-cli/src/ui/native/mod.rs b/emissary-cli/src/ui/native/mod.rs index 104996f9..04bc2bd3 100644 --- a/emissary-cli/src/ui/native/mod.rs +++ b/emissary-cli/src/ui/native/mod.rs @@ -227,7 +227,7 @@ impl RouterUi { .iter() .map(|service| { let address = read_b32_address(&service.destination_path) - .map(|address| format!("{address}.b32.i2p")) + .map(|address| format!("{address}.b32.echo")) .unwrap_or(String::from("Key file does not exist")); ( diff --git a/emissary-core/src/sam/parser.rs b/emissary-core/src/sam/parser.rs index 0d387fd9..87b341df 100644 --- a/emissary-core/src/sam/parser.rs +++ b/emissary-core/src/sam/parser.rs @@ -169,13 +169,13 @@ pub enum HostKind { destination: Box, }, - /// Base32-encoded host, such as udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p. + /// Base32-encoded host, such as udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.echo. B32Host { /// Destination ID. destination_id: DestinationId, }, - /// Regular host, such as host.i2p. + /// Regular host, such as host.echo. Host { /// Host. host: String, @@ -569,11 +569,11 @@ impl<'a, R: Runtime> TryFrom> for SamCommand { ); })?; - let host = if let Some(end) = destination.find(".b32.i2p") { + let host = if let Some(end) = destination.find(".b32.echo") { tracing::trace!( target: LOG_TARGET, %destination, - "stream connect for .b32.i2p address", + "stream connect for .b32.echo address", ); let start = if destination.starts_with("http://") { @@ -588,18 +588,18 @@ impl<'a, R: Runtime> TryFrom> for SamCommand { tracing::warn!( target: LOG_TARGET, ?destination, - "invalid .b32.i2p address", + "invalid .b32.echo address", ); })?; HostKind::B32Host { destination_id: DestinationId::from(&decoded), } - } else if destination.ends_with(".i2p") { + } else if destination.ends_with(".echo") { tracing::trace!( target: LOG_TARGET, %destination, - "stream connect for .i2p address", + "stream connect for .echo address", ); let start = if destination.starts_with("http://") { @@ -1074,7 +1074,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p \ + DESTINATION=udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1099,7 +1099,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=http://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p \ + DESTINATION=http://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1124,7 +1124,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=https://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.i2p \ + DESTINATION=https://udhdrtrcetjm5sxzskjyr5ztpeszydbh4dpl3pl4utgqqw2v4jna.b32.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1149,7 +1149,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=host.i2p \ + DESTINATION=host.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1159,7 +1159,7 @@ mod tests { }) => { assert_eq!(session_id.as_str(), "MM9z52ZwnTTPwfeD"); assert_eq!(options.get("SILENT"), Some(&"false".to_string())); - assert_eq!(host.as_str(), "host.i2p"); + assert_eq!(host.as_str(), "host.echo"); } response => panic!("invalid response: {response:?}"), } @@ -1168,7 +1168,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=http://host.i2p \ + DESTINATION=http://host.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1178,7 +1178,7 @@ mod tests { }) => { assert_eq!(session_id.as_str(), "MM9z52ZwnTTPwfeD"); assert_eq!(options.get("SILENT"), Some(&"false".to_string())); - assert_eq!(host.as_str(), "host.i2p"); + assert_eq!(host.as_str(), "host.echo"); } response => panic!("invalid response: {response:?}"), } @@ -1187,7 +1187,7 @@ mod tests { match SamCommand::parse::( "STREAM CONNECT \ ID=MM9z52ZwnTTPwfeD \ - DESTINATION=https://host.i2p \ + DESTINATION=https://host.echo \ SILENT=false", ) { Some(SamCommand::Connect { @@ -1197,20 +1197,20 @@ mod tests { }) => { assert_eq!(session_id.as_str(), "MM9z52ZwnTTPwfeD"); assert_eq!(options.get("SILENT"), Some(&"false".to_string())); - assert_eq!(host.as_str(), "host.i2p"); + assert_eq!(host.as_str(), "host.echo"); } response => panic!("invalid response: {response:?}"), } // invalid subcommand assert!(SamCommand::parse::( - "STREAM CREATE ID=MM9z52ZwnTTPwfeD DESTINATION=host.i2p SILENT=false", + "STREAM CREATE ID=MM9z52ZwnTTPwfeD DESTINATION=host.echo SILENT=false", ) .is_none()); // session id missing assert!(SamCommand::parse::( - "STREAM CONNECT DESTINATION=host.i2p SILENT=false", + "STREAM CONNECT DESTINATION=host.echo SILENT=false", ) .is_none()); @@ -1269,9 +1269,9 @@ mod tests { #[test] fn parse_naming_lookup() { - match SamCommand::parse::("NAMING LOOKUP NAME=host.i2p") { + match SamCommand::parse::("NAMING LOOKUP NAME=host.echo") { Some(SamCommand::NamingLookup { name }) => { - assert_eq!(name.as_str(), "host.i2p"); + assert_eq!(name.as_str(), "host.echo"); } response => panic!("invalid response: {response:?}"), } diff --git a/emissary-core/src/sam/protocol/streaming/config.rs b/emissary-core/src/sam/protocol/streaming/config.rs index c018315b..48de045e 100644 --- a/emissary-core/src/sam/protocol/streaming/config.rs +++ b/emissary-core/src/sam/protocol/streaming/config.rs @@ -202,7 +202,7 @@ impl Default for StreamConfig { Self { answer_pings: true, blacklist: String::from(""), - buffer_size: 64 * 1000, + buffer_size: 512 * 1000, //64 * 1000, congestion_avoidance_growth_rate_factor: 1, connect_delay: None, connect_timeout: Some(Duration::from_secs(5 * 60)), @@ -214,7 +214,7 @@ impl Default for StreamConfig { initial_resend_delay: Duration::from_secs(1), initial_rto: Duration::from_secs(9), initial_rtt: Duration::from_secs(8), - initial_window_size: 6, + initial_window_size: 32, //6 limit_action: LimitAction::Reset, max_concurrent_streams: None, max_conns_per_minute: None, @@ -225,7 +225,7 @@ impl Default for StreamConfig { max_total_conns_per_minute: None, max_total_conns_per_hour: None, max_total_conns_per_day: None, - max_window_size: 12, + max_window_size: 256, //12 profile: Profile::Bulk, read_timeout: None, slow_start_growth_rate_factor: 1, diff --git a/emissary-core/src/sam/protocol/streaming/mod.rs b/emissary-core/src/sam/protocol/streaming/mod.rs index 4e548018..5439567d 100644 --- a/emissary-core/src/sam/protocol/streaming/mod.rs +++ b/emissary-core/src/sam/protocol/streaming/mod.rs @@ -64,12 +64,12 @@ const LOG_TARGET: &str = "emissary::streaming"; /// [`StreamManager`]'s message channel size. /// /// Size of the channel used by all virtual streams to send messages to the network. -const STREAM_MANAGER_CHANNEL_SIZE: usize = 4096; +const STREAM_MANAGER_CHANNEL_SIZE: usize = 8192; //4096; /// [`Stream`]'s message channel size. /// /// Size of the channel used to send messages received from the network to a virtual stream. -const STREAM_CHANNEL_SIZE: usize = 512; +const STREAM_CHANNEL_SIZE: usize = 2048; //512; /// How long are streams kept in the pending state before they are pruned and rejected. const PENDING_STREAM_PRUNE_THRESHOLD: Duration = Duration::from_secs(30); diff --git a/emissary-core/src/sam/protocol/streaming/packet.rs b/emissary-core/src/sam/protocol/streaming/packet.rs index ffe91a3a..7f696efe 100644 --- a/emissary-core/src/sam/protocol/streaming/packet.rs +++ b/emissary-core/src/sam/protocol/streaming/packet.rs @@ -52,7 +52,7 @@ const SIGNATURE_LEN: usize = 64usize; const DSA_SIGNATURE_LEN: usize = 40usize; /// MTU size. -const MTU: usize = 1812usize; +const MTU: usize = 8000usize; //1812usize; /// Flags of the streaming packet. pub struct Flags<'a> { diff --git a/emissary-core/src/sam/protocol/streaming/stream/active.rs b/emissary-core/src/sam/protocol/streaming/stream/active.rs index 92dfb14e..561478c9 100644 --- a/emissary-core/src/sam/protocol/streaming/stream/active.rs +++ b/emissary-core/src/sam/protocol/streaming/stream/active.rs @@ -51,19 +51,19 @@ use core::{ const LOG_TARGET: &str = "emissary::streaming::active"; /// Read buffer size. -const READ_BUFFER_SIZE: usize = 0xffff; +const READ_BUFFER_SIZE: usize = 0x7ffff; //0xffff; /// Initial ACK delay. -const INITIAL_ACK_DELAY: Duration = Duration::from_millis(200); +const INITIAL_ACK_DELAY: Duration = Duration::from_millis(20); //200 /// Sequence number for a plain ACK message. const PLAIN_ACK: u32 = 0u32; /// Initial window size. -const INITIAL_WINDOW_SIZE: usize = 1usize; +const INITIAL_WINDOW_SIZE: usize = 16usize; //1usize; /// Maximum window size in packets. -const MAX_WINDOW_SIZE: usize = 128usize; +const MAX_WINDOW_SIZE: usize = 256usize; //128usize; /// How far ahead of the current highest received sequence number is a packet accepted. const MAX_WINDOW_LOOKAHEAD: usize = 4 * MAX_WINDOW_SIZE; @@ -75,10 +75,10 @@ const CHOKING_REQUEST: u16 = 60_001u16; const MAX_NACKS: usize = 255usize; /// Initial RTO. -const INITIAL_RTO: Duration = Duration::from_millis(9000); +const INITIAL_RTO: Duration = Duration::from_millis(2000); //9000 /// Initial RTT. -const INITIAL_RTT: Duration = Duration::from_millis(8000); +const INITIAL_RTT: Duration = Duration::from_millis(1000); //8000 /// RTT dampening factor (alpha). const RTT_DAMPENING_FACTOR: f64 = 0.125f64; @@ -87,10 +87,10 @@ const RTT_DAMPENING_FACTOR: f64 = 0.125f64; const RTTDEV_DAMPENING_FACTOR: f64 = 0.25; /// Threshold for stopping exponential growth of the window size. -const EXP_GROWTH_STOP_THRESHOLD: usize = 64; +const EXP_GROWTH_STOP_THRESHOLD: usize = 128; //64; /// MTU size. -const MTU_SIZE: usize = 1812; +const MTU_SIZE: usize = 8000; //1812; /// Stream event. #[derive(Default, Debug, Clone)] @@ -792,6 +792,7 @@ impl Stream { self.window_size *= 2; } else if self.window_size < MAX_WINDOW_SIZE { self.window_size += 1; + // self.window_size += 4; } } } diff --git a/emissary-core/src/sam/session.rs b/emissary-core/src/sam/session.rs index 3e73d2eb..e1a9d5c0 100644 --- a/emissary-core/src/sam/session.rs +++ b/emissary-core/src/sam/session.rs @@ -320,7 +320,7 @@ pub struct SamSession { /// Pending host lookups. /// - /// Pending `NAMING LOOKUP` queries for `.b32.i2p` addresses are stored here + /// Pending `NAMING LOOKUP` queries for `.b32.echo` addresses are stored here /// while the corresponding lease set is being queried. pending_host_lookups: HashMap, @@ -1114,10 +1114,10 @@ impl SamSession { /// Handle `NAMING LOOKUP` query from the client. /// /// The query can either be for `ME`, meaning the [`Destination`] of [`SamSession`] is returned, - /// a `.b32.i2p` which starts a lease set query for the destination. or a `.i2p` host name which + /// a `.b32.echo` which starts a lease set query for the destination. or a `.echo` host name which /// is looked up from an address book if it exists. /// - /// For `.b32.i2p`/`.i2p`, naming reply is deferred until the query is finished. + /// For `.b32.echo`/`.echo`, naming reply is deferred until the query is finished. fn on_naming_lookup(&mut self, name: String) { if name.as_str() == "ME" { tracing::debug!( @@ -1140,15 +1140,15 @@ impl SamSession { return; } - // if the host name ends in `.b32.i2p`, validate the hostname and check if [`Destination`] + // if the host name ends in `.b32.echo`, validate the hostname and check if [`Destination`] // already holds the host's lease set and if not, start a query // // once the query finishes, the naming reply is sent to client - if let Some(end) = name.find(".b32.i2p") { + if let Some(end) = name.find(".b32.echo") { tracing::debug!( target: LOG_TARGET, session_id = %self.session_id, - "naming lookup for .b32.i2p address", + "naming lookup for .b32.echo address", ); let start = if name.starts_with("http://") { @@ -1165,7 +1165,7 @@ impl SamSession { target: LOG_TARGET, session_id = %self.session_id, ?name, - "invalid .b32.i2p address", + "invalid .b32.echo address", ); Some( @@ -1226,7 +1226,7 @@ impl SamSession { return; } - let message = match name.find(".i2p") { + let message = match name.find(".echo") { None => { tracing::warn!( target: LOG_TARGET, @@ -1893,7 +1893,7 @@ mod tests { #[tokio::test] async fn naming_lookup_b32_invalid() { let (mut session, mut ctx) = create_session().await; - session.on_naming_lookup("invalid.b32.i2p".to_string()); + session.on_naming_lookup("invalid.b32.echo".to_string()); tokio::spawn(async move { session.socket.as_mut().expect("to exist").next().await }); // verify response contains base64 encoded destination @@ -1914,7 +1914,7 @@ mod tests { let (mut session, mut ctx) = create_session().await; // test with http:// prefix - session.on_naming_lookup("http://abcdef.b32.i2p".to_string()); + session.on_naming_lookup("http://abcdef.b32.echo".to_string()); tokio::spawn(async move { session.socket.as_mut().expect("to exist").next().await }); // verify error response when no address book exists @@ -1934,7 +1934,7 @@ mod tests { let (mut session, mut ctx) = create_session().await; // test with https:// prefix - session.on_naming_lookup("https://abcdef.b32.i2p".to_string()); + session.on_naming_lookup("https://abcdef.b32.echo".to_string()); tokio::spawn(async move { session.socket.as_mut().expect("to exist").next().await }); // verify error response when no address book exists @@ -1952,7 +1952,7 @@ mod tests { #[tokio::test] async fn naming_lookup_i2p_no_addressbook() { let (mut session, mut ctx) = create_session().await; - session.on_naming_lookup("example.i2p".to_string()); + session.on_naming_lookup("example.echo".to_string()); tokio::spawn(async move { session.socket.as_mut().expect("to exist").next().await }); // verify error response when no address book exists diff --git a/emissary-core/src/transport/mod.rs b/emissary-core/src/transport/mod.rs index 46385bae..255af26f 100644 --- a/emissary-core/src/transport/mod.rs +++ b/emissary-core/src/transport/mod.rs @@ -57,6 +57,9 @@ const LOG_TARGET: &str = "emissary::transport-manager"; /// Local router info gets republished to `NetDb` every 15 minutes. const ROUTER_INFO_REPUBLISH_INTERVAL: Duration = Duration::from_secs(15 * 60); +/// Default channel size. +const DEFAULT_CHANNEL_SIZE: usize = 4096; //1024; + /// Termination reason. #[derive(Debug, Default, PartialEq, Eq, Clone, Copy)] pub enum TerminationReason { diff --git a/emissary-core/src/transport/ntcp2/session/active.rs b/emissary-core/src/transport/ntcp2/session/active.rs index e69852bd..f0afd032 100644 --- a/emissary-core/src/transport/ntcp2/session/active.rs +++ b/emissary-core/src/transport/ntcp2/session/active.rs @@ -191,6 +191,7 @@ impl Ntcp2Session { sip, } = key_context; + // let (cmd_tx, cmd_rx) = channel(4096); //channel(512); let (msg_tx, msg_rx) = with_recycle(512, OutboundMessageRecycle::default()); Self { @@ -201,7 +202,7 @@ impl Ntcp2Session { inbound_bandwidth: 0usize, metrics_handle, outbound_bandwidth: 0usize, - read_buffer: vec![0u8; 0xffff], + read_buffer: vec![0u8; 0x7ffff], //vec![0u8; 0xffff], read_state: ReadState::ReadSize { offset: 0usize }, recv_cipher: ChaChaPoly::new(&recv_key), role, diff --git a/emissary-core/src/tunnel/mod.rs b/emissary-core/src/tunnel/mod.rs index a660e1e1..5620a975 100644 --- a/emissary-core/src/tunnel/mod.rs +++ b/emissary-core/src/tunnel/mod.rs @@ -67,6 +67,9 @@ pub use pool::{TunnelMessageSender, TunnelPoolConfig, TunnelPoolEvent, TunnelPoo /// Logging target for the file. const LOG_TARGET: &str = "emissary::tunnel"; +/// Default channel size. +const DEFAULT_CHANNEL_SIZE: usize = 4096; //512; + /// Tunnel expiration, 10 minutes. const TUNNEL_EXPIRATION: Duration = Duration::from_secs(10 * 60); diff --git a/emissary-core/src/tunnel/pool/handle.rs b/emissary-core/src/tunnel/pool/handle.rs index 490bf614..cd4d47c0 100644 --- a/emissary-core/src/tunnel/pool/handle.rs +++ b/emissary-core/src/tunnel/pool/handle.rs @@ -34,6 +34,12 @@ use core::{ task::{Context, Poll}, }; +/// Channel size for tunnel pool events. +/// +/// The size of this channel needs to be large because it's shared by all messages routed through +/// the tunnel pool, including garlic messages and netdb messages. +const EVENT_CHANNEL_SIZE: usize = 2048usize; + /// Events emitted by a `TunnelPool`. #[derive(Default, Debug, Clone)] pub enum TunnelPoolEvent { @@ -267,7 +273,7 @@ impl TunnelPoolHandle { message_tx: mpsc::Sender, ) -> (Self, mpsc::Sender, oneshot::Receiver<()>) { let (shutdown_tx, shutdown_rx) = oneshot::channel(); - let (event_tx, event_rx) = mpsc::channel(64); + let (event_tx, event_rx) = mpsc::channel(EVENT_CHANNEL_SIZE); ( Self { @@ -315,7 +321,7 @@ impl TunnelPoolHandle { oneshot::Receiver<()>, ) { let (shutdown_tx, shutdown_rx) = oneshot::channel(); - let (event_tx, event_rx) = mpsc::channel(64); + let (event_tx, event_rx) = mpsc::channel(EVENT_CHANNEL_SIZE); let (message_tx, message_rx) = mpsc::with_recycle(64, TunnelMessageRecycle::default()); ( @@ -342,7 +348,7 @@ impl TunnelPoolHandle { oneshot::Receiver<()>, ) { let (shutdown_tx, shutdown_rx) = oneshot::channel(); - let (event_tx, event_rx) = mpsc::channel(64); + let (event_tx, event_rx) = mpsc::channel(EVENT_CHANNEL_SIZE); let (message_tx, message_rx) = mpsc::with_recycle(64, TunnelMessageRecycle::default()); ( diff --git a/emissary-core/src/tunnel/transit/mod.rs b/emissary-core/src/tunnel/transit/mod.rs index 38065750..82e21a04 100644 --- a/emissary-core/src/tunnel/transit/mod.rs +++ b/emissary-core/src/tunnel/transit/mod.rs @@ -79,7 +79,7 @@ const PUBLIC_KEY_OFFSET: Range = 16..48; const RECORD_START_OFFSET: RangeFrom = 48..; /// Transit tunnel channel size. -const TUNNEL_CHANNEL_SIZE: usize = 64usize; +const TUNNEL_CHANNEL_SIZE: usize = 4096usize; //2048usize; //64usize; /// Transit tunnel expiration. /// diff --git a/emissary-core/tests/sam.rs b/emissary-core/tests/sam.rs index 63ebb059..a39fce59 100644 --- a/emissary-core/tests/sam.rs +++ b/emissary-core/tests/sam.rs @@ -1447,7 +1447,7 @@ async fn connect_using_b32_i2p(kind: TransportKind) { let mut stream = tokio::time::timeout( Duration::from_secs(10), - session2.connect("fnkextln5uh3lafgvmuzcdr736cfced5f6fabdf5kq5dv5rj4jxq.b32.i2p"), + session2.connect("fnkextln5uh3lafgvmuzcdr736cfced5f6fabdf5kq5dv5rj4jxq.b32.echo"), ) .await .expect("no timeout") @@ -1706,7 +1706,7 @@ async fn host_lookup(kind: TransportKind) { .expect("no timeout") .expect("to succeed"); - let mut stream = tokio::time::timeout(Duration::from_secs(10), session2.connect("host.i2p")) + let mut stream = tokio::time::timeout(Duration::from_secs(10), session2.connect("host.echo")) .await .expect("no timeout") .expect("to succeed");