cfcf804b47
* add semver validator action * update runner * update runner with sed for old version in CI * Add no commit to publish for the moment * fix version bump command * configure git bot * error check * make dryrun less opaque * Reintroduce error check - keep logging dryrun in for debug (commented out) * fix grep check * bring non-dry-run to parity * add node for npx semver check to action * updated sed command * revert erroneous version bump * added semver check to publish workflow * allow from other branches * allow from other branches again * publishing guide * update publication runner * Release 1.20.3 nym-api-requests@1.20.3 nym-async-file-watcher@1.20.3 nym-authenticator-requests@1.20.3 nym-bandwidth-controller@1.20.3 nym-bin-common@1.20.3 nym-cache@1.20.3 nym-cli-commands@1.20.3 nym-client-core@1.20.3 nym-client-core-config-types@1.20.3 nym-client-core-gateways-storage@1.20.3 nym-client-core-surb-storage@1.20.3 nym-client-websocket-requests@1.20.3 nym-coconut-dkg-common@1.20.3 nym-common@1.20.3 nym-compact-ecash@1.20.3 nym-config@1.20.3 nym-contracts-common@1.20.3 nym-contracts-common-testing@1.20.3 nym-cpp-ffi@1.20.3 nym-credential-proxy-lib@1.20.3 nym-credential-proxy-requests@1.20.3 nym-credential-storage@1.20.3 nym-credential-utils@1.20.3 nym-credential-verification@1.20.3 nym-credentials@1.20.3 nym-credentials-interface@1.20.3 nym-crypto@1.20.3 nym-dkg@1.20.3 nym-ecash-contract-common@1.20.3 nym-ecash-signer-check@1.20.3 nym-ecash-signer-check-types@1.20.3 nym-ecash-time@1.20.3 nym-exit-policy@1.20.3 nym-ffi-shared@1.20.3 nym-gateway-client@1.20.3 nym-gateway-requests@1.20.3 nym-gateway-stats-storage@1.20.3 nym-gateway-storage@1.20.3 nym-go-ffi@1.20.3 nym-group-contract-common@1.20.3 nym-http-api-client@1.20.3 nym-http-api-client-macro@1.20.3 nym-http-api-common@1.20.3 nym-id@1.20.3 nym-inclusion-probability@1.20.3 nym-ip-packet-client@1.20.3 nym-ip-packet-requests@1.20.3 nym-metrics@1.20.3 nym-mixnet-client@1.20.3 nym-mixnet-contract-common@1.20.3 nym-mixnode-common@1.20.3 nym-multisig-contract-common@1.20.3 nym-network-defaults@1.20.3 nym-node-metrics@1.20.3 nym-node-requests@1.20.3 nym-node-tester-utils@1.20.3 nym-noise@1.20.3 nym-noise-keys@1.20.3 nym-nonexhaustive-delayqueue@1.20.3 nym-ordered-buffer@1.20.3 nym-outfox@1.20.3 nym-pemstore@1.20.3 nym-performance-contract-common@1.20.3 nym-pool-contract-common@1.20.3 nym-registration-common@1.20.3 nym-sdk@1.20.3 nym-serde-helpers@1.20.3 nym-service-provider-requests-common@1.20.3 nym-service-providers-common@1.20.3 nym-socks5-client-core@1.20.3 nym-socks5-proxy-helpers@1.20.3 nym-socks5-requests@1.20.3 nym-sphinx@1.20.3 nym-sphinx-acknowledgements@1.20.3 nym-sphinx-addressing@1.20.3 nym-sphinx-anonymous-replies@1.20.3 nym-sphinx-chunking@1.20.3 nym-sphinx-cover@1.20.3 nym-sphinx-forwarding@1.20.3 nym-sphinx-framing@1.20.3 nym-sphinx-params@1.20.3 nym-sphinx-routing@1.20.3 nym-sphinx-types@1.20.3 nym-sqlx-pool-guard@1.20.3 nym-statistics-common@1.20.3 nym-store-cipher@1.20.3 nym-task@1.20.3 nym-test-utils@1.20.3 nym-ticketbooks-merkle@1.20.3 nym-topology@1.20.3 nym-tun@1.20.3 nym-types@1.20.3 nym-upgrade-mode-check@1.20.3 nym-validator-client@1.20.3 nym-verloc@1.20.3 nym-vesting-contract-common@1.20.3 nym-wasm-client-core@1.20.3 nym-wasm-storage@1.20.3 nym-wasm-utils@1.20.3 nym-wireguard@1.20.3 nym-wireguard-private-metadata-client@1.20.3 nym-wireguard-private-metadata-server@1.20.3 nym-wireguard-private-metadata-shared@1.20.3 nym-wireguard-private-metadata-tests@1.20.3 nym-wireguard-types@1.20.3 nyxd-scraper-shared@1.20.3 Generated by cargo-workspaces * remove --allow-branch ; no commit, doesn't need branch restrictions * remove another clashing flag * again * exclude build.rs from crate for crates.io * various in process scripts to pick up deployment where it left off * rename workflows * Version bump fix from borked publish run * add publishing doc + updated publish-resume ci * move example from service-providers to sdk examples/ to remove circular dev dependency for cargo publication * remove wildcard version import * Workflows and documentation for publication * add contracts/ patch + imports * Reintroduce missing kkt dep from rebase * fix borked rebase cargo lock --------- Co-authored-by: Nym bot <nym-bot@users.noreply.github.com>
90 lines
3.5 KiB
Rust
90 lines
3.5 KiB
Rust
// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// use nym_client::client::config::{BaseClientConfig, Config, GatewayEndpointConfig};
|
|
// use nym_client::client::{DirectClient, KeyManager, Recipient, ReconstructedMessage, SocketClient};
|
|
use nym_sdk::mixnet::{
|
|
IncludedSurbs, MixnetClient, MixnetMessageSender, Recipient, ReconstructedMessage,
|
|
};
|
|
use nym_service_providers_common::interface::{
|
|
ControlRequest, ControlResponse, ProviderInterfaceVersion, Request, Response, ResponseContent,
|
|
};
|
|
|
|
fn parse_control_response(received: Vec<ReconstructedMessage>) -> ControlResponse {
|
|
assert_eq!(received.len(), 1);
|
|
let response: Response = Response::try_from_bytes(&received[0].message).unwrap();
|
|
match response.content {
|
|
ResponseContent::Control(control) => control,
|
|
ResponseContent::ProviderData(_) => {
|
|
panic!("received provider data even though we sent control request!")
|
|
}
|
|
}
|
|
}
|
|
|
|
async fn wait_for_control_response(client: &mut MixnetClient) -> ControlResponse {
|
|
loop {
|
|
let next = client.wait_for_messages().await.unwrap();
|
|
if !next.is_empty() {
|
|
return parse_control_response(next);
|
|
}
|
|
}
|
|
}
|
|
|
|
#[tokio::main]
|
|
async fn main() -> anyhow::Result<()> {
|
|
// technically we don't need to start the entire client with all the subroutines,
|
|
// but I needed an easy way of sending to and receiving from the mixnet
|
|
// and that was the most straightforward way of achieving it
|
|
let mut client = MixnetClient::connect_new().await.unwrap();
|
|
let provider: Recipient = "8YF6f8x17j3fviBdU87EGD9g9MAgn9DARxunwLEVM7Bm.4ydfpjbTjCmzj58hWdQjxU2gT6CRVnTbnKajr2hAGBBM@2xU4CBE6QiiYt6EyBXSALwxkNvM7gqJfjHXaMkjiFmYW".parse().unwrap();
|
|
|
|
// generic service provider request, so we don't even need to care it's to the socks5 provider
|
|
let request_health = ControlRequest::Health;
|
|
let request_binary_info = ControlRequest::BinaryInfo;
|
|
let request_versions = ControlRequest::SupportedRequestVersions;
|
|
|
|
let full_request_health: Request =
|
|
Request::new_control(ProviderInterfaceVersion::new_current(), request_health);
|
|
let full_request_binary_info: Request =
|
|
Request::new_control(ProviderInterfaceVersion::new_current(), request_binary_info);
|
|
let full_request_versions: Request =
|
|
Request::new_control(ProviderInterfaceVersion::new_current(), request_versions);
|
|
|
|
// TODO: currently we HAVE TO use surbs unfortunately
|
|
println!("Sending 'Health' request...");
|
|
client
|
|
.send_message(
|
|
provider,
|
|
full_request_health.into_bytes(),
|
|
IncludedSurbs::new(10),
|
|
)
|
|
.await?;
|
|
let response = wait_for_control_response(&mut client).await;
|
|
println!("response to 'Health' request: {response:#?}");
|
|
|
|
println!("Sending 'BinaryInfo' request...");
|
|
client
|
|
.send_message(
|
|
provider,
|
|
full_request_binary_info.into_bytes(),
|
|
IncludedSurbs::none(),
|
|
)
|
|
.await?;
|
|
let response = wait_for_control_response(&mut client).await;
|
|
println!("response to 'BinaryInfo' request: {response:#?}");
|
|
|
|
println!("Sending 'SupportedRequestVersions' request...");
|
|
client
|
|
.send_message(
|
|
provider,
|
|
full_request_versions.into_bytes(),
|
|
IncludedSurbs::none(),
|
|
)
|
|
.await?;
|
|
let response = wait_for_control_response(&mut client).await;
|
|
println!("response to 'SupportedRequestVersions' request: {response:#?}");
|
|
|
|
client.disconnect().await;
|
|
Ok(())
|
|
}
|