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

Muxer selection in TLS handshake #1751

Closed
julian88110 opened this issue Sep 13, 2022 · 5 comments
Closed

Muxer selection in TLS handshake #1751

julian88110 opened this issue Sep 13, 2022 · 5 comments
Assignees

Comments

@julian88110
Copy link
Contributor

julian88110 commented Sep 13, 2022

This enhancement is the go/TLS implementation of the spec#446; which is tracked by #426.

The core idea is to perform muxer selection in the security protocol handshake process, rather than selecting muxer in a separate multistream-selection round.

In order to implement this enhancement, I am planning to do the following:

  1. Extend the ConnSecurity interface by adding a method for retrieving early data negotiated by the security protocol. This interface is implemented by several security layer data types, including TLS, Noise, and Insecure.
    type ConnSecurity interface {
	// LocalPeer returns our peer ID
	LocalPeer() peer.ID

    type ConnSecurity interface {
	// LocalPeer returns our peer ID
	LocalPeer() peer.ID

	// LocalPrivateKey returns our private key
	LocalPrivateKey() ic.PrivKey

	// RemotePeer returns the peer ID of the remote peer.
	RemotePeer() peer.ID

	// RemotePublicKey returns the public key of the remote peer.
	RemotePublicKey() ic.PubKey

	**// Early data negotiated by the security protocol. Empty if not supported.
	EarlyData() string**
}
  1. Extend the Transport data type of multistream-muxer and add method to expose the muxer strings that are stored here.
  2. Introduce some coupling between the Multistream-muxer and security layer in the upgrader-code, to pass the supported muxers into security protocols.
  3. After security handshake is down, the early data result will be available by the method added in step 1.
  4. Upgrader logic is revised to use the early data, if available, to select muxer.
@julian88110 julian88110 self-assigned this Sep 13, 2022
@marten-seemann
Copy link
Contributor

Thank you for writing this up @julian88110! This sounds like a good plan.

I'm wondering if instead of an EarlyData method we should instead expose a ConnectionState, similar to what the tls.Conn in the standard library exposes: https://pkg.go.dev/crypto/tls#Conn.ConnectionState. One of the fields (and the only one for now) would of the returned ConnectionState struct would be NegotiatedProtocol string, but this would allow us to add more fields in the future.

@julian88110
Copy link
Contributor Author

The ConnectionState idea is a good point, it makes it easier to extend. Yes we can definitely adopt this approach. Thanks for bringing that up!

@BigLep BigLep moved this to 🏃‍♀️ In Progress in go-libp2p Sep 16, 2022
@BigLep
Copy link
Contributor

BigLep commented Sep 20, 2022

@julian88110 : if there are updates/changes to the plan in light of 2022-09-19 conversations, please update. here (or in the libp2p/specs issue if that makes more sense).

@julian88110
Copy link
Contributor Author

julian88110 commented Sep 20, 2022

@BigLep yes, the discussion results were posted in the spec issue #454

@marten-seemann marten-seemann changed the title Muxer selection in TLS handshake Tracking Issue: muxer selection in TLS handshake Sep 30, 2022
@marten-seemann marten-seemann changed the title Tracking Issue: muxer selection in TLS handshake Muxer selection in TLS handshake Sep 30, 2022
@p-shahi
Copy link
Member

p-shahi commented Oct 25, 2022

Closed by #1772

@p-shahi p-shahi closed this as completed Oct 25, 2022
Repository owner moved this from 🏃‍♀️ In Progress to 🎉 Done in go-libp2p Oct 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

4 participants