mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-23 18:15:24 +00:00
disable keys in link protocol traffic, since these are already known, *breaks backwards compat*
This commit is contained in:
parent
c0579024c0
commit
25f00c1c7a
@ -204,8 +204,8 @@ func (p *peer) sendPacket(packet []byte) {
|
|||||||
func (p *peer) sendLinkPacket(packet []byte) {
|
func (p *peer) sendLinkPacket(packet []byte) {
|
||||||
bs, nonce := boxSeal(&p.shared, packet, nil)
|
bs, nonce := boxSeal(&p.shared, packet, nil)
|
||||||
linkPacket := wire_linkProtoTrafficPacket{
|
linkPacket := wire_linkProtoTrafficPacket{
|
||||||
toKey: p.box,
|
//toKey: p.box,
|
||||||
fromKey: p.core.boxPub,
|
//fromKey: p.core.boxPub,
|
||||||
nonce: *nonce,
|
nonce: *nonce,
|
||||||
payload: bs,
|
payload: bs,
|
||||||
}
|
}
|
||||||
@ -218,12 +218,12 @@ func (p *peer) handleLinkTraffic(bs []byte) {
|
|||||||
if !packet.decode(bs) {
|
if !packet.decode(bs) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if packet.toKey != p.core.boxPub {
|
//if packet.toKey != p.core.boxPub {
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
if packet.fromKey != p.box {
|
//if packet.fromKey != p.box {
|
||||||
return
|
// return
|
||||||
}
|
//}
|
||||||
payload, isOK := boxOpen(&p.shared, packet.payload, &packet.nonce)
|
payload, isOK := boxOpen(&p.shared, packet.payload, &packet.nonce)
|
||||||
if !isOK {
|
if !isOK {
|
||||||
return
|
return
|
||||||
|
@ -380,16 +380,16 @@ func (p *wire_protoTrafficPacket) decode(bs []byte) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type wire_linkProtoTrafficPacket struct {
|
type wire_linkProtoTrafficPacket struct {
|
||||||
toKey boxPubKey
|
//toKey boxPubKey
|
||||||
fromKey boxPubKey
|
//fromKey boxPubKey
|
||||||
nonce boxNonce
|
nonce boxNonce
|
||||||
payload []byte
|
payload []byte
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *wire_linkProtoTrafficPacket) encode() []byte {
|
func (p *wire_linkProtoTrafficPacket) encode() []byte {
|
||||||
bs := wire_encode_uint64(wire_LinkProtocolTraffic)
|
bs := wire_encode_uint64(wire_LinkProtocolTraffic)
|
||||||
bs = append(bs, p.toKey[:]...)
|
//bs = append(bs, p.toKey[:]...)
|
||||||
bs = append(bs, p.fromKey[:]...)
|
//bs = append(bs, p.fromKey[:]...)
|
||||||
bs = append(bs, p.nonce[:]...)
|
bs = append(bs, p.nonce[:]...)
|
||||||
bs = append(bs, p.payload...)
|
bs = append(bs, p.payload...)
|
||||||
return bs
|
return bs
|
||||||
@ -402,10 +402,10 @@ func (p *wire_linkProtoTrafficPacket) decode(bs []byte) bool {
|
|||||||
return false
|
return false
|
||||||
case pType != wire_LinkProtocolTraffic:
|
case pType != wire_LinkProtocolTraffic:
|
||||||
return false
|
return false
|
||||||
case !wire_chop_slice(p.toKey[:], &bs):
|
//case !wire_chop_slice(p.toKey[:], &bs):
|
||||||
return false
|
// return false
|
||||||
case !wire_chop_slice(p.fromKey[:], &bs):
|
//case !wire_chop_slice(p.fromKey[:], &bs):
|
||||||
return false
|
// return false
|
||||||
case !wire_chop_slice(p.nonce[:], &bs):
|
case !wire_chop_slice(p.nonce[:], &bs):
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user