diff --git a/implementations/rust/ockam/ockam_api/src/nodes/models/transport/request.rs b/implementations/rust/ockam/ockam_api/src/nodes/models/transport/request.rs index a1cc387b25e..c571630ccd0 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/models/transport/request.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/models/transport/request.rs @@ -35,7 +35,7 @@ impl CreateTcpListener { #[rustfmt::skip] #[cbor(map)] pub struct DeleteTransport { - /// The transport ID to delete + /// The transport processor address or socket address to delete #[n(1)] pub address: String, } diff --git a/implementations/rust/ockam/ockam_api/src/nodes/models/transport/response.rs b/implementations/rust/ockam/ockam_api/src/nodes/models/transport/response.rs index 32e75ca93c2..46e27e93bbb 100644 --- a/implementations/rust/ockam/ockam_api/src/nodes/models/transport/response.rs +++ b/implementations/rust/ockam/ockam_api/src/nodes/models/transport/response.rs @@ -10,7 +10,7 @@ use ockam_transport_tcp::{TcpConnection, TcpListener, TcpListenerInfo, TcpSender use std::net::SocketAddrV4; /// Response body when interacting with a transport -#[derive(Debug, Clone, Decode, Encode)] +#[derive(Debug, Clone, Decode, Encode, serde::Serialize)] #[rustfmt::skip] #[cbor(map)] pub struct TransportStatus { diff --git a/implementations/rust/ockam/ockam_command/src/node/mod.rs b/implementations/rust/ockam/ockam_command/src/node/mod.rs index ce3d1ea4e8e..98aab0b7fb4 100644 --- a/implementations/rust/ockam/ockam_command/src/node/mod.rs +++ b/implementations/rust/ockam/ockam_command/src/node/mod.rs @@ -76,7 +76,7 @@ impl NodeCommand { #[derive(Clone, Debug, Args)] pub struct NodeOpts { - /// Perform the command on the given NODE_NAME + /// Perform the command on the given node #[arg(global = true, id = "at", value_name = "NODE_NAME", long, value_parser = extract_address_value)] pub at_node: Option, } diff --git a/implementations/rust/ockam/ockam_command/src/node/start.rs b/implementations/rust/ockam/ockam_command/src/node/start.rs index 58a0219ece5..b98da07d1f9 100644 --- a/implementations/rust/ockam/ockam_command/src/node/start.rs +++ b/implementations/rust/ockam/ockam_command/src/node/start.rs @@ -23,9 +23,6 @@ after_long_help = docs::after_help(AFTER_LONG_HELP) pub struct StartCommand { /// Name of the node to be started node_name: Option, - - #[arg(long, default_value = "false")] - aws_kms: bool, } impl StartCommand { diff --git a/implementations/rust/ockam/ockam_command/src/node/static/logs/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/node/static/logs/after_long_help.txt index c6db8331606..633791ae76a 100644 --- a/implementations/rust/ockam/ockam_command/src/node/static/logs/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/node/static/logs/after_long_help.txt @@ -2,9 +2,6 @@ # Return the path to the stdout log file of the default node $ ockam node logs -# Return the path to the stderr log file of the given node -$ ockam node logs n --err - # Pipe the logs to a file into another tool to process it $ cat < $(ockam node logs n) ``` diff --git a/implementations/rust/ockam/ockam_command/src/relay/create.rs b/implementations/rust/ockam/ockam_command/src/relay/create.rs index 575ae2d4ecb..abe1e9200ca 100644 --- a/implementations/rust/ockam/ockam_command/src/relay/create.rs +++ b/implementations/rust/ockam/ockam_command/src/relay/create.rs @@ -40,7 +40,7 @@ pub struct CreateCommand { relay_name: String, /// Node for which to create the relay - #[arg(long, id = "NODE", value_parser = extract_address_value)] + #[arg(long, id = "NODE_NAME", value_parser = extract_address_value)] to: Option, /// Route to the node at which to create the relay diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/create.rs b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/create.rs index 2c7db4a9843..2e71c038bf4 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/create.rs +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/create.rs @@ -81,7 +81,8 @@ async fn run_impl( .to_string() .color(OckamColor::PrimaryResource.color()) ) + &fmt_log!( - "At node /node/{}", + "At node {}{}", + "/node/".color(OckamColor::PrimaryResource.color()), node.node_name().color(OckamColor::PrimaryResource.color()) ), ) diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/create/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/create/after_long_help.txt index cb72113e725..06464bd1194 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/create/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/create/after_long_help.txt @@ -1,9 +1,14 @@ ```sh +$ ockam node create n1 +$ ockam node create n2 + # Create a secure channel listener with a custom name on the default node $ ockam secure-channel-listener create test --at n2 -/service/test + ✔ Secure Channel Listener at /service/test created successfully + At node /node/n2 # Create a secure channel from n1 to our test secure channel listener on n2 -$ ockam secure-channel create --from /node/n1 --to /node/n2/service/test -/service/09738b73c54b81d48531f659aaa22533 +$ ockam secure-channel create --from /node/n1 --to /node/n2/service/api + ✔ Secure Channel at /service/5c2a940cf008783cfd8d7012e772d674 created successfully + From /node/n1 to /node/n2/service/api ``` diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/delete/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/delete/after_long_help.txt index 5a625d61771..86fe62ccc88 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/delete/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/delete/after_long_help.txt @@ -1,3 +1,3 @@ ```sh -$ ockam secure-channel-listener delete scaddr --at n1 +$ ockam secure-channel-listener delete 8eb3bfc8a6419f24c05ddd627d144bec --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/show/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/show/after_long_help.txt index 71dddf9dbc4..896ffe1039b 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/show/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/listener/static/show/after_long_help.txt @@ -1,3 +1,3 @@ ```sh -$ ockam secure-channel-listener show scaddr --at n1 +$ ockam secure-channel-listener show 8eb3bfc8a6419f24c05ddd627d144bec --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/static/create/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/static/create/after_long_help.txt index 28fca466827..e05ca2be5e1 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/static/create/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/static/create/after_long_help.txt @@ -4,10 +4,8 @@ Every node, created with Ockam Command, starts a secure channel listener at addr $ ockam node create a $ ockam node create b $ ockam secure-channel create --from a --to /node/b/service/api - Created Secure Channel: - • From: /node/a - • To: /node/b/service/api (/ip4/127.0.0.1/tcp/53483/service/api) - • At: /service/d92ef0aea946ec01cdbccc5b9d3f2e16 + ✔ Secure Channel at /service/a2b1a2275d02308a7920499b5f49e4ee created successfully + From /node/n1 to /node/n2/service/api $ ockam message send hello --from a --to /service/d92ef0aea946ec01cdbccc5b9d3f2e16/service/uppercase HELLO diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/static/delete/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/static/delete/after_long_help.txt index 5d6b52d6068..20f74303206 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/static/delete/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/static/delete/after_long_help.txt @@ -1,3 +1,3 @@ ```sh -$ ockam secure-channel delete scaddr --at n1 +$ ockam secure-channel delete 8eb3bfc8a6419f24c05ddd627d144bec --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/secure_channel/static/show/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/secure_channel/static/show/after_long_help.txt index dad6a35e19d..1aca702730b 100644 --- a/implementations/rust/ockam/ockam_command/src/secure_channel/static/show/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/secure_channel/static/show/after_long_help.txt @@ -1,3 +1,3 @@ ```sh -$ ockam secure-channel show scaddr --at n1 +$ ockam secure-channel show 8eb3bfc8a6419f24c05ddd627d144bec --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/connection/delete.rs b/implementations/rust/ockam/ockam_command/src/tcp/connection/delete.rs index 3ef5389b71e..357b66e0e9c 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/connection/delete.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/connection/delete.rs @@ -17,7 +17,7 @@ pub struct DeleteCommand { #[command(flatten)] node_opts: NodeOpts, - /// TCP connection ID + /// TCP connection internal address or socket address pub address: String, /// Confirm the deletion without prompting diff --git a/implementations/rust/ockam/ockam_command/src/tcp/connection/list.rs b/implementations/rust/ockam/ockam_command/src/tcp/connection/list.rs index 19ff3714ff6..c301dfcb746 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/connection/list.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/connection/list.rs @@ -88,14 +88,7 @@ impl Output for TransportStatus { )?; writeln!( output, - "Worker {}", - self.worker_addr - .to_string() - .color(OckamColor::PrimaryResource.color()) - )?; - writeln!( - output, - "Processor {}", + "Internal Address {}", self.processor_address .to_string() .color(OckamColor::PrimaryResource.color()) @@ -103,7 +96,7 @@ impl Output for TransportStatus { write!( output, - "{}", + "Socket Address {}", self.socket_addr .to_string() .color(OckamColor::PrimaryResource.color()) diff --git a/implementations/rust/ockam/ockam_command/src/tcp/connection/show.rs b/implementations/rust/ockam/ockam_command/src/tcp/connection/show.rs index 88b1ad49912..31d1102725d 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/connection/show.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/connection/show.rs @@ -21,7 +21,7 @@ pub struct ShowCommand { #[command(flatten)] pub node_opts: NodeOpts, - /// TCP connection Worker Address or Tcp Address + /// TCP connection internal address or socket address pub address: String, } diff --git a/implementations/rust/ockam/ockam_command/src/tcp/connection/static/delete/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/tcp/connection/static/delete/after_long_help.txt index c83cda9a0ec..519a54912c1 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/connection/static/delete/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/tcp/connection/static/delete/after_long_help.txt @@ -1,7 +1,10 @@ ```sh -# To delete a TCP connection given its ID on the default node +# To delete a TCP connection given its internal address on the default node $ ockam tcp-connection delete d59c01ab8d9683f8c454df746e627b43 -# To delete a TCP connection given its ID on a specific node +# To delete a TCP connection given its socket address on the default node +$ ockam tcp-connection delete 127.0.0.1:5000 + +# To delete a TCP connection given its internal address on a specific node $ ockam tcp-connection delete d59c01ab8d9683f8c454df746e627b43 --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/connection/static/show/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/tcp/connection/static/show/after_long_help.txt index ac587819460..09e63412442 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/connection/static/show/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/tcp/connection/static/show/after_long_help.txt @@ -1,4 +1,7 @@ ```sh -# To show a TCP connection given its ID +# To show a TCP connection given its internal address $ ockam tcp-connection show d59c01ab8d9683f8c454df746e627b43 + +# To show a TCP connection given its socket address +$ ockam tcp-connection show 127.0.0.1:5000 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/inlet/create.rs b/implementations/rust/ockam/ockam_command/src/tcp/inlet/create.rs index 24dd6b8244f..d4ee83e0f91 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/inlet/create.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/inlet/create.rs @@ -36,7 +36,7 @@ const AFTER_LONG_HELP: &str = include_str!("./static/create/after_long_help.txt" #[command(after_long_help = docs::after_help(AFTER_LONG_HELP))] pub struct CreateCommand { /// Node on which to start the tcp inlet. - #[arg(long, display_order = 900, id = "NODE", value_parser = extract_address_value)] + #[arg(long, display_order = 900, id = "NODE_NAME", value_parser = extract_address_value)] at: Option, /// Address on which to accept tcp connections. diff --git a/implementations/rust/ockam/ockam_command/src/tcp/inlet/static/delete/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/tcp/inlet/static/delete/after_long_help.txt index 0333b9fb55f..8c67e8f52ca 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/inlet/static/delete/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/tcp/inlet/static/delete/after_long_help.txt @@ -2,6 +2,6 @@ # To delete a TCP inlet given its alias on the default node $ ockam tcp-inlet delete myinlet -# To delete a TCP inlet given its ID on a specific node +# To delete a TCP inlet given its alias on a specific node $ ockam tcp-inlet delete myinlet --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/listener/delete.rs b/implementations/rust/ockam/ockam_command/src/tcp/listener/delete.rs index 0dcac3b1484..2c74223deac 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/listener/delete.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/listener/delete.rs @@ -20,7 +20,7 @@ pub struct DeleteCommand { #[command(flatten)] node_opts: NodeOpts, - /// Tcp Listener ID + /// TCP Listener internal address pub address: String, /// Confirm the deletion without prompting diff --git a/implementations/rust/ockam/ockam_command/src/tcp/listener/show.rs b/implementations/rust/ockam/ockam_command/src/tcp/listener/show.rs index 52aaeb70c9c..1a98946abab 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/listener/show.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/listener/show.rs @@ -1,5 +1,5 @@ use clap::Args; -use indoc::formatdoc; +use miette::IntoDiagnostic; use ockam::Context; use ockam_api::nodes::models::transport::TransportStatus; @@ -7,6 +7,7 @@ use ockam_api::nodes::BackgroundNode; use ockam_core::api::Request; use crate::node::NodeOpts; +use crate::output::Output; use crate::util::node_rpc; use crate::{docs, CommandGlobalOpts}; @@ -22,7 +23,7 @@ pub struct ShowCommand { #[command(flatten)] pub node_opts: NodeOpts, - /// TCP listener Worker Address or Tcp Address + /// TCP listener internal address or socket address pub address: String, } @@ -43,26 +44,10 @@ async fn run_impl( Request::get(format!("/node/tcp/listener/{}", &cmd.address)), ) .await?; - - let TransportStatus { - tt, - tm, - socket_addr, - processor_address, - flow_control_id, - .. - } = transport_status; - - let plain = formatdoc! {r#" - TCP Listener: - Type: {tt} - Mode: {tm} - Socket address: {socket_addr} - Worker address: {processor_address} - Flow Control Id: {flow_control_id} - "#}; - - opts.terminal.stdout().plain(plain).write_line()?; - + opts.terminal + .stdout() + .plain(transport_status.output()?) + .json(serde_json::to_string(&transport_status).into_diagnostic()?) + .write_line()?; Ok(()) } diff --git a/implementations/rust/ockam/ockam_command/src/tcp/listener/static/delete/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/tcp/listener/static/delete/after_long_help.txt index 14679aabd6b..aaa7f4f9e00 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/listener/static/delete/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/tcp/listener/static/delete/after_long_help.txt @@ -1,7 +1,10 @@ ```sh -# To delete a TCP listener given its ID on the default node +# To delete a TCP listener given its internal address on the default node $ ockam tcp-listener delete d59c01ab8d9683f8c454df746e627b43 -# To delete a TCP listener given its ID on a specific node +# To delete a TCP listener given its socket address on the default node +$ ockam tcp-listener delete 127.0.0.1:5000 + +# To delete a TCP listener given its internal address on a specific node $ ockam tcp-listener delete d59c01ab8d9683f8c454df746e627b43 --at n1 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/listener/static/show/after_long_help.txt b/implementations/rust/ockam/ockam_command/src/tcp/listener/static/show/after_long_help.txt index 389dce0be8e..7bbfea80f15 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/listener/static/show/after_long_help.txt +++ b/implementations/rust/ockam/ockam_command/src/tcp/listener/static/show/after_long_help.txt @@ -1,4 +1,7 @@ ```sh -# To show a TCP listener given its ID +# To show a TCP listener given its internal address $ ockam tcp-listener show d59c01ab8d9683f8c454df746e627b43 + +# To show a TCP listener given its socket address +$ ockam tcp-listener show 127.0.0.1:5000 ``` diff --git a/implementations/rust/ockam/ockam_command/src/tcp/outlet/create.rs b/implementations/rust/ockam/ockam_command/src/tcp/outlet/create.rs index b18da1a5a37..8425fe9f7fd 100644 --- a/implementations/rust/ockam/ockam_command/src/tcp/outlet/create.rs +++ b/implementations/rust/ockam/ockam_command/src/tcp/outlet/create.rs @@ -29,7 +29,7 @@ const AFTER_LONG_HELP: &str = include_str!("./static/create/after_long_help.txt" #[command(after_long_help = docs::after_help(AFTER_LONG_HELP))] pub struct CreateCommand { /// Node on which to start the tcp outlet. - #[arg(long, display_order = 900, id = "NODE", value_parser = extract_address_value)] + #[arg(long, display_order = 900, id = "NODE_NAME", value_parser = extract_address_value)] at: Option, /// Address of the tcp outlet. diff --git a/implementations/rust/ockam/ockam_command/src/terminal/fmt.rs b/implementations/rust/ockam/ockam_command/src/terminal/fmt.rs index da14b6c5668..f4687f90230 100644 --- a/implementations/rust/ockam/ockam_command/src/terminal/fmt.rs +++ b/implementations/rust/ockam/ockam_command/src/terminal/fmt.rs @@ -12,14 +12,14 @@ macro_rules! fmt_log { macro_rules! fmt_ok { ($input:expr) => { format!("{} {}", - " ✔︎" + " ✔" .color($crate::terminal::OckamColor::FmtOKBackground.color()) .bold(), format!($input)) }; ($input:expr, $($args:expr),+) => { format!("{} {}", - " ✔︎" + " ✔" .color($crate::terminal::OckamColor::FmtOKBackground.color()) .bold(), format!($input, $($args),+)) diff --git a/implementations/rust/ockam/ockam_command/src/worker/list.rs b/implementations/rust/ockam/ockam_command/src/worker/list.rs index 500f18c68d2..97858e66984 100644 --- a/implementations/rust/ockam/ockam_command/src/worker/list.rs +++ b/implementations/rust/ockam/ockam_command/src/worker/list.rs @@ -26,7 +26,7 @@ after_long_help = docs::after_help(AFTER_LONG_HELP) )] pub struct ListCommand { /// Node at which to lookup workers - #[arg(value_name = "NODE", long, display_order = 800, value_parser = extract_address_value)] + #[arg(value_name = "NODE_NAME", long, display_order = 800, value_parser = extract_address_value)] at: Option, }