mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-23 11:27:42 +08:00
renamed version pkg to handshake
This commit is contained in:
parent
eab1a890a6
commit
6f8a89cd8d
@ -3,7 +3,7 @@
|
||||
// DO NOT EDIT!
|
||||
|
||||
/*
|
||||
Package version is a generated protocol buffer package.
|
||||
Package handshake is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
semver.proto
|
||||
@ -11,9 +11,9 @@ It is generated from these files:
|
||||
It has these top-level messages:
|
||||
SemVer
|
||||
*/
|
||||
package version
|
||||
package handshake
|
||||
|
||||
import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
|
||||
import proto "code.google.com/p/gogoprotobuf/proto"
|
||||
import math "math"
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -1,4 +1,4 @@
|
||||
package version;
|
||||
package handshake;
|
||||
|
||||
message SemVer {
|
||||
optional int64 major = 1;
|
||||
@ -1,4 +1,4 @@
|
||||
package version
|
||||
package handshake
|
||||
|
||||
// currentVersion holds the current protocol version for a client running this code
|
||||
var currentVersion = NewSemVer(0, 0, 1)
|
||||
@ -1,4 +1,4 @@
|
||||
package version
|
||||
package handshake
|
||||
|
||||
import "testing"
|
||||
|
||||
@ -6,8 +6,8 @@ import (
|
||||
|
||||
spipe "github.com/jbenet/go-ipfs/crypto/spipe"
|
||||
conn "github.com/jbenet/go-ipfs/net/conn"
|
||||
handshake "github.com/jbenet/go-ipfs/net/handshake"
|
||||
msg "github.com/jbenet/go-ipfs/net/message"
|
||||
version "github.com/jbenet/go-ipfs/net/version"
|
||||
|
||||
proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/goprotobuf/proto"
|
||||
ma "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
|
||||
@ -161,8 +161,8 @@ func (s *Swarm) connSecure(c *conn.Conn) error {
|
||||
// connVersionExchange exchanges local and remote versions and compares them
|
||||
// closes remote and returns an error in case of major difference
|
||||
func (s *Swarm) connVersionExchange(remote *conn.Conn) error {
|
||||
var remoteVersion, myVersion *version.SemVer
|
||||
myVersion = version.Current()
|
||||
var remoteVersion, myVersion *handshake.SemVer
|
||||
myVersion = handshake.Current()
|
||||
|
||||
// BUG(cryptix): do we need to use a NetMessage here?
|
||||
myVersionMsg, err := msg.FromObject(s.local, myVersion)
|
||||
@ -202,7 +202,7 @@ func (s *Swarm) connVersionExchange(remote *conn.Conn) error {
|
||||
return fmt.Errorf("Error retrieving from conn: %v", remote.Peer)
|
||||
}
|
||||
|
||||
remoteVersion = new(version.SemVer)
|
||||
remoteVersion = new(handshake.SemVer)
|
||||
err = proto.Unmarshal(data, remoteVersion)
|
||||
if err != nil {
|
||||
s.Close()
|
||||
@ -215,7 +215,7 @@ func (s *Swarm) connVersionExchange(remote *conn.Conn) error {
|
||||
}
|
||||
}
|
||||
|
||||
if !version.Compatible(myVersion, remoteVersion) {
|
||||
if !handshake.Compatible(myVersion, remoteVersion) {
|
||||
remote.Close()
|
||||
return errors.New("protocol missmatch")
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user