Skip to content

Commit 8487642

Browse files
authored
Use IPR v7 consistently (#2305)
* Use IPR v7 consistently * Update to latest dorina
1 parent f689a46 commit 8487642

File tree

10 files changed

+91
-92
lines changed

10 files changed

+91
-92
lines changed

nym-vpn-core/Cargo.lock

Lines changed: 76 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

nym-vpn-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ default-members = [
4242
# For local development
4343
# [patch."https://github.com/nymtech/nym"]
4444
# nym-authenticator-requests = { path = "../../nym/common/authenticator-requests" }
45+
# nym-api-requests = { path = "../../nym/nym-api/nym-api-requests" }
4546
# nym-bandwidth-controller = { path = "../../nym/common/bandwidth-controller" }
4647
# nym-bin-common = { path = "../../nym/common/bin-common" }
4748
# nym-client-core = { path = "../../nym/common/client-core" }

nym-vpn-core/crates/nym-gateway-probe/src/icmp.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use nym_connection_monitor::{
1010
ConnectionStatusEvent, IcmpBeaconReply, Icmpv6BeaconReply,
1111
};
1212
use nym_gateway_directory::IpPacketRouterAddress;
13-
use nym_ip_packet_requests::{codec::MultiIpPacketCodec, IpPair};
13+
use nym_ip_packet_requests::{codec::MultiIpPacketCodec, v7::request::IpPacketRequest, IpPair};
1414
use nym_mixnet_client::SharedMixnetClient;
1515
use nym_sdk::mixnet::{InputMessage, Recipient};
1616
use nym_task::connections::TransmissionLane;
@@ -73,9 +73,7 @@ pub async fn send_ping_v6(
7373
}
7474

7575
fn create_input_message(recipient: Recipient, bundled_packets: Bytes) -> Result<InputMessage> {
76-
let packet =
77-
nym_ip_packet_requests::request::IpPacketRequest::new_data_request(bundled_packets)
78-
.to_bytes()?;
76+
let packet = IpPacketRequest::new_data_request(bundled_packets).to_bytes()?;
7977

8078
let lane = TransmissionLane::General;
8179
let packet_type = None;

nym-vpn-core/crates/nym-gateway-probe/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ use nym_gateway_directory::{
3131
use nym_ip_packet_client::IprClientConnect;
3232
use nym_ip_packet_requests::{
3333
codec::MultiIpPacketCodec,
34-
response::{DataResponse, InfoLevel, IpPacketResponse, IpPacketResponseData},
34+
v7::response::{DataResponse, InfoLevel, IpPacketResponse, IpPacketResponseData},
3535
IpPair,
3636
};
3737
use nym_mixnet_client::SharedMixnetClient;

nym-vpn-core/crates/nym-ip-packet-client/src/connect.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ use tokio_util::sync::CancellationToken;
1010
use tracing::{debug, error};
1111

1212
use crate::{
13-
error::{Error, Result},
14-
helpers::check_ipr_message_version,
15-
nym_ip_packet_requests_current::{
13+
current::{
1614
request::IpPacketRequest,
1715
response::{
1816
DynamicConnectResponse, DynamicConnectResponseReply, IpPacketResponse,
1917
IpPacketResponseData, StaticConnectResponse, StaticConnectResponseReply,
2018
},
2119
},
20+
error::{Error, Result},
21+
helpers::check_ipr_message_version,
2222
};
2323

2424
const IPR_CONNECT_TIMEOUT: Duration = Duration::from_secs(10);

nym-vpn-core/crates/nym-ip-packet-client/src/error.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
// Copyright 2024 - Nym Technologies SA <[email protected]>
22
// SPDX-License-Identifier: GPL-3.0-only
33

4-
use crate::nym_ip_packet_requests_current::response::{
5-
DynamicConnectFailureReason, StaticConnectFailureReason,
6-
};
4+
use crate::current::response::{DynamicConnectFailureReason, StaticConnectFailureReason};
75

86
#[derive(thiserror::Error, Debug)]
97
pub enum Error {

nym-vpn-core/crates/nym-ip-packet-client/src/helpers.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ use std::cmp::Ordering;
55

66
use nym_sdk::mixnet::ReconstructedMessage;
77

8-
use crate::{error::Result, nym_ip_packet_requests_current::VERSION as CURRENT_VERSION, Error};
8+
use crate::{current::VERSION as CURRENT_VERSION, error::Result, Error};
99

1010
pub(crate) fn check_ipr_message_version(message: &ReconstructedMessage) -> Result<()> {
11-
// Assuing it's a IPR message, it will have a version as its first byte
11+
// Assuming it's a IPR message, it will have a version as its first byte
1212
if let Some(version) = message.message.first() {
1313
match version.cmp(&CURRENT_VERSION) {
1414
Ordering::Greater => Err(Error::ReceivedResponseWithNewVersion {

nym-vpn-core/crates/nym-ip-packet-client/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ pub use connect::IprClientConnect;
1010
pub use error::Error;
1111
pub use listener::{IprListener, MixnetMessageOutcome};
1212

13-
pub(crate) use nym_ip_packet_requests::v7 as nym_ip_packet_requests_current;
13+
// Re-export the currently used version
14+
pub use nym_ip_packet_requests::v7 as current;

nym-vpn-core/crates/nym-ip-packet-client/src/listener.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ use tokio_util::codec::Decoder;
88
use tracing::{debug, error, info, warn};
99

1010
use crate::{
11-
helpers::check_ipr_message_version,
12-
nym_ip_packet_requests_current::{
11+
current::{
1312
request::{IpPacketRequest, IpPacketRequestData},
1413
response::{InfoLevel, IpPacketResponse, IpPacketResponseData},
1514
},
15+
helpers::check_ipr_message_version,
1616
};
1717

1818
pub enum MixnetMessageOutcome {

nym-vpn-core/crates/nym-vpn-lib/src/mixnet/processor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::result::Result;
66
use bytes::Bytes;
77
use futures::{channel::mpsc, StreamExt};
88
use nym_connection_monitor::{ConnectionMonitorTask, ConnectionStatusEvent};
9-
use nym_ip_packet_requests::{codec::MultiIpPacketCodec, request::IpPacketRequest};
9+
use nym_ip_packet_requests::{codec::MultiIpPacketCodec, v7::request::IpPacketRequest};
1010
use nym_mixnet_client::SharedMixnetClient;
1111
use nym_sdk::mixnet::{InputMessage, MixnetMessageSender, Recipient};
1212
use nym_task::{connections::TransmissionLane, TaskClient, TaskManager};

0 commit comments

Comments
 (0)