From 17da5ca74afde7c5ff143b962f161b4e8d63b984 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Sun, 21 Dec 2014 02:14:38 -0800 Subject: [PATCH] handshake3: ressurect the message --- net/handshake/pb/handshake.pb.go | 20 ++++++++++++++++++++ net/handshake/pb/handshake.proto | 9 +++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/net/handshake/pb/handshake.pb.go b/net/handshake/pb/handshake.pb.go index 77ed5a41e..0b00c3352 100644 --- a/net/handshake/pb/handshake.pb.go +++ b/net/handshake/pb/handshake.pb.go @@ -53,8 +53,14 @@ func (m *Handshake1) GetAgentVersion() string { // Handshake3 is delivered _after_ the secure channel is initialized type Handshake3 struct { + // publicKey is this node's public key (which also gives its node.ID) + // - may not need to be sent, as secure channel implies it has been sent. + // - then again, if we change / disable secure channel, may still want it. + PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey" json:"publicKey,omitempty"` // listenAddrs are the multiaddrs the sender node listens for open connections on ListenAddrs [][]byte `protobuf:"bytes,2,rep,name=listenAddrs" json:"listenAddrs,omitempty"` + // protocols are the services this node is running + Protocols []string `protobuf:"bytes,3,rep,name=protocols" json:"protocols,omitempty"` // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives // this is useful information to convey to the other side, as it helps the remote endpoint // determine whether its connection to the local peer goes through NAT. @@ -66,6 +72,13 @@ func (m *Handshake3) Reset() { *m = Handshake3{} } func (m *Handshake3) String() string { return proto.CompactTextString(m) } func (*Handshake3) ProtoMessage() {} +func (m *Handshake3) GetPublicKey() []byte { + if m != nil { + return m.PublicKey + } + return nil +} + func (m *Handshake3) GetListenAddrs() [][]byte { if m != nil { return m.ListenAddrs @@ -73,6 +86,13 @@ func (m *Handshake3) GetListenAddrs() [][]byte { return nil } +func (m *Handshake3) GetProtocols() []string { + if m != nil { + return m.Protocols + } + return nil +} + func (m *Handshake3) GetObservedAddr() []byte { if m != nil { return m.ObservedAddr diff --git a/net/handshake/pb/handshake.proto b/net/handshake/pb/handshake.proto index 1dc7cad93..ee9e9b1db 100644 --- a/net/handshake/pb/handshake.proto +++ b/net/handshake/pb/handshake.proto @@ -20,16 +20,13 @@ message Handshake3 { // publicKey is this node's public key (which also gives its node.ID) // - may not need to be sent, as secure channel implies it has been sent. // - then again, if we change / disable secure channel, may still want it. - // optional bytes publicKey = 1; + optional bytes publicKey = 1; // listenAddrs are the multiaddrs the sender node listens for open connections on repeated bytes listenAddrs = 2; - // TODO - // services list the services this node is running - // repeated mux.ProtocolID services = 3; - - // we'll have more fields here later. + // protocols are the services this node is running + repeated string protocols = 3; // oservedAddr is the multiaddr of the remote endpoint that the sender node perceives // this is useful information to convey to the other side, as it helps the remote endpoint