From ba184851b05fe67ba34c68a414efe2da79442681 Mon Sep 17 00:00:00 2001 From: driftluo Date: Mon, 2 Dec 2024 19:25:36 +0800 Subject: [PATCH] feat: default listen on ws port --- Cargo.lock | 13 +++++++------ resource/ckb.toml | 4 ++-- util/app-config/src/tests/app_config.rs | 20 ++++++++++++++++---- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf8fb89453..76598211da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5894,14 +5894,15 @@ dependencies = [ [[package]] name = "tentacle" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6218c3269605008b5e88f4e91fa2e98e20491213c464dc6da8370858db89d92b" +checksum = "19a42caa9f5a8bf3f40b75b4e8e4bf1dcacf92998463afce9cfe5e5e4824de9a" dependencies = [ "async-trait", "bytes", "futures", "futures-timer", + "httparse", "igd-next", "js-sys", "libc", @@ -5938,9 +5939,9 @@ dependencies = [ [[package]] name = "tentacle-secio" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99df015b8649588f2958d4853eee221860f95d2721995857e9dde1462ceb3dc4" +checksum = "53d53673d63399e1d557c2e884b045d242811079d3b2f17a569310e5c3f1db33" dependencies = [ "bs58", "bytes", @@ -6234,9 +6235,9 @@ dependencies = [ [[package]] name = "tokio-yamux" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "208cecd45a38868bfc0a45aac52cb1aea4583c6b801bf57f351e9d531b23cb86" +checksum = "966579a01e6900c22634f5915fda56358496e71067f3dd26572f9fbe85f4b62e" dependencies = [ "bytes", "futures", diff --git a/resource/ckb.toml b/resource/ckb.toml index 68cf8e2fd8..3df8e09dde 100644 --- a/resource/ckb.toml +++ b/resource/ckb.toml @@ -63,8 +63,8 @@ cache_size = 268435456 options_file = "default.db-options" [network] -listen_addresses = ["/ip4/0.0.0.0/tcp/8115"] # {{ -# _ => listen_addresses = ["/ip4/0.0.0.0/tcp/{p2p_port}"] +listen_addresses = ["/ip4/0.0.0.0/tcp/8115", "/ip4/0.0.0.0/tcp/8115/ws"] # {{ +# _ => listen_addresses = ["/ip4/0.0.0.0/tcp/{p2p_port}", "/ip4/0.0.0.0/tcp/{p2p_port}/ws"] # }} ### Specify the public and routable network addresses # public_addresses = [] diff --git a/util/app-config/src/tests/app_config.rs b/util/app-config/src/tests/app_config.rs index 52fcd4b163..68d1de7218 100644 --- a/util/app-config/src/tests/app_config.rs +++ b/util/app-config/src/tests/app_config.rs @@ -55,7 +55,10 @@ fn test_export_dev_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); @@ -148,7 +151,10 @@ fn test_export_testnet_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); @@ -200,7 +206,10 @@ fn test_export_integration_config_files() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000"); } @@ -252,7 +261,10 @@ fn test_export_dev_config_files_assembly() { ); assert_eq!( ckb_config.network.listen_addresses, - vec!["/ip4/0.0.0.0/tcp/8000".parse().unwrap()] + vec![ + "/ip4/0.0.0.0/tcp/8000".parse().unwrap(), + "/ip4/0.0.0.0/tcp/8000/ws".parse().unwrap() + ] ); assert_eq!(ckb_config.network.connect_outbound_interval_secs, 15); assert_eq!(ckb_config.rpc.listen_address, "127.0.0.1:7000");