Skip to content

Commit

Permalink
Merge branch 'master' into feat/improve-automatic-bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
jxs authored Jul 3, 2024
2 parents 7268d7e + 63313f4 commit 1982c05
Show file tree
Hide file tree
Showing 17 changed files with 225 additions and 202 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
images: ghcr.io/${{ github.repository }}-server

- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
file: ./misc/server/Dockerfile
Expand Down
13 changes: 3 additions & 10 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ libp2p-dcutr = { version = "0.11.1", path = "protocols/dcutr" }
libp2p-dns = { version = "0.41.1", path = "transports/dns" }
libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" }
libp2p-gossipsub = { version = "0.46.2", path = "protocols/gossipsub" }
libp2p-identify = { version = "0.44.2", path = "protocols/identify" }
libp2p-identify = { version = "0.45.0", path = "protocols/identify" }
libp2p-identity = { version = "0.2.9" }
libp2p-kad = { version = "0.46.0", path = "protocols/kad" }
libp2p-mdns = { version = "0.45.1", path = "protocols/mdns" }
Expand Down
2 changes: 1 addition & 1 deletion core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## 0.41.3
## 0.41.3
- Use `web-time` instead of `instant`.
See [PR 5347](https://github.com/libp2p/rust-libp2p/pull/5347).

Expand Down
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ void = "1"

[dev-dependencies]
async-std = { version = "1.6.2", features = ["attributes"] }
libp2p-mplex = { path = "../muxers/mplex" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
libp2p-noise = { path = "../transports/noise" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
libp2p-mplex = { path = "../muxers/mplex" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
libp2p-noise = { path = "../transports/noise" } # Using `path` here because this is a cyclic dev-dependency which otherwise breaks releasing.
multihash = { workspace = true, features = ["arb"] }
quickcheck = { workspace = true }
libp2p-identity = { workspace = true, features = ["ed25519", "rand"] }
Expand Down
1 change: 1 addition & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ pub mod transport;
pub mod upgrade;

pub use connection::{ConnectedPoint, Endpoint};
pub use libp2p_identity::PeerId;
pub use multiaddr::Multiaddr;
pub use multihash;
pub use muxing::StreamMuxer;
Expand Down
1 change: 1 addition & 0 deletions libp2p/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Update individual crates.
- Update to [`libp2p-kad` `v0.46.0`](protocols/kad/CHANGELOG.md#0460).
- Update to [`libp2p-identify` `v0.45.0`](protocols/identify/CHANGELOG.md#0450).

- Raise MSRV to 1.73.
See [PR 5266](https://github.com/libp2p/rust-libp2p/pull/5266).
Expand Down
2 changes: 2 additions & 0 deletions misc/server/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Use periodic and automatic bootstrap of Kademlia.
See [PR 4838](https://github.com/libp2p/rust-libp2p/pull/4838).
- Update to [`libp2p-identify` `v0.45.0`](protocols/identify/CHANGELOG.md#0450).
See [PR 4981](https://github.com/libp2p/rust-libp2p/pull/4981).

## 0.12.6

Expand Down
1 change: 1 addition & 0 deletions misc/server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ async fn main() -> Result<(), Box<dyn Error>> {
protocols,
..
},
..
} = e
{
if protocols.iter().any(|p| *p == kad::PROTOCOL_NAME) {
Expand Down
5 changes: 5 additions & 0 deletions protocols/identify/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.45.0

- Add `ConnectionId` in `Event`.
See [PR 4981](https://github.com/libp2p/rust-libp2p/pull/4981).

## 0.44.2

- Emit `ToSwarm::NewExternalAddrOfPeer` for all external addresses of remote peers.
Expand Down
2 changes: 1 addition & 1 deletion protocols/identify/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-identify"
edition = "2021"
rust-version = { workspace = true }
description = "Nodes identification protocol for libp2p"
version = "0.44.2"
version = "0.45.0"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
46 changes: 37 additions & 9 deletions protocols/identify/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ impl NetworkBehaviour for Behaviour {
fn on_connection_handler_event(
&mut self,
peer_id: PeerId,
id: ConnectionId,
connection_id: ConnectionId,
event: THandlerOutEvent<Self>,
) {
match event {
Expand All @@ -270,6 +270,7 @@ impl NetworkBehaviour for Behaviour {
let observed = info.observed_addr.clone();
self.events
.push_back(ToSwarm::GenerateEvent(Event::Received {
connection_id,
peer_id,
info: info.clone(),
}));
Expand All @@ -285,7 +286,7 @@ impl NetworkBehaviour for Behaviour {
}
}

match self.our_observed_addresses.entry(id) {
match self.our_observed_addresses.entry(connection_id) {
Entry::Vacant(not_yet_observed) => {
not_yet_observed.insert(observed.clone());
self.events
Expand All @@ -298,7 +299,7 @@ impl NetworkBehaviour for Behaviour {
tracing::info!(
old_address=%already_observed.get(),
new_address=%observed,
"Our observed address on connection {id} changed",
"Our observed address on connection {connection_id} changed",
);

*already_observed.get_mut() = observed.clone();
Expand All @@ -308,16 +309,24 @@ impl NetworkBehaviour for Behaviour {
}
}
handler::Event::Identification => {
self.events
.push_back(ToSwarm::GenerateEvent(Event::Sent { peer_id }));
self.events.push_back(ToSwarm::GenerateEvent(Event::Sent {
connection_id,
peer_id,
}));
}
handler::Event::IdentificationPushed(info) => {
self.events
.push_back(ToSwarm::GenerateEvent(Event::Pushed { peer_id, info }));
self.events.push_back(ToSwarm::GenerateEvent(Event::Pushed {
connection_id,
peer_id,
info,
}));
}
handler::Event::IdentificationError(error) => {
self.events
.push_back(ToSwarm::GenerateEvent(Event::Error { peer_id, error }));
self.events.push_back(ToSwarm::GenerateEvent(Event::Error {
connection_id,
peer_id,
error,
}));
}
}
}
Expand Down Expand Up @@ -415,6 +424,8 @@ impl NetworkBehaviour for Behaviour {
pub enum Event {
/// Identification information has been received from a peer.
Received {
/// Identifier of the connection.
connection_id: ConnectionId,
/// The peer that has been identified.
peer_id: PeerId,
/// The information provided by the peer.
Expand All @@ -423,12 +434,16 @@ pub enum Event {
/// Identification information of the local node has been sent to a peer in
/// response to an identification request.
Sent {
/// Identifier of the connection.
connection_id: ConnectionId,
/// The peer that the information has been sent to.
peer_id: PeerId,
},
/// Identification information of the local node has been actively pushed to
/// a peer.
Pushed {
/// Identifier of the connection.
connection_id: ConnectionId,
/// The peer that the information has been sent to.
peer_id: PeerId,
/// The full Info struct we pushed to the remote peer. Clients must
Expand All @@ -437,13 +452,26 @@ pub enum Event {
},
/// Error while attempting to identify the remote.
Error {
/// Identifier of the connection.
connection_id: ConnectionId,
/// The peer with whom the error originated.
peer_id: PeerId,
/// The error that occurred.
error: StreamUpgradeError<UpgradeError>,
},
}

impl Event {
pub fn connection_id(&self) -> ConnectionId {
match self {
Event::Received { connection_id, .. }
| Event::Sent { connection_id, .. }
| Event::Pushed { connection_id, .. }
| Event::Error { connection_id, .. } => *connection_id,
}
}
}

/// If there is a given peer_id in the multiaddr, make sure it is the same as
/// the given peer_id. If there is no peer_id for the peer in the mutiaddr, this returns true.
fn multiaddr_matches_peer_id(addr: &Multiaddr, peer_id: &PeerId) -> bool {
Expand Down
2 changes: 2 additions & 0 deletions protocols/kad/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## 0.46.0

- Included multiaddresses of found peers alongside peer IDs in `GetClosestPeers` query results.
See [PR 5475](https://github.com/libp2p/rust-libp2p/pull/5475)
- Changed `FIND_NODE` response: now includes a list of closest peers when querying the recipient peer ID. Previously, this request yielded an empty response.
See [PR 5270](https://github.com/libp2p/rust-libp2p/pull/5270)
- Update to DHT republish interval and expiration time defaults to 22h and 48h respectively, rationale in [libp2p/specs#451](https://github.com/libp2p/specs/pull/451)
Expand Down
Loading

0 comments on commit 1982c05

Please sign in to comment.