Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Cargo.lock

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

9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ members = [
"common/ecash-time",
"common/execute",
"common/exit-policy",
"common/gateway-requests",
"common/gateway-storage",
"common/http-api-client",
"common/http-api-common",
"common/inclusion-probability",
Expand Down Expand Up @@ -96,7 +98,6 @@ members = [
"explorer-api/explorer-api-requests",
"explorer-api/explorer-client",
"gateway",
"gateway/gateway-requests",
"integrations/bity",
"mixnode",
"sdk/lib/socks5-listener",
Expand Down Expand Up @@ -139,7 +140,7 @@ default-members = [
"tools/nymvisor",
"explorer-api",
"nym-validator-rewarder",
"nym-node"
"nym-node",
]

exclude = [
Expand Down Expand Up @@ -346,8 +347,8 @@ bip32 = { version = "0.5.1", default-features = false }
# plus response message parsing (which is, as of the time of writing this message, waiting to get merged)
#cosmrs = { path = "../cosmos-rust-fork/cosmos-rust/cosmrs" }
cosmrs = { git = "https://github.com/cosmos/cosmos-rust", rev = "4b1332e6d8258ac845cef71589c8d362a669675a" } # unfortuntely we need a fork by yours truly to get the staking support
tendermint = "0.37.0" # same version as used by cosmrs
tendermint-rpc = "0.37.0" # same version as used by cosmrs
tendermint = "0.37.0" # same version as used by cosmrs
tendermint-rpc = "0.37.0" # same version as used by cosmrs
prost = { version = "0.12", default-features = false }

# wasm-related dependencies
Expand Down
33 changes: 26 additions & 7 deletions clients/native/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "nym-client"
version = "1.1.38"
authors = ["Dave Hrycyszyn <[email protected]>", "Jędrzej Stuczyński <[email protected]>"]
authors = [
"Dave Hrycyszyn <[email protected]>",
"Jędrzej Stuczyński <[email protected]>",
]
description = "Implementation of the Nym Client"
edition = "2021"
rust-version = "1.70"
Expand All @@ -26,30 +29,46 @@ clap = { workspace = true, features = ["cargo", "derive"] }
dirs = { workspace = true }
log = { workspace = true } # self explanatory
rand = { workspace = true }
serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization
serde = { workspace = true, features = [
"derive",
] } # for config serialization/deserialization
serde_json = { workspace = true }
thiserror = { workspace = true }
tap = { workspace = true }
time = { workspace = true }
tokio = { workspace = true, features = ["rt-multi-thread", "net", "signal"] } # async runtime
tokio = { workspace = true, features = [
"rt-multi-thread",
"net",
"signal",
] } # async runtime
tokio-tungstenite = { workspace = true }
zeroize = { workspace = true }

## internal
nym-bandwidth-controller = { path = "../../common/bandwidth-controller" }
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "clap"] }
nym-client-core = { path = "../../common/client-core", features = ["fs-credentials-storage", "fs-surb-storage", "fs-gateways-storage", "cli"] }
nym-bin-common = { path = "../../common/bin-common", features = [
"output_format",
"clap",
] }
nym-client-core = { path = "../../common/client-core", features = [
"fs-credentials-storage",
"fs-surb-storage",
"fs-gateways-storage",
"cli",
] }
nym-config = { path = "../../common/config" }
nym-credential-storage = { path = "../../common/credential-storage" }
nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" }
nym-gateway-requests = { path = "../../gateway/gateway-requests" }
nym-gateway-requests = { path = "../../common/gateway-requests" }
nym-network-defaults = { path = "../../common/network-defaults" }
nym-sphinx = { path = "../../common/nymsphinx" }
nym-pemstore = { path = "../../common/pemstore" }
nym-task = { path = "../../common/task" }
nym-topology = { path = "../../common/topology" }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = [
"http-client",
] }
nym-client-websocket-requests = { path = "websocket-requests" }
nym-id = { path = "../../common/nym-id" }

Expand Down
22 changes: 17 additions & 5 deletions clients/socks5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ license.workspace = true
bs58 = { workspace = true }
clap = { workspace = true, features = ["cargo", "derive"] }
log = { workspace = true }
serde = { workspace = true, features = ["derive"] } # for config serialization/deserialization
serde = { workspace = true, features = [
"derive",
] } # for config serialization/deserialization
serde_json = { workspace = true }
tap = { workspace = true }
thiserror = { workspace = true }
Expand All @@ -22,21 +24,31 @@ url = { workspace = true }
zeroize = { workspace = true }

