(broken state) WIP address migration

This commit is contained in:
Arceliar 2021-05-08 07:25:53 -05:00
parent ae96148008
commit ace7b43b6d
9 changed files with 73 additions and 120 deletions

View file

@ -9,7 +9,7 @@ import (
"time"
"github.com/gologme/log"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
//"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/Arceliar/phony"
@ -314,8 +314,10 @@ func (c *Core) Coords() []uint64 {
// that application also implements either VPN functionality or deals with IP
// packets specifically.
func (c *Core) Address() net.IP {
address := net.IP(address.AddrForNodeID(c.NodeID())[:])
return address
panic("TODO")
return nil
//address := net.IP(address.AddrForNodeID(c.NodeID())[:])
//return address
}
// Subnet gets the routed IPv6 subnet of the Yggdrasil node. This is always a
@ -324,9 +326,11 @@ func (c *Core) Address() net.IP {
// that application also implements either VPN functionality or deals with IP
// packets specifically.
func (c *Core) Subnet() net.IPNet {
subnet := address.SubnetForNodeID(c.NodeID())[:]
subnet = append(subnet, 0, 0, 0, 0, 0, 0, 0, 0)
return net.IPNet{IP: subnet, Mask: net.CIDRMask(64, 128)}
panic("TODO")
return net.IPNet{}
//subnet := address.SubnetForNodeID(c.NodeID())[:]
//subnet = append(subnet, 0, 0, 0, 0, 0, 0, 0, 0)
//return net.IPNet{IP: subnet, Mask: net.CIDRMask(64, 128)}
}
// MyNodeInfo gets the currently configured nodeinfo. NodeInfo is typically

View file

@ -13,7 +13,7 @@ import (
//"sync/atomic"
"time"
"github.com/yggdrasil-network/yggdrasil-go/src/address"
//"github.com/yggdrasil-network/yggdrasil-go/src/address"
"github.com/yggdrasil-network/yggdrasil-go/src/crypto"
"github.com/yggdrasil-network/yggdrasil-go/src/util"
"golang.org/x/net/proxy"
@ -287,7 +287,7 @@ func (intf *link) handler() (chan struct{}, error) {
intf.peer.Act(intf, intf.peer._removeSelf)
})
}()
themAddr := address.AddrForNodeID(crypto.GetNodeID(&intf.info.box))
themAddr := make([]byte, 16) // TODO address.AddrForNodeID(crypto.GetNodeID(&intf.info.box))
themAddrString := net.IP(themAddr[:]).String()
themString := fmt.Sprintf("%s@%s", themAddrString, intf.info.remote)
intf.links.core.log.Infof("Connected %s: %s, source %s",

View file

@ -53,8 +53,8 @@ type router struct {
// Initializes the router struct, which includes setting up channels to/from the adapter.
func (r *router) init(core *Core) {
r.core = core
r.addr = *address.AddrForNodeID(&r.dht.nodeID)
r.subnet = *address.SubnetForNodeID(&r.dht.nodeID)
// TODO r.addr = *address.AddrForNodeID(&r.dht.nodeID)
// TODO r.subnet = *address.SubnetForNodeID(&r.dht.nodeID)
r.intf.router = r
phony.Block(&r.core.peers, func() {
// FIXME don't block here!

View file

@ -221,8 +221,8 @@ func (ss *sessions) createSession(theirPermKey *crypto.BoxPubKey) *sessionInfo {
sinfo.myNonce[len(sinfo.myNonce)-1] &= 0xfe
}
sinfo.myHandle = *crypto.NewHandle()
sinfo.theirAddr = *address.AddrForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
sinfo.theirSubnet = *address.SubnetForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
// TODO sinfo.theirAddr = *address.AddrForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
// TODO sinfo.theirSubnet = *address.SubnetForNodeID(crypto.GetNodeID(&sinfo.theirPermPub))
sinfo.table = ss.router.table
ss.sinfos[sinfo.myHandle] = &sinfo
ss.byTheirPerm[sinfo.theirPermPub] = &sinfo.myHandle