Skip to content

Commit

Permalink
Cleanup (#220)
Browse files Browse the repository at this point in the history
* Cleanup

* fix: pipeline

* Use rust latest

* fix: update deny.toml and Dockerfiles

* fix: deny.toml
  • Loading branch information
tbraun96 authored Nov 17, 2024
1 parent 4f706c9 commit f510cb7
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/upload_cov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:

jobs:
coverage:
runs-on: linux-x86_64-epyc-7351-16core-128GB-ram
runs-on: macos-latest
timeout-minutes: 80
steps:
- uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ jobs:
- uses: actions/checkout@v4
- name: Maximize build space
uses: jlumbroso/free-disk-space@main
- run: docker-compose -f ./docker/client_server.yml up --abort-on-container-exit --exit-code-from client_a
- run: docker compose -f ./docker/client_server.yml up --abort-on-container-exit --exit-code-from client_a
docker_nat_p2p:
runs-on: ubuntu-latest
strategy:
Expand All @@ -224,5 +224,5 @@ jobs:
- name: Maximize build space
uses: jlumbroso/free-disk-space@main
- if: ${{ ! (matrix.nat_type_peer_a == 'symmetric' && matrix.nat_type_peer_b == 'symmetric') }}
run: docker-compose -f ./docker/peer_to_peer.yml up --abort-on-container-exit --exit-code-from peer_a
run: docker compose -f ./docker/peer_to_peer.yml up --abort-on-container-exit --exit-code-from peer_a
shell: bash
1 change: 1 addition & 0 deletions citadel_crypt/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ wasm = [
"citadel_pqcrypto/wasm",
"citadel_io/wasm"
]
fcm = []

[dependencies]
async-trait = { workspace = true }
Expand Down
1 change: 1 addition & 0 deletions citadel_pqcrypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ exclude = [

[features]
default = ["std"]
unordered = []
std = [
"serde/std",
"aes-gcm/std",
Expand Down
3 changes: 3 additions & 0 deletions citadel_proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,6 @@ rstest = { workspace = true }

[lib]
doctest = false

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }
2 changes: 1 addition & 1 deletion citadel_proto/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ pub mod macros {
}
}

#[cfg(not(target_host = "wasm"))]
#[cfg(not(target_family = "wasm"))]
pub mod re_imports {
pub use async_trait::*;
pub use bytes::BufMut;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,10 @@ pub async fn process_group_broadcast(
Some(key),
GroupBroadcast::EndResponse { key, success },
)
.map(|res| {
.inspect(|_res| {
let _ = inner_mut_state!(session.state_container)
.group_channels
.remove(&key);
res
}),

GroupBroadcast::Disconnected { key } => forward_signal(
Expand All @@ -319,11 +318,10 @@ pub async fn process_group_broadcast(
Some(key),
GroupBroadcast::Disconnected { key },
)
.map(|res| {
.inspect(|_res| {
let _ = inner_mut_state!(session.state_container)
.group_channels
.remove(&key);
res
}),

GroupBroadcast::Message {
Expand Down Expand Up @@ -548,11 +546,10 @@ pub async fn process_group_broadcast(
message: response,
},
)
.map(|res| {
.inspect(|_res| {
let _ = inner_mut_state!(session.state_container)
.group_channels
.remove(&key);
res
}),

GroupBroadcast::Add {
Expand Down
10 changes: 7 additions & 3 deletions citadel_sdk/src/remote_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ pub struct ConnectionSuccess {
}

/// Contains the elements entailed by a successful registration
pub struct RegisterSuccess {}
pub struct RegisterSuccess {
pub cid: u64,
}

#[async_trait]
/// Endows the [NodeRemote](NodeRemote) with additional functions
Expand Down Expand Up @@ -157,8 +159,10 @@ pub trait ProtocolRemoteExt: Remote {
let mut subscription = self.send_callback_subscription(register_request).await?;
while let Some(status) = subscription.next().await {
match map_errors(status)? {
NodeResult::RegisterOkay(RegisterOkay { .. }) => {
return Ok(RegisterSuccess {});
NodeResult::RegisterOkay(RegisterOkay { cnac, .. }) => {
return Ok(RegisterSuccess {
cid: cnac.get_cid(),
});
}
NodeResult::RegisterFailure(err) => {
return Err(NetworkError::Generic(err.error_message));
Expand Down
3 changes: 3 additions & 0 deletions citadel_user/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,6 @@ citadel_pqcrypto = { workspace = true }

[lib]
doctest = false

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)'] }
3 changes: 1 addition & 2 deletions citadel_wire/src/standard/nat_identification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,8 @@ impl NatType {
match tokio::time::timeout(_timeout, get_nat_type(stun_servers)).await {
Ok(res) => res
.map_err(|err| FirewallError::HolePunch(err.to_string()))
.map(|nat_type| {
.inspect(|nat_type| {
*LOCALHOST_TESTING_NAT_TYPE.lock() = Some(nat_type.clone());
nat_type
}),

Err(_elapsed) => {
Expand Down
57 changes: 14 additions & 43 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
# this list would mean the nix crate, as well as any of its exclusive
# dependencies not shared by any other crates, would be ignored, as the target
# list here is effectively saying which targets you are building for.
[graph]
targets = [
{ triple = "x86_64-unknown-linux-gnu" },
{ triple = "aarch64-unknown-linux-gnu" },
{ triple = "x86_64-unknown-linux-musl" },
{ triple = "aarch64-apple-darwin" },
{ triple = "x86_64-apple-darwin" },
{ triple = "x86_64-pc-windows-msvc" },
"x86_64-unknown-linux-gnu",
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
"aarch64-apple-darwin",
"x86_64-apple-darwin" ,
"x86_64-pc-windows-msvc",
]

# This section is considered when running `cargo deny check advisories`
Expand All @@ -34,20 +35,11 @@ targets = [
db-path = "~/.cargo/advisory-db"
# The url(s) of the advisory databases to use
db-urls = ["https://github.com/rustsec/advisory-db"]
# The lint level for security vulnerabilities
vulnerability = "deny"
# The lint level for unmaintained crates
unmaintained = "warn"

# The lint level for crates that have been yanked from their source registry
yanked = "warn"
# The lint level for crates with security notices. Note that as of
# 2019-12-17 there are no security notice advisories in
# https://github.com/rustsec/advisory-db
notice = "warn"
# A list of advisory IDs to ignore. Note that ignored advisories will still
# output a note when they are encountered.
ignore = [
]
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
# lower than the range specified will be ignored. Note that ignored advisories
# will still output a note when they are encountered.
Expand All @@ -56,14 +48,12 @@ ignore = [
# * Medium - CVSS Score 4.0 - 6.9
# * High - CVSS Score 7.0 - 8.9
# * Critical - CVSS Score 9.0 - 10.0
#severity-threshold =
#severity-threshold =

# This section is considered when running `cargo deny check licenses`
# More documentation for the licenses section can be found here:
# https://embarkstudios.github.io/cargo-deny/checks/licenses/cfg.html
[licenses]
# The lint level for crates which do not have a detectable license
unlicensed = "deny"
# List of explicitly allowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
Expand All @@ -76,28 +66,9 @@ allow = [
"BSD-3-Clause",
"BSD-2-Clause",
"OpenSSL",
"Unicode-DFS-2016"
]
# List of explicitly disallowed licenses
# See https://spdx.org/licenses/ for list of possible licenses
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
deny = [
#"Nokia",
"Unicode-DFS-2016",
"Unicode-3.0",
]
# Lint level for licenses considered copyleft
copyleft = "deny"
# Blanket approval or denial for OSI-approved or FSF Free/Libre licenses
# * both - The license will be approved if it is both OSI-approved *AND* FSF
# * either - The license will be approved if it is either OSI-approved *OR* FSF
# * osi-only - The license will be approved if is OSI-approved *AND NOT* FSF
# * fsf-only - The license will be approved if is FSF *AND NOT* OSI-approved
# * neither - This predicate is ignored and the default lint level is used
allow-osi-fsf-free = "neither"
# Lint level used when no other predicates are matched
# 1. License isn't in the allow or deny lists
# 2. License isn't copyleft
# 3. License isn't OSI/FSF, or allow-osi-fsf-free = "neither"
default = "deny"
# The confidence threshold for detecting a license from license text.
# The higher the value, the more closely the license text must be to the
# canonical license text of a valid SPDX license file.
Expand Down Expand Up @@ -176,8 +147,8 @@ deny = [
skip = [
#{ name = "ansi_term", version = "=0.11.0" },
]
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# Similarly to `skip` allows you to skip certain crates during duplicate
# detection. Unlike skip, it also includes the entire tree of transitive
# dependencies starting at the specified crate, up to a certain depth, which is
# by default infinite
skip-tree = [
Expand Down Expand Up @@ -206,4 +177,4 @@ github = [""]
# 1 or more gitlab.com organizations to allow git sources for
gitlab = [""]
# 1 or more bitbucket.org organizations to allow git sources for
bitbucket = [""]
bitbucket = [""]
4 changes: 2 additions & 2 deletions docker/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM rust:1.70 as builder
FROM rust:latest as builder
WORKDIR /usr/src/client
COPY . .
COPY ./docker/set_nat.sh .
COPY ./docker/client/exec.sh .
RUN apt-get update && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN apt-get update --fix-missing && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN cargo install --example client --path ./citadel_sdk --debug
RUN ["chmod", "u+x", "exec.sh"]
4 changes: 2 additions & 2 deletions docker/peer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM rust:1.70 as builder
FROM rust:latest as builder
WORKDIR /usr/src/peer
COPY . .
COPY ./docker/set_nat.sh .
COPY ./docker/peer/exec.sh .
RUN apt-get update && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN apt-get update --fix-missing && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN cargo install --example peer --path ./citadel_sdk --debug
RUN ["chmod", "u+x", "exec.sh"]
4 changes: 2 additions & 2 deletions docker/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM rust:1.70 as builder
FROM rust:latest as builder
WORKDIR /usr/src/server
COPY . .
COPY ./docker/set_nat.sh .
COPY ./docker/server/exec.sh .
RUN apt-get update && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN apt-get update --fix-missing && apt-get install -y openssl libclang-dev build-essential cmake iptables inetutils-ping net-tools iproute2 && rm -rf /var/lib/apt/lists/*
RUN cargo install --example server --path ./citadel_sdk --debug
RUN ["chmod", "u+x", "exec.sh"]

0 comments on commit f510cb7

Please sign in to comment.