mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-27 12:05:23 +00:00
Metadata/version tweaks
This commit is contained in:
parent
bb92e61e68
commit
c20b66f3b6
@ -185,13 +185,17 @@ func (intf *link) handler() (chan struct{}, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
meta = version_metadata{}
|
meta = version_metadata{}
|
||||||
if !meta.decode(metaBytes) || !meta.check() {
|
base := version_getBaseMetadata()
|
||||||
|
if !meta.decode(metaBytes) {
|
||||||
return nil, errors.New("failed to decode metadata")
|
return nil, errors.New("failed to decode metadata")
|
||||||
}
|
}
|
||||||
base := version_getBaseMetadata()
|
if !meta.check() {
|
||||||
if meta.ver > base.ver || meta.ver == base.ver && meta.minorVer > base.minorVer {
|
intf.links.core.log.Errorf("Failed to connect to node: %s is incompatible version (local %s, remote %s)",
|
||||||
intf.links.core.log.Errorln("Failed to connect to node: " + intf.lname + " version: " + fmt.Sprintf("%d.%d", meta.ver, meta.minorVer))
|
intf.lname,
|
||||||
return nil, errors.New("failed to connect: wrong version")
|
fmt.Sprintf("%d.%d", base.ver, base.minorVer),
|
||||||
|
fmt.Sprintf("%d.%d", meta.ver, meta.minorVer),
|
||||||
|
)
|
||||||
|
return nil, errors.New("remote node is incompatible version")
|
||||||
}
|
}
|
||||||
// Check if the remote side matches the keys we expected. This is a bit of a weak
|
// Check if the remote side matches the keys we expected. This is a bit of a weak
|
||||||
// check - in future versions we really should check a signature or something like that.
|
// check - in future versions we really should check a signature or something like that.
|
||||||
|
@ -22,7 +22,7 @@ func version_getBaseMetadata() version_metadata {
|
|||||||
return version_metadata{
|
return version_metadata{
|
||||||
meta: [4]byte{'m', 'e', 't', 'a'},
|
meta: [4]byte{'m', 'e', 't', 'a'},
|
||||||
ver: 0,
|
ver: 0,
|
||||||
minorVer: 1,
|
minorVer: 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user