# internal
nym-bin-common = { path = "../../common/bin-common", features = ["output_format", "clap"] }
nym-client-core = { path = "../../common/client-core", features = ["fs-credentials-storage", "fs-surb-storage", "fs-gateways-storage", "cli"] }
nym-bin-common = { path = "../../common/bin-common", features = [
"output_format",
"clap",
] }
nym-client-core = { path = "../../common/client-core", features = [
"fs-credentials-storage",
"fs-surb-storage",
"fs-gateways-storage",
"cli",
] }
nym-config = { path = "../../common/config" }
nym-credential-storage = { path = "../../common/credential-storage" }
nym-credentials = { path = "../../common/credentials" }
nym-crypto = { path = "../../common/crypto" }
nym-gateway-requests = { path = "../../gateway/gateway-requests" }
nym-gateway-requests = { path = "../../common/gateway-requests" }
nym-id = { path = "../../common/nym-id" }
nym-network-defaults = { path = "../../common/network-defaults" }
nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" }
nym-pemstore = { path = "../../common/pemstore" }
nym-socks5-client-core = { path = "../../common/socks5-client-core" }
nym-sphinx = { path = "../../common/nymsphinx" }
nym-topology = { path = "../../common/topology" }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = ["http-client"] }
nym-validator-client = { path = "../../common/client-libs/validator-client", features = [
"http-client",
] }

[features]
default = []
Expand Down
6 changes: 4 additions & 2 deletions common/client-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nym-country-group = { path = "../country-group" }
nym-crypto = { path = "../crypto" }
nym-explorer-client = { path = "../../explorer-api/explorer-client" }
nym-gateway-client = { path = "../client-libs/gateway-client" }
nym-gateway-requests = { path = "../../gateway/gateway-requests" }
nym-gateway-requests = { path = "../gateway-requests" }
nym-metrics = { path = "../nym-metrics" }
nym-nonexhaustive-delayqueue = { path = "../nonexhaustive-delayqueue" }
nym-sphinx = { path = "../nymsphinx" }
Expand All @@ -49,7 +49,9 @@ nym-task = { path = "../task" }
nym-credentials-interface = { path = "../credentials-interface" }
nym-credential-storage = { path = "../credential-storage" }
nym-network-defaults = { path = "../network-defaults" }
nym-client-core-config-types = { path = "./config-types", features = ["disk-persistence"] }
nym-client-core-config-types = { path = "./config-types", features = [
"disk-persistence",
] }
nym-client-core-surb-storage = { path = "./surb-storage" }
nym-client-core-gateways-storage = { path = "./gateways-storage" }
nym-ecash-time = { path = "../ecash-time" }
Expand Down
11 changes: 8 additions & 3 deletions common/client-core/gateways-storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ url.workspace = true
zeroize = { workspace = true, features = ["zeroize_derive"] }

nym-crypto = { path = "../../crypto", features = ["asymmetric"] }
nym-gateway-requests = { path = "../../../gateway/gateway-requests" }
nym-gateway-requests = { path = "../../gateway-requests" }

[target."cfg(not(target_arch = \"wasm32\"))".dependencies.sqlx]
workspace = true
Expand All @@ -27,7 +27,12 @@ optional = true

