-
Notifications
You must be signed in to change notification settings - Fork 263
Feature Noise XKpsk3 integration #4360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
786ff31
augment self described API with NoiseInformation field
simonwicky 0d841e5
augment Nym-API described with Noise Info
simonwicky 5908741
adapt noise support to PR chain merge order
simonwicky 7363cda
apply octlol unwrap or default suggestion
simonwicky d4a2be8
augment topology with described nodes
simonwicky 580457a
add epoch in validator client
simonwicky 0a826b8
add topology access to nodes
simonwicky 8c29fba
move topology control into its own crate
simonwicky fbbd634
apply octlol suggestion
simonwicky 6924f29
changes on nym-connect and wasm client
simonwicky a16b21c
cargo fmt
simonwicky 54feb9e
add main noise logic
simonwicky e4425f9
add noise connection in nodes
simonwicky 06f1271
enable noise support in self described API
simonwicky 293cf2f
apply some of octlol's suggestion
simonwicky e2fa1ae
apply octlol's type suggestion
simonwicky e57fcf4
Merge branch 'develop' into simon/noise_nodes
simonwicky 49588e0
Merge branch 'develop' into simon/noise_nodes
simonwicky 7ec35fe
Merge commit '0e56d8c2f733f37ae5cdeace779b58083b12baeb' into simon/no…
simonwicky 30a1f55
change mix_host in Node to a vec
simonwicky a0e3610
change key retrieval to use bond info
simonwicky 2e12c20
update cargo lock
simonwicky 3846d3c
comment change according to review
simonwicky 6b1657a
apply jstuczyn suggestion
simonwicky 4d273ea
change to psk structure and port checking to allow same ip
simonwicky 011be0d
remove outdated comments
simonwicky 5a9c391
change license
simonwicky 4b3dcb6
Feature Noise XKpsk3 : Fix localnet (#4465)
simonwicky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| // Copyright 2023 - Nym Technologies SA <[email protected]> | ||
| // SPDX-License-Identifier: GPL-3.0-only | ||
|
|
||
| use nym_api_requests::models::NymNodeDescription; | ||
| use nym_config::defaults::DEFAULT_HTTP_API_LISTENING_PORT; | ||
| use nym_contracts_common::IdentityKey; | ||
| use nym_mixnet_contract_common::MixNode; | ||
| use nym_node_requests::api::client::NymNodeApiClientExt; | ||
|
|
||
| use super::NodeDescribeCacheError; | ||
|
|
||
| //this is a copy of try_get_client but for mixnode, to be deleted after smoosh probably | ||
| async fn try_get_client( | ||
| mixnode: &MixNode, | ||
| ) -> Result<nym_node_requests::api::Client, NodeDescribeCacheError> { | ||
| let mixnode_host = &mixnode.host; | ||
|
|
||
| // first try the standard port in case the operator didn't put the node behind the proxy, | ||
| // then default https (443) | ||
| // finally default http (80) | ||
| let addresses_to_try = vec![ | ||
| format!("http://{mixnode_host}:{DEFAULT_HTTP_API_LISTENING_PORT}"), | ||
| format!("https://{mixnode_host}"), | ||
| format!("http://{mixnode_host}"), | ||
| ]; | ||
|
|
||
| for address in addresses_to_try { | ||
| // if provided host was malformed, no point in continuing | ||
| let client = match nym_node_requests::api::Client::new_url(address, None) { | ||
| Ok(client) => client, | ||
| Err(err) => { | ||
| return Err(NodeDescribeCacheError::MalformedHost { | ||
| host: mixnode_host.clone(), | ||
| gateway: mixnode.identity_key.clone(), | ||
| source: err, | ||
| }); | ||
| } | ||
| }; | ||
| if let Ok(health) = client.get_health().await { | ||
| if health.status.is_up() { | ||
| return Ok(client); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Err(NodeDescribeCacheError::NoHttpPortsAvailable { | ||
| host: mixnode_host.clone(), | ||
| gateway: mixnode.identity_key.clone(), | ||
| }) | ||
| } | ||
|
|
||
| pub(crate) async fn get_mixnode_description( | ||
| mixnode: MixNode, | ||
| ) -> Result<(IdentityKey, NymNodeDescription), NodeDescribeCacheError> { | ||
| let client = try_get_client(&mixnode).await?; | ||
|
|
||
| let host_info = | ||
| client | ||
| .get_host_information() | ||
| .await | ||
| .map_err(|err| NodeDescribeCacheError::ApiFailure { | ||
| gateway: mixnode.identity_key.clone(), | ||
| source: err, | ||
| })?; | ||
|
|
||
| if !host_info.verify_host_information() { | ||
| return Err(NodeDescribeCacheError::MissignedHostInformation { | ||
| gateway: mixnode.identity_key, | ||
| }); | ||
| } | ||
|
|
||
| let build_info = | ||
| client | ||
| .get_build_information() | ||
| .await | ||
| .map_err(|err| NodeDescribeCacheError::ApiFailure { | ||
| gateway: mixnode.identity_key.clone(), | ||
| source: err, | ||
| })?; | ||
|
|
||
| let noise_info = if let Ok(noise_info) = client.get_noise_information().await { | ||
| noise_info | ||
| } else { | ||
| Default::default() | ||
| }; | ||
|
|
||
| let description = NymNodeDescription { | ||
| host_information: host_info.data, | ||
| build_information: build_info, | ||
| network_requester: None, | ||
| ip_packet_router: None, | ||
| mixnet_websockets: None, | ||
| noise_information: noise_info, | ||
| }; | ||
|
|
||
| Ok((mixnode.identity_key, description)) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.