Skip to content

Commit

Permalink
Merge pull request #2502 from jacderida/chore-remove_websockets
Browse files Browse the repository at this point in the history
chore: remove the `websockets` feature
  • Loading branch information
jacderida authored Dec 9, 2024
2 parents 53be33c + 1237e03 commit 4bcb4d4
Show file tree
Hide file tree
Showing 11 changed files with 4 additions and 231 deletions.
16 changes: 0 additions & 16 deletions .github/workflows/cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,3 @@ jobs:
# Allow clippy lints (these can be pedantic on WASM), but deny regular Rust warnings
run: cargo clippy --target=wasm32-unknown-unknown --package=autonomi --lib --tests -- --allow=clippy::all --deny=warnings
timeout-minutes: 30

websocket:
if: "!startsWith(github.event.head_commit.message, 'chore(release):')"
name: Standard Websocket builds
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Build all for `websockets`
run: cargo build --features="websockets"
timeout-minutes: 30
162 changes: 0 additions & 162 deletions .github/workflows/merge_websocket.yml

This file was deleted.

8 changes: 4 additions & 4 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,16 @@ build-release-artifacts arch nightly="false":
cargo binstall --no-confirm cross
cross build --release --target $arch --bin nat-detection $nightly_feature
cross build --release --target $arch --bin node-launchpad $nightly_feature
cross build --release --features websockets --target $arch --bin ant $nightly_feature
cross build --release --features websockets --target $arch --bin antnode $nightly_feature
cross build --release --target $arch --bin ant $nightly_feature
cross build --release --target $arch --bin antnode $nightly_feature
cross build --release --target $arch --bin antctl $nightly_feature
cross build --release --target $arch --bin antctld $nightly_feature
cross build --release --target $arch --bin antnode_rpc_client $nightly_feature
else
cargo build --release --target $arch --bin nat-detection $nightly_feature
cargo build --release --target $arch --bin node-launchpad $nightly_feature
cargo build --release --features websockets --target $arch --bin ant $nightly_feature
cargo build --release --features websockets --target $arch --bin antnode $nightly_feature
cargo build --release --target $arch --bin ant $nightly_feature
cargo build --release --target $arch --bin antnode $nightly_feature
cargo build --release --target $arch --bin antctl $nightly_feature
cargo build --release --target $arch --bin antctld $nightly_feature
cargo build --release --target $arch --bin antnode_rpc_client $nightly_feature
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,6 @@ More options about EVM Network below.

The Autonomi network uses `quic` as the default transport protocol.

The `websockets` feature is available for the `ant-networking` crate, and above, and will allow for
tcp over websockets.

If building for `wasm32` then `websockets` are enabled by default as this is the only method
available to communicate with a network as things stand. (And that network must have `websockets`
enabled.)

#### Building for wasm32

WASM support for the autonomi API is currently under active development. More docs coming soon.
Expand Down
1 change: 0 additions & 1 deletion ant-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ path = "src/main.rs"
default = ["metrics"]
local = ["ant-bootstrap/local", "autonomi/local"]
metrics = ["ant-logging/process-metrics"]
websockets = ["autonomi/websockets"]

[[bench]]
name = "files"
Expand Down
1 change: 0 additions & 1 deletion ant-networking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ loud = []
open-metrics = ["libp2p/metrics", "prometheus-client", "hyper", "sysinfo"]
# tcp is automatically enabled when compiling for wasm32
upnp = ["libp2p/upnp"]
websockets = ["libp2p/tcp"]

[dependencies]
aes-gcm-siv = "0.11.1"
Expand Down
11 changes: 0 additions & 11 deletions ant-networking/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -446,17 +446,6 @@ impl NetworkBuilder {
.listen_on(addr_quic)
.expect("Multiaddr should be supported by our configured transports");

// Listen on WebSocket
#[cfg(any(feature = "websockets", target_arch = "wasm32"))]
{
let addr_ws = Multiaddr::from(listen_socket_addr.ip())
.with(Protocol::Tcp(listen_socket_addr.port()))
.with(Protocol::Ws("/".into()));
swarm_driver
.listen_on(addr_ws)
.expect("Multiaddr should be supported by our configured transports");
}

Ok((network, events_receiver, swarm_driver))
}

Expand Down
26 changes: 0 additions & 26 deletions ant-networking/src/transport/other.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#[cfg(feature = "open-metrics")]
use crate::MetricsRegistries;
#[cfg(feature = "websockets")]
use futures::future::Either;
#[cfg(feature = "websockets")]
use libp2p::{core::upgrade, noise, yamux};
use libp2p::{
core::{muxing::StreamMuxerBox, transport},
identity::Keypair,
Expand All @@ -18,28 +14,6 @@ pub(crate) fn build_transport(
#[cfg(feature = "open-metrics")]
let trans = libp2p::metrics::BandwidthTransport::new(trans, &mut registries.standard_metrics);

#[cfg(feature = "websockets")]
// Using a closure here due to the complex return type
let generate_ws_transport = || {
let tcp = libp2p::tcp::tokio::Transport::new(libp2p::tcp::Config::default());
libp2p::websocket::WsConfig::new(tcp)
.upgrade(upgrade::Version::V1)
.authenticate(
noise::Config::new(keypair)
.expect("Signing libp2p-noise static DH keypair failed."),
)
.multiplex(yamux::Config::default())
};

// With the `websockets` feature enabled, we add it as a fallback transport.
#[cfg(feature = "websockets")]
let trans = trans
.or_transport(generate_ws_transport())
.map(|either_output, _| match either_output {
Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
Either::Right((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)),
});
#[cfg(not(feature = "websockets"))]
let trans = trans.map(|(peer_id, muxer), _| (peer_id, StreamMuxerBox::new(muxer)));

trans.boxed()
Expand Down
1 change: 0 additions & 1 deletion ant-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ nightly = []
open-metrics = ["ant-networking/open-metrics", "prometheus-client"]
otlp = ["ant-logging/otlp"]
upnp = ["ant-networking/upnp"]
websockets = ["ant-networking/websockets"]

[dependencies]
ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" }
Expand Down
1 change: 0 additions & 1 deletion ant-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ version = "0.17.15"
[features]
default = []
rpc=["tonic", "prost"]
websockets=[]

[dependencies]
ant-build-info = { path = "../ant-build-info", version = "0.1.19" }
Expand Down
1 change: 0 additions & 1 deletion autonomi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local = ["ant-networking/local", "ant-evm/local"]
loud = []
registers = []
vault = ["registers"]
websockets = ["ant-networking/websockets"]

[dependencies]
ant-bootstrap = { path = "../ant-bootstrap", version = "0.1.0" }
Expand Down

0 comments on commit 4bcb4d4

Please sign in to comment.