_pkg.dev: drop wire/protocol package

Move service definitions from it into version (just to save them), but other
than that it's useless for master that has configs ruling the networks.
This commit is contained in:
Roman Khimov 2019-08-27 19:56:12 +03:00
parent 2cb9a4a251
commit e89e78159b
2 changed files with 10 additions and 45 deletions

View file

@ -1,44 +0,0 @@
package protocol
//Version represents the latest protocol version for the neo node
type Version uint32
const (
// DefaultVersion is the nodes default protocol version
DefaultVersion Version = 0
// UserAgent is the nodes user agent or human-readable name
UserAgent = "/NEO-GO/"
)
// ServiceFlag indicates the services provided by the node. 1 = P2P Full Node
type ServiceFlag uint64
// List of Services offered by the node
const (
NodePeerService ServiceFlag = 1
// BloomFilerService ServiceFlag = 2 // Not implemented
// PrunedNode ServiceFlag = 3 // Not implemented
// LightNode ServiceFlag = 4 // Not implemented
)
// Magic is the network that NEO is running on
type Magic uint32
// List of possible networks
const (
MainNet Magic = 7630401
TestNet Magic = 0x74746e41
)
// String implements the stringer interface
func (m Magic) String() string {
switch m {
case MainNet:
return "Mainnet"
case TestNet:
return "Testnet"
default:
return "UnknownNet"
}
}

View file

@ -8,6 +8,15 @@ import (
const minVersionSize = 27 const minVersionSize = 27
// List of Services offered by the node
const (
nodePeerService uint64 = 1
// BloomFilerService uint64 = 2 // Not implemented
// PrunedNode uint64 = 3 // Not implemented
// LightNode uint64 = 4 // Not implemented
)
// Version payload. // Version payload.
type Version struct { type Version struct {
// currently the version of the protocol is 0 // currently the version of the protocol is 0
@ -32,7 +41,7 @@ type Version struct {
func NewVersion(id uint32, p uint16, ua string, h uint32, r bool) *Version { func NewVersion(id uint32, p uint16, ua string, h uint32, r bool) *Version {
return &Version{ return &Version{
Version: 0, Version: 0,
Services: 1, Services: nodePeerService,
Timestamp: uint32(time.Now().UTC().Unix()), Timestamp: uint32(time.Now().UTC().Unix()),
Port: p, Port: p,
Nonce: id, Nonce: id,