README
¶
IFPS Handshake
The IPFS Protocol Handshake is divided into three sequential steps
- Version Handshake (
Hanshake1
) - Secure Channel (
NewSecureConn
) - Services (
Handshake3
)
Currently these parts currently happen sequentially (costing an awful 5 RTT), but can be optimized to 2 RTT.
Version Handshake
The Version Handshake ensures that nodes speaking to each other can interoperate. They send each other protocol versions and ensure there is a match on the major version (semver).
Secure Channel
The second part exchanges keys and establishes a secure comm channel. This follows ECDHE TLS, but isn't TLS. (why will be written up elsewhere).
Services
The Services portion sends any additional information on nodes needed by the nodes, e.g. Listen Address (the received address could be a Dial addr), and later on can include Service listing (dht, exchange, ipns, etc).
Documentation
¶
Overview ¶
package handshake implements the ipfs handshake protocol
IPFS Handshake ¶
The IPFS Protocol Handshake is divided into three sequential steps ¶
1. Version Handshake (`Hanshake1`)
2. Secure Channel (`NewSecureConn`)
3. Services (`Handshake3`)
Currently these parts currently happen sequentially (costing an awful 5 RTT), but can be optimized to 2 RTT.
Version Handshake ¶
The Version Handshake ensures that nodes speaking to each other can interoperate. They send each other protocol versions and ensure there is a match on the major version (semver).
Secure Channel ¶
The second part exchanges keys and establishes a secure comm channel. This follows ECDHE TLS, but *isn't* TLS. (why will be written up elsewhere).
Services ¶
The Services portion sends any additional information on nodes needed by the nodes, e.g. Listen Address (the received address could be a Dial addr), and later on can include Service listing (dht, exchange, ipns, etc).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ClientVersion = "go-ipfs/" + config.CurrentVersionNumber
var ErrVersionMismatch = errors.New("protocol missmatch")
ErrVersionMismatch is returned when two clients don't share a protocol version
var IpfsVersion *semver.Version
IpfsVersion holds the current protocol version for a client running this code
Functions ¶
func Handshake1Compatible ¶
func Handshake1Compatible(handshakeA, handshakeB *pb.Handshake1) error
Handshake1Compatible checks whether two versions are compatible returns nil if they are fine
func Handshake1Msg ¶
func Handshake1Msg() *pb.Handshake1
Handshake1Msg returns the current protocol version as a protobuf message
func Handshake3Msg ¶
func Handshake3Msg(localPeer peer.Peer, remoteAddr ma.Multiaddr) *pb.Handshake3
Handshake3Msg constructs a Handshake3 msg.
func NewHandshake1 ¶
func NewHandshake1(protoVer, agentVer string) *pb.Handshake1
NewHandshake1 creates a new Handshake1 from the two strings
Types ¶
type Handshake3Result ¶
type Handshake3Result struct {
// The addresses reported by the remote client
RemoteListenAddresses []ma.Multiaddr
// The address of the remote client we observed in this connection
RemoteObservedAddress ma.Multiaddr
// The address the remote client observed from this connection
LocalObservedAddress ma.Multiaddr
}
Handshake3Result collects the knowledge gained in Handshake3.
func Handshake3Update ¶
func Handshake3Update(lpeer, rpeer peer.Peer, msg *pb.Handshake3) (*Handshake3Result, error)
Handshake3Update updates local knowledge with the information in the handshake3 msg we received from remote client.