Skip to content

Commit

Permalink
feat(rust): improvements to portals commands arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianbenavides committed Nov 12, 2024
1 parent f81633e commit 4956f6c
Show file tree
Hide file tree
Showing 44 changed files with 911 additions and 359 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ async fn start_node(ctx: Context, project_information_path: &str, token: OneTime
// 4. create a tcp outlet with the above policy
tcp.create_outlet(
"outlet",
HostnamePort::new("127.0.0.1", 5000),
HostnamePort::new("127.0.0.1", 5000)?,
TcpOutletOptions::new()
.with_incoming_access_control_impl(incoming_access_control)
.with_outgoing_access_control_impl(outgoing_access_control),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl KafkaInletController {
}

let inlet_bind_address =
HostnamePort::new(inner.bind_hostname.clone(), inner.current_port);
HostnamePort::new(inner.bind_hostname.clone(), inner.current_port)?;

let node_manager = self.node_manager.upgrade().ok_or_else(|| {
Error::new(Origin::Node, Kind::Internal, "node manager was shut down")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ async fn producer__flow_with_mock_kafka__content_encryption_and_decryption(
.tcp
.create_outlet(
"kafka_consumer_outlet",
HostnamePort::new("127.0.0.1", consumer_mock_kafka.port),
HostnamePort::new("127.0.0.1", consumer_mock_kafka.port)?,
TcpOutletOptions::new(),
)
.await?;
Expand All @@ -181,7 +181,7 @@ async fn producer__flow_with_mock_kafka__content_encryption_and_decryption(
.tcp
.create_outlet(
"kafka_producer_outlet",
HostnamePort::new("127.0.0.1", producer_mock_kafka.port),
HostnamePort::new("127.0.0.1", producer_mock_kafka.port)?,
TcpOutletOptions::new(),
)
.await?;
Expand Down Expand Up @@ -217,7 +217,7 @@ async fn producer__flow_with_mock_kafka__content_encryption_and_decryption(
.tcp
.create_outlet(
"kafka_consumer_outlet",
HostnamePort::new("127.0.0.1", consumer_mock_kafka.port),
HostnamePort::new("127.0.0.1", consumer_mock_kafka.port)?,
TcpOutletOptions::new(),
)
.await?;
Expand Down
5 changes: 4 additions & 1 deletion implementations/rust/ockam/ockam_api/src/nodes/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ mod tests {
}

fn outlet_info(worker_addr: Address) -> OutletInfo {
OutletInfo::new(HostnamePort::new("127.0.0.1", 0), Some(&worker_addr))
OutletInfo::new(
HostnamePort::new("127.0.0.1", 0).unwrap(),
Some(&worker_addr),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl RendezvousHealthcheck {
udp_socket_address: SocketAddr,
) -> Result<Self> {
let peer = if udp_socket_address.ip().is_unspecified() {
HostnamePort::new("localhost", udp_socket_address.port()).to_string()
HostnamePort::new("localhost", udp_socket_address.port())?.to_string()
} else {
udp_socket_address.to_string()
};
Expand Down
2 changes: 1 addition & 1 deletion implementations/rust/ockam/ockam_api/tests/latency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ pub fn measure_buffer_latency_two_nodes_portal() {
.node_manager
.create_inlet(
&first_node.context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
second_node_listen_address
Expand Down
10 changes: 5 additions & 5 deletions implementations/rust/ockam/ockam_api/tests/portals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ async fn inlet_outlet_local_successful(context: &mut Context) -> ockam::Result<(
.node_manager
.create_inlet(
context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
MultiAddr::from_str("/secure/api/service/outlet")?,
Expand Down Expand Up @@ -122,7 +122,7 @@ fn portal_node_goes_down_reconnect() {
.node_manager
.create_inlet(
&first_node.context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
second_node_listen_address
Expand Down Expand Up @@ -280,7 +280,7 @@ fn portal_low_bandwidth_connection_keep_working_for_60s() {
.node_manager
.create_inlet(
&first_node.context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
InternetAddress::from(passthrough_server_handle.chosen_addr)
Expand Down Expand Up @@ -394,7 +394,7 @@ fn portal_heavy_load_exchanged() {
.node_manager
.create_inlet(
&first_node.context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
second_node_listen_address
Expand Down Expand Up @@ -547,7 +547,7 @@ fn test_portal_payload_transfer(outgoing_disruption: Disruption, incoming_disrup
.node_manager
.create_inlet(
&first_node.context,
HostnamePort::new("127.0.0.1", 0),
HostnamePort::new("127.0.0.1", 0)?,
route![],
route![],
InternetAddress::from(passthrough_server_handle.chosen_addr)
Expand Down
1 change: 1 addition & 0 deletions implementations/rust/ockam/ockam_command/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_yaml = "0.9"
shellexpand = { version = "3.1.0", default-features = false, features = ["base-0"] }
strum = { version = "0.26.3", default-features = false, features = ["derive"] }
syntect = { version = "5.2.0", default-features = false, features = ["default-syntaxes", "regex-onig"] }
thiserror = "1"
tokio = { version = "1.41.0", features = ["full"] }
Expand Down
Loading

0 comments on commit 4956f6c

Please sign in to comment.