diff --git a/client/src/session_manager.rs b/client/src/session_manager.rs index f66455eb..b7303a4f 100644 --- a/client/src/session_manager.rs +++ b/client/src/session_manager.rs @@ -178,6 +178,7 @@ impl SessionManager { challenge_req: None, node_id: node_id.into_array().to_vec(), public_key: public_key.bytes().to_vec(), + supported_encryptions: vec![], }; let response = tmp_session .request::( diff --git a/client/src/session_start.rs b/client/src/session_start.rs index 8cd3c370..95cf0ed5 100644 --- a/client/src/session_start.rs +++ b/client/src/session_start.rs @@ -244,6 +244,7 @@ impl StartingSessions { .map_err(|e| InternalError::Generic(e.to_string()))?, challenge_req: None, public_key: self.layer.config.public_key().await?.bytes().to_vec(), + supported_encryptions: vec![], }; tmp_session diff --git a/crates/core/src/challenge.rs b/crates/core/src/challenge.rs index c8c94d6b..04385051 100644 --- a/crates/core/src/challenge.rs +++ b/crates/core/src/challenge.rs @@ -164,6 +164,7 @@ pub fn prepare_challenge_request() -> (proto::request::Session, [u8; CHALLENGE_S public_key: vec![], challenge_req: Some(challenge), challenge_resp: vec![], + supported_encryptions: vec![], }; (request, raw_challenge) } @@ -174,6 +175,7 @@ pub fn prepare_challenge_response() -> (proto::response::Session, [u8; CHALLENGE public_key: vec![], challenge_req: Some(challenge), challenge_resp: vec![], + supported_encryptions: vec![], }; (response, raw_challenge) } diff --git a/crates/core/src/session.rs b/crates/core/src/session.rs index 6904beeb..4af8337f 100644 --- a/crates/core/src/session.rs +++ b/crates/core/src/session.rs @@ -32,6 +32,7 @@ pub struct NodeInfo { /// Endpoints registered by Node. pub endpoints: Vec, + pub supported_encryptions: Vec, } #[derive(Clone)] diff --git a/crates/proto/protobuf/ya_relay.proto b/crates/proto/protobuf/ya_relay.proto index 4e2f3491..1ba12463 100644 --- a/crates/proto/protobuf/ya_relay.proto +++ b/crates/proto/protobuf/ya_relay.proto @@ -55,7 +55,8 @@ message Packet { message Forward { bytes session_id = 1; uint32 slot = 2; // either sender or receiver slot id - bytes payload = 3; + uint16 flags = 3; + bytes payload = 4; } */ @@ -99,6 +100,7 @@ message Request { bytes public_key = 3; ChallengeRequest challenge_req = 4; bytes challenge_resp = 5; + repeated string supported_encryptions = 6; } message Register { @@ -153,6 +155,7 @@ message Response { bytes public_key = 3; ChallengeRequest challenge_req = 4; bytes challenge_resp = 5; + repeated string supported_encryptions = 6; } /* Registered endpoints */ @@ -168,6 +171,7 @@ message Response { repeated Endpoint endpoints = 4; uint32 seen_ts = 5; uint32 slot = 6; + repeated string supported_encryptions = 7; } /* Neighbourhood */ diff --git a/crates/proto/src/codec/datagram.rs b/crates/proto/src/codec/datagram.rs index 0745c4a0..40dfb653 100644 --- a/crates/proto/src/codec/datagram.rs +++ b/crates/proto/src/codec/datagram.rs @@ -74,6 +74,7 @@ mod tests { node_id: vec![], public_key: vec![], challenge_req: None, + supported_encryptions: vec![], }) } @@ -87,6 +88,7 @@ mod tests { node_id: vec![0x0c, 0x00, 0x0f, 0x0f, 0x0e, 0x0e], public_key: vec![0x05, 0x0e, 0x0c], challenge_req: None, + supported_encryptions: vec![], }, ) .into(), @@ -97,6 +99,7 @@ mod tests { node_id: vec![0x0c, 0x00, 0x0f, 0x0f, 0x0e, 0x0e], public_key: vec![0x05, 0x0e, 0x0c], challenge_req: None, + supported_encryptions: vec![], }, ) .into(), diff --git a/crates/proto/src/codec/stream.rs b/crates/proto/src/codec/stream.rs index 8d752936..ca569ef2 100644 --- a/crates/proto/src/codec/stream.rs +++ b/crates/proto/src/codec/stream.rs @@ -343,6 +343,7 @@ mod tests { node_id: vec![0x0c, 0x00, 0x0f, 0x0f, 0x0e, 0x0e], public_key: vec![0x05, 0x0e, 0x0c], challenge_req: None, + supported_encryptions: vec![], }, ) .into(), @@ -408,6 +409,7 @@ mod tests { node_id: vec![], public_key: vec![], challenge_req: None, + supported_encryptions: vec![], })), })), }), diff --git a/crates/proto/src/proto.rs b/crates/proto/src/proto.rs index d7dae961..4d24a2bb 100644 --- a/crates/proto/src/proto.rs +++ b/crates/proto/src/proto.rs @@ -19,6 +19,7 @@ pub const FORWARD_TAG: u32 = 1; pub const SESSION_ID_SIZE: usize = 16; pub const KEY_SIZE: usize = 1; pub const UNRELIABLE_FLAG: u16 = 0x01; +pub const ENCRYPTED_FLAG: u16 = 0x02; static REQUEST_ID: AtomicU64 = AtomicU64::new(0); diff --git a/server/src/server.rs b/server/src/server.rs index bfaf3f26..11bf882f 100644 --- a/server/src/server.rs +++ b/server/src/server.rs @@ -656,6 +656,7 @@ impl Server { public_key: session.public_key, slot: u32::MAX, endpoints: vec![], + supported_encryptions: vec![], }; let node = NodeSession { @@ -962,5 +963,6 @@ pub fn to_node_response(node_info: NodeSession, public_key: bool) -> proto::resp .collect(), seen_ts: node_info.last_seen.timestamp() as u32, slot: node_info.info.slot, + supported_encryptions: node_info.info.supported_encryptions, } }