Skip to content

Commit

Permalink
Merge branch 'main' into flub/relay-send-channel-1
Browse files Browse the repository at this point in the history
  • Loading branch information
flub committed Dec 12, 2024
2 parents a6678ca + d9fb470 commit 51d136a
Show file tree
Hide file tree
Showing 71 changed files with 882 additions and 671 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
MSRV: "1.76"
MSRV: "1.81"
SCCACHE_CACHE_SIZE: "10G"
IROH_FORCE_STAGING_RELAYS: "1"

Expand Down Expand Up @@ -221,7 +221,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-05-02
toolchain: nightly-2024-11-30
- name: Install sccache
uses: mozilla-actions/[email protected]

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-05-02
toolchain: nightly-2024-11-30
- name: Install sccache
uses: mozilla-actions/[email protected]

Expand Down Expand Up @@ -68,6 +68,6 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
body: |
Documentation for this PR has been generated and is available at: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.PREVIEW_PATH }}/iroh/
Last updated: ${{ env.TIMESTAMP }}
edit-mode: replace
34 changes: 17 additions & 17 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
MSRV: "1.76"
MSRV: "1.81"
SCCACHE_CACHE_SIZE: "10G"
BIN_NAMES: "iroh-relay,iroh-dns-server"
RELEASE_VERSION: ${{ github.event.inputs.release_version }}
Expand Down Expand Up @@ -138,19 +138,19 @@ jobs:
uses: actions/checkout@v4
with:
submodules: recursive

- name: Checkout specified commit
if: inputs.base_hash != ''
uses: actions/checkout@v4
with:
ref: ${{ inputs.base_hash }}
submodules: recursive

- name: Set build arch
run: |
echo "RELEASE_ARCH=${{ matrix.release-arch }}" >> $GITHUB_ENV
echo "RELEASE_OS=${{ matrix.release-os }}" >> $GITHUB_ENV
- name: Define hash
if: matrix.os == 'ubuntu-latest'
id: define_hash
Expand All @@ -160,7 +160,7 @@ jobs:
- name: Ensure musl support
if: ${{ contains(matrix.cargo_targets, '-musl') }}
run: sudo apt-get install musl-tools -y

- name: Install Rust
if: matrix.os != 'windows-latest'
uses: dtolnay/rust-toolchain@stable
Expand All @@ -173,7 +173,7 @@ jobs:
run: |
rustup toolchain install stable
rustup target add ${{ matrix.cargo_targets }}
- name: build release
if: matrix.os != 'windows-latest'
shell: bash
Expand All @@ -183,60 +183,60 @@ jobs:
export CC=aarch64-linux-gnu-gcc
fi
cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}
- name: build release
if: matrix.os == 'windows-latest'
run: cargo build --profile optimized-release --all-features --target ${{ matrix.cargo_targets }}

- name: attach artifacts
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: iroh-${{env.RELEASE_OS }}-${{env.RELEASE_ARCH}}
path: target/${{ matrix.cargo_targets }}/optimized-release/iroh
compression-level: 0

- name: attach artifacts
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: iroh-windows-amd64.exe
path: target/${{ matrix.cargo_targets }}/optimized-release/iroh.exe
compression-level: 0

- name: Setup awscli on linux
if: matrix.name == 'ubuntu-latest'
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Setup awscli on linux
if: matrix.name == 'ubuntu-arm-latest'
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --update
- name: Setup awscli on mac
if: matrix.os == 'macos-latest'
run: |
curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
sudo installer -pkg AWSCLIV2.pkg -target /
- name: Set aws credentials
if: matrix.os != 'windows-latest'
run: |
echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
- name: push release
if: matrix.os != 'windows-latest'
run: |
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-relay s3://vorc/iroh-relay-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
aws s3 cp ./target/${{ matrix.cargo_targets }}/optimized-release/iroh-dns-server s3://vorc/iroh-dns-server-${RELEASE_OS}-${RELEASE_ARCH}-${GITHUB_SHA::7} --no-progress
- name: push release latest
if: matrix.os != 'windows-latest' && (github.event.inputs.mark_latest == 'true' || github.event_name == 'push')
run: |
Expand Down Expand Up @@ -290,7 +290,7 @@ jobs:
path: iroh-*.tar.gz
compression-level: 0
retention-days: 1

- name: attach artifacts
uses: actions/upload-artifact@v4
if : matrix.os == 'windows-latest'
Expand All @@ -307,4 +307,4 @@ jobs:
with:
release_version: ${{ needs.build_release.outputs.release_version }}
base_hash: ${{ needs.build_release.outputs.base_hash }}
publish: true
publish: true
16 changes: 8 additions & 8 deletions .github/workflows/test_relay_server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:
concurrency:
group: relay-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUST_BACKTRACE: 1
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
MSRV: "1.76"
MSRV: "1.81"
SCCACHE_CACHE_SIZE: "10G"
IROH_FORCE_STAGING_RELAYS: "1"

jobs:
build_relay_server:
runs-on: [self-hosted, linux, X64]
Expand All @@ -33,11 +33,11 @@ jobs:
uses: dtolnay/rust-toolchain@stable
- name: Install sccache
uses: mozilla-actions/[email protected]

