Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose remote_cid() and local_cid() on quinn::Connection #1755

Closed
wants to merge 2 commits into from
Closed
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
15 changes: 15 additions & 0 deletions quinn-proto/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1228,6 +1228,21 @@ impl Connection {
self.path.remote
}

/// The remote handshake cid
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this is the one you want? I would've guess you might need initial_dst_cid?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial dst cid is set to a random 20 bytes by quinn client upon connecting, so it doesn't correlate to anything a custom ConnectionIdGenerator may produce

pub fn remote_handshake_cid(&self) -> ConnectionId {
self.rem_handshake_cid
}

/// The remote original/initial cid
pub fn remote_original_cid(&self) -> ConnectionId {
self.orig_rem_cid
}

/// The local handshake cid
pub fn local_handshake_cid(&self) -> ConnectionId {
self.handshake_cid
}

/// The local IP address which was used when the peer established
/// the connection
///
Expand Down
23 changes: 23 additions & 0 deletions quinn/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,29 @@ impl Connection {
self.0.stable_id()
}

/// The remote handshake cid
pub fn remote_handshake_cid(&self) -> proto::ConnectionId {
self.0
.state
.lock("remote_handshake_cid")
.inner
.remote_handshake_cid()
}

/// The remote original/initital cid
pub fn remote_original_cid(&self) -> proto::ConnectionId {
self.0
.state
.lock("remote_original_cid")
.inner
.remote_original_cid()
}

/// The local handshake cid
pub fn local_handshake_cid(&self) -> proto::ConnectionId {
self.0.state.lock("local_cid").inner.local_handshake_cid()
}

// Update traffic keys spontaneously for testing purposes.
#[doc(hidden)]
pub fn force_key_update(&self) {
Expand Down