[build-dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
sqlx = { workspace = true, features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate"] }
sqlx = { workspace = true, features = [
"runtime-tokio-rustls",
"sqlite",
"macros",
"migrate",
] }

[features]
fs-gateways-storage = ["sqlx"]
fs-gateways-storage = ["sqlx"]
2 changes: 1 addition & 1 deletion common/client-libs/gateway-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ nym-bandwidth-controller = { path = "../../bandwidth-controller" }
nym-credentials = { path = "../../credentials" }
nym-credential-storage = { path = "../../credential-storage" }
nym-crypto = { path = "../../crypto" }
nym-gateway-requests = { path = "../../../gateway/gateway-requests" }
nym-gateway-requests = { path = "../../gateway-requests" }
nym-network-defaults = { path = "../../network-defaults" }
nym-sphinx = { path = "../../nymsphinx" }
nym-pemstore = { path = "../../pemstore" }
Expand Down
38 changes: 37 additions & 1 deletion common/credentials-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub use nym_compact_ecash::{
withdrawal_request, Base58, BlindedSignature, Bytable, EncodedDate, EncodedTicketType,
PartialWallet, PayInfo, PublicKeyUser, SecretKeyUser, VerificationKeyAuth, WithdrawalRequest,
};
use nym_ecash_time::EcashTime;
use nym_ecash_time::{ecash_today, EcashTime};

#[derive(Debug, Clone)]
pub struct CredentialSigningData {
Expand Down Expand Up @@ -292,3 +292,39 @@ impl From<TicketTypeRepr> for TicketType {
}
}
}

#[derive(Clone)]
pub struct ClientTicket {
pub spending_data: CredentialSpendingData,
pub ticket_id: i64,
}

impl ClientTicket {
pub fn new(spending_data: CredentialSpendingData, ticket_id: i64) -> Self {
ClientTicket {
spending_data,
ticket_id,
}
}
}

#[derive(Debug, Clone, Copy)]
pub struct AvailableBandwidth {
pub bytes: i64,
pub expiration: OffsetDateTime,
}

impl AvailableBandwidth {
pub fn expired(&self) -> bool {
self.expiration < ecash_today()
}
}

impl Default for AvailableBandwidth {
fn default() -> Self {
Self {
bytes: 0,
expiration: OffsetDateTime::UNIX_EPOCH,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ thiserror = { workspace = true }
tracing = { workspace = true, features = ["log"] }
zeroize = { workspace = true }

nym-crypto = { path = "../../common/crypto" }
nym-pemstore = { path = "../../common/pemstore" }
nym-sphinx = { path = "../../common/nymsphinx" }
nym-crypto = { path = "../crypto" }
nym-pemstore = { path = "../pemstore" }
nym-sphinx = { path = "../nymsphinx" }

nym-credentials = { path = "../../common/credentials" }
nym-credentials-interface = { path = "../../common/credentials-interface" }
nym-credentials = { path = "../credentials" }
nym-credentials-interface = { path = "../credentials-interface" }

[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
workspace = true
Expand All @@ -41,6 +41,4 @@ workspace = true
default-features = false

[dev-dependencies]
nym-compact-ecash = { path = "../../common/nym_offline_compact_ecash" } # we need specific imports in tests


nym-compact-ecash = { path = "../nym_offline_compact_ecash" } # we need specific imports in tests
File renamed without changes.
File renamed without changes.
41 changes: 41 additions & 0 deletions common/gateway-storage/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[package]
name = "nym-gateway-storage"
version = "0.1.0"
authors.workspace = true
repository.workspace = true
homepage.workspace = true
documentation.workspace = true
edition.workspace = true
license.workspace = true

[dependencies]
async-trait = { workspace = true }
bincode = { workspace = true, optional = true }
defguard_wireguard_rs = { workspace = true, optional = true }
log = { workspace = true }
sqlx = { workspace = true, features = [
"runtime-tokio-rustls",
"sqlite",
"macros",
"migrate",
"time",
] }
time = { workspace = true }
thiserror = { workspace = true }
tracing = { workspace = true }

nym-credentials-interface = { path = "../credentials-interface" }
nym-gateway-requests = { path = "../gateway-requests" }
nym-sphinx = { path = "../nymsphinx" }

[build-dependencies]
tokio = { workspace = true, features = ["rt-multi-thread", "macros"] }
sqlx = { workspace = true, features = [
"runtime-tokio-rustls",
"sqlite",
"macros",
"migrate",
] }

[features]
wireguard = ["defguard_wireguard_rs", "bincode"]
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2024 - Nym Technologies SA <[email protected]>
* SPDX-License-Identifier: Apache-2.0
*/

CREATE TABLE wireguard_peer
(
public_key TEXT NOT NULL PRIMARY KEY UNIQUE,
preshared_key TEXT,
protocol_version INTEGER,
endpoint TEXT,
last_handshake TIMESTAMP,
tx_bytes BIGINT NOT NULL,
rx_bytes BIGINT NOT NULL,
persistent_keepalive_interval INTEGER,
allowed_ips BLOB NOT NULL,
suspended BOOLEAN NOT NULL
);
Loading