- name: build release
run: |
cargo build --release --all-features --bin iroh-relay
- name: Setup awscli on linux
run: |
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Expand All @@ -48,16 +48,16 @@ jobs:
echo "AWS_ACCESS_KEY_ID=${{secrets.S3_ACCESS_KEY_ID}}" >> $GITHUB_ENV
echo "AWS_SECRET_ACCESS_KEY=${{secrets.S3_ACCESS_KEY}}" >> $GITHUB_ENV
echo "AWS_DEFAULT_REGION=us-west-2" >> $GITHUB_ENV
- name: push release
run: |
aws s3 cp ./target/release/iroh-relay s3://vorc/iroh-relay-linux-amd64-${GITHUB_SHA::7} --no-progress
- name: Set iroh-relay tag
id: set_tag
run: |
echo ::set-output name=tag::${GITHUB_SHA::7}
deploy_iroh-relay:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ incremental = false
missing_debug_implementations = "warn"

# We use this --cfg for documenting the cargo features on which an API
# is available. To preview this locally use: RUSTFLAGS="--cfg
# iroh_docsrs cargo +nightly doc --all-features". We use our own
# is available. To preview this locally use: RUSTDOCFLAGS="--cfg
# iroh_docsrs" cargo +nightly doc --all-features. We use our own
# iroh_docsrs instead of the common docsrs to avoid also enabling this
# feature in any dependencies, because some indirect dependencies
# require a feature enabled when using `--cfg docsrs` which we can not
# do. To enable for a crate set `#![cfg_attr(iroh_docsrs,
# feature(doc_cfg))]` in the crate.
# feature(doc_auto_cfg))]` in the crate.
unexpected_cfgs = { level = "warn", check-cfg = ["cfg(iroh_docsrs)"] }

[workspace.lints.clippy]
Expand Down
21 changes: 18 additions & 3 deletions iroh-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = ["n0 team"]
repository = "https://github.com/n0-computer/iroh"

# Sadly this also needs to be updated in .github/workflows/ci.yml
rust-version = "1.76"
rust-version = "1.81"

[lints]
workspace = true
Expand Down Expand Up @@ -46,11 +46,26 @@ serde_json = "1"
serde_test = "1"

[features]
default = ["hash", "base32", "relay"]
default = ["hash", "ticket", "relay"]
hash = ["dep:blake3", "dep:data-encoding", "dep:postcard", "dep:derive_more", "base32"]
ticket = ["base32", "key", "hash"]
base32 = ["dep:data-encoding", "dep:postcard"]
redb = ["dep:redb"]
key = ["dep:ed25519-dalek", "dep:once_cell", "dep:rand", "dep:rand_core", "dep:ssh-key", "dep:ttl_cache", "dep:aead", "dep:crypto_box", "dep:zeroize", "dep:url", "dep:derive_more", "dep:getrandom"]
key = [
"dep:ed25519-dalek",
"dep:once_cell",
"dep:rand",
"dep:rand_core",
"dep:ssh-key",
"dep:ttl_cache",
"dep:aead",
"dep:crypto_box",
"dep:zeroize",
"dep:url",
"dep:derive_more",
"dep:getrandom",
"base32",
]
wasm = ["getrandom?/js"]
relay = ["dep:url", "dep:derive_more"]

Expand Down
1 change: 0 additions & 1 deletion iroh-base/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ pub struct HashAndFormat {
}

#[cfg(feature = "redb")]
#[cfg_attr(iroh_docsrs, cfg(feature = "redb"))]
mod redb_support {
use postcard::experimental::max_size::MaxSize;
use redb::{Key as RedbKey, Value as RedbValue};
Expand Down
35 changes: 21 additions & 14 deletions iroh-base/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
//! Base types and utilities for Iroh
#![cfg_attr(iroh_docsrs, feature(doc_cfg))]
#![cfg_attr(iroh_docsrs, feature(doc_auto_cfg))]

// TODO: remove
#[cfg(feature = "base32")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "base32")))]
pub mod base32;

// TODO: move to own crate
#[cfg(feature = "ticket")]
pub mod ticket;

#[cfg(feature = "hash")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "hash")))]
pub mod hash;
mod hash;
#[cfg(feature = "key")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "key")))]
pub mod key;
mod key;
#[cfg(feature = "key")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "key")))]
pub mod node_addr;
mod node_addr;
#[cfg(feature = "relay")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "relay")))]
pub mod relay_map;
#[cfg(any(feature = "relay", feature = "key"))]
mod relay_url;
#[cfg(feature = "base32")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "base32")))]
pub mod ticket;

#[cfg(feature = "hash")]
pub use self::hash::{BlobFormat, Hash, HashAndFormat};
#[cfg(feature = "key")]
pub use self::key::{
KeyParsingError, NodeId, PublicKey, SecretKey, SharedSecret, Signature, PUBLIC_KEY_LENGTH,
};
#[cfg(feature = "key")]
pub use self::node_addr::NodeAddr;
#[cfg(feature = "relay")]
pub use self::relay_url::RelayUrl;
Loading

0 comments on commit 51d136a

Please sign in to comment.