mirror of
https://github.com/cwinfo/yggdrasil-go.git
synced 2025-07-11 13:06:29 +00:00
refactor things the router owns (dht, sessions, searches) into that struct, to make the ownership more explicit
This commit is contained in:
@ -221,7 +221,7 @@ func (t *dht) handleReq(req *dhtReq) {
|
||||
func (t *dht) sendRes(res *dhtRes, req *dhtReq) {
|
||||
// Send a reply for a dhtReq
|
||||
bs := res.encode()
|
||||
shared := t.core.sessions.getSharedKey(&t.core.boxPriv, &req.Key)
|
||||
shared := t.core.router.sessions.getSharedKey(&t.core.boxPriv, &req.Key)
|
||||
payload, nonce := crypto.BoxSeal(shared, bs, nil)
|
||||
p := wire_protoTrafficPacket{
|
||||
Coords: req.Coords,
|
||||
@ -285,7 +285,7 @@ func (t *dht) handleRes(res *dhtRes) {
|
||||
func (t *dht) sendReq(req *dhtReq, dest *dhtInfo) {
|
||||
// Send a dhtReq to the node in dhtInfo
|
||||
bs := req.encode()
|
||||
shared := t.core.sessions.getSharedKey(&t.core.boxPriv, &dest.key)
|
||||
shared := t.core.router.sessions.getSharedKey(&t.core.boxPriv, &dest.key)
|
||||
payload, nonce := crypto.BoxSeal(shared, bs, nil)
|
||||
p := wire_protoTrafficPacket{
|
||||
Coords: dest.coords,
|
||||
|
Reference in New Issue
Block a user