mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2024-11-24 18:45:21 +00:00
update ironwood replace, update ipv6rwc to work (may need updates later if interface changes)
This commit is contained in:
parent
5a243d5b95
commit
5b6d9d52f3
2
go.mod
2
go.mod
@ -2,7 +2,7 @@ module github.com/yggdrasil-network/yggdrasil-go
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
replace github.com/Arceliar/ironwood => github.com/Arceliar/ironwood v0.0.0-20230319212913-807cbd557758
|
replace github.com/Arceliar/ironwood => github.com/Arceliar/ironwood v0.0.0-20230326182230-e1880a231350
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/Arceliar/ironwood v0.0.0-20230318003210-65aa386cab13
|
github.com/Arceliar/ironwood v0.0.0-20230318003210-65aa386cab13
|
||||||
|
4
go.sum
4
go.sum
@ -1,5 +1,5 @@
|
|||||||
github.com/Arceliar/ironwood v0.0.0-20230319212913-807cbd557758 h1:sPKt902XGRxXWQ/xtnrSnVyI8yBMR0Sx7ZsbHqOkUIk=
|
github.com/Arceliar/ironwood v0.0.0-20230326182230-e1880a231350 h1:9dsw9bwJKfwC/bohTvFsob7h4YeZkBI14eDtbY4WtTg=
|
||||||
github.com/Arceliar/ironwood v0.0.0-20230319212913-807cbd557758/go.mod h1:PhT70gxs32jSoxpi5gLlvCguWTzbpaqnNRTY6GgFPBY=
|
github.com/Arceliar/ironwood v0.0.0-20230326182230-e1880a231350/go.mod h1:PhT70gxs32jSoxpi5gLlvCguWTzbpaqnNRTY6GgFPBY=
|
||||||
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d h1:UK9fsWbWqwIQkMCz1CP+v5pGbsGoWAw6g4AyvMpm1EM=
|
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d h1:UK9fsWbWqwIQkMCz1CP+v5pGbsGoWAw6g4AyvMpm1EM=
|
||||||
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d/go.mod h1:BCnxhRf47C/dy/e/D2pmB8NkB3dQVIrkD98b220rx5Q=
|
github.com/Arceliar/phony v0.0.0-20220903101357-530938a4b13d/go.mod h1:BCnxhRf47C/dy/e/D2pmB8NkB3dQVIrkD98b220rx5Q=
|
||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
|
||||||
|
@ -35,9 +35,9 @@ type keyStore struct {
|
|||||||
mutex sync.Mutex
|
mutex sync.Mutex
|
||||||
keyToInfo map[keyArray]*keyInfo
|
keyToInfo map[keyArray]*keyInfo
|
||||||
addrToInfo map[address.Address]*keyInfo
|
addrToInfo map[address.Address]*keyInfo
|
||||||
addrBuffer map[address.Address]*buffer
|
//addrBuffer map[address.Address]*buffer
|
||||||
subnetToInfo map[address.Subnet]*keyInfo
|
subnetToInfo map[address.Subnet]*keyInfo
|
||||||
subnetBuffer map[address.Subnet]*buffer
|
//subnetBuffer map[address.Subnet]*buffer
|
||||||
mtu uint64
|
mtu uint64
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,9 +63,9 @@ func (k *keyStore) init(c *core.Core) {
|
|||||||
}*/
|
}*/
|
||||||
k.keyToInfo = make(map[keyArray]*keyInfo)
|
k.keyToInfo = make(map[keyArray]*keyInfo)
|
||||||
k.addrToInfo = make(map[address.Address]*keyInfo)
|
k.addrToInfo = make(map[address.Address]*keyInfo)
|
||||||
k.addrBuffer = make(map[address.Address]*buffer)
|
//k.addrBuffer = make(map[address.Address]*buffer)
|
||||||
k.subnetToInfo = make(map[address.Subnet]*keyInfo)
|
k.subnetToInfo = make(map[address.Subnet]*keyInfo)
|
||||||
k.subnetBuffer = make(map[address.Subnet]*buffer)
|
//k.subnetBuffer = make(map[address.Subnet]*buffer)
|
||||||
k.mtu = 1280 // Default to something safe, expect user to set this
|
k.mtu = 1280 // Default to something safe, expect user to set this
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +76,7 @@ func (k *keyStore) sendToAddress(addr address.Address, bs []byte) {
|
|||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
var buf *buffer
|
var buf *buffer
|
||||||
if buf = k.addrBuffer[addr]; buf == nil {
|
if buf = k.addrBuffer[addr]; buf == nil {
|
||||||
buf = new(buffer)
|
buf = new(buffer)
|
||||||
@ -95,6 +96,13 @@ func (k *keyStore) sendToAddress(addr address.Address, bs []byte) {
|
|||||||
})
|
})
|
||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
k.sendKeyLookup(addr.GetKey())
|
k.sendKeyLookup(addr.GetKey())
|
||||||
|
*/
|
||||||
|
k.mutex.Unlock()
|
||||||
|
key := k.core.GetKeyFor(addr.GetKey())
|
||||||
|
info := k.update(key)
|
||||||
|
if info.address == addr {
|
||||||
|
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +113,7 @@ func (k *keyStore) sendToSubnet(subnet address.Subnet, bs []byte) {
|
|||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
||||||
} else {
|
} else {
|
||||||
|
/*
|
||||||
var buf *buffer
|
var buf *buffer
|
||||||
if buf = k.subnetBuffer[subnet]; buf == nil {
|
if buf = k.subnetBuffer[subnet]; buf == nil {
|
||||||
buf = new(buffer)
|
buf = new(buffer)
|
||||||
@ -124,6 +133,13 @@ func (k *keyStore) sendToSubnet(subnet address.Subnet, bs []byte) {
|
|||||||
})
|
})
|
||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
k.sendKeyLookup(subnet.GetKey())
|
k.sendKeyLookup(subnet.GetKey())
|
||||||
|
*/
|
||||||
|
k.mutex.Unlock()
|
||||||
|
key := k.core.GetKeyFor(subnet.GetKey())
|
||||||
|
info := k.update(key)
|
||||||
|
if info.subnet == subnet {
|
||||||
|
_, _ = k.core.WriteTo(bs, iwt.Addr(info.key[:]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,6 +157,7 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo {
|
|||||||
k.keyToInfo[info.key] = info
|
k.keyToInfo[info.key] = info
|
||||||
k.addrToInfo[info.address] = info
|
k.addrToInfo[info.address] = info
|
||||||
k.subnetToInfo[info.subnet] = info
|
k.subnetToInfo[info.subnet] = info
|
||||||
|
/*
|
||||||
if buf := k.addrBuffer[info.address]; buf != nil {
|
if buf := k.addrBuffer[info.address]; buf != nil {
|
||||||
packets = append(packets, buf.packet)
|
packets = append(packets, buf.packet)
|
||||||
delete(k.addrBuffer, info.address)
|
delete(k.addrBuffer, info.address)
|
||||||
@ -149,6 +166,7 @@ func (k *keyStore) update(key ed25519.PublicKey) *keyInfo {
|
|||||||
packets = append(packets, buf.packet)
|
packets = append(packets, buf.packet)
|
||||||
delete(k.subnetBuffer, info.subnet)
|
delete(k.subnetBuffer, info.subnet)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
k.resetTimeout(info)
|
k.resetTimeout(info)
|
||||||
k.mutex.Unlock()
|
k.mutex.Unlock()
|
||||||
@ -177,6 +195,7 @@ func (k *keyStore) resetTimeout(info *keyInfo) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func (k *keyStore) oobHandler(fromKey, toKey ed25519.PublicKey, data []byte) { // nolint:unused
|
func (k *keyStore) oobHandler(fromKey, toKey ed25519.PublicKey, data []byte) { // nolint:unused
|
||||||
if len(data) != 1+ed25519.SignatureSize {
|
if len(data) != 1+ed25519.SignatureSize {
|
||||||
return
|
return
|
||||||
@ -198,6 +217,7 @@ func (k *keyStore) oobHandler(fromKey, toKey ed25519.PublicKey, data []byte) { /
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
func (k *keyStore) sendKeyLookup(partial ed25519.PublicKey) {
|
func (k *keyStore) sendKeyLookup(partial ed25519.PublicKey) {
|
||||||
sig := ed25519.Sign(k.core.PrivateKey(), partial[:])
|
sig := ed25519.Sign(k.core.PrivateKey(), partial[:])
|
||||||
|
Loading…
Reference in New Issue
Block a user