From 04b3e840238ad6e63f2483000c77a69977ac52f3 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 21 May 2018 16:15:31 +0100 Subject: [PATCH] Show your IPv6 address and subnet when starting --- src/yggdrasil/core.go | 8 ++++++++ yggdrasil.go | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/yggdrasil/core.go b/src/yggdrasil/core.go index 838feef0..10c46f36 100644 --- a/src/yggdrasil/core.go +++ b/src/yggdrasil/core.go @@ -62,3 +62,11 @@ func (c *Core) GetNodeID() *NodeID { func (c *Core) GetTreeID() *TreeID { return getTreeID(&c.sigPub) } + +func (c *Core) GetAddress() *address { + return address_addrForNodeID(c.GetNodeID()) +} + +func (c *Core) GetSubnet() *subnet { + return address_subnetForNodeID(c.GetNodeID()) +} diff --git a/yggdrasil.go b/yggdrasil.go index c5d08446..7115bded 100644 --- a/yggdrasil.go +++ b/yggdrasil.go @@ -272,6 +272,11 @@ func main() { n.core.DEBUG_stopTun() }() logger.Println("Started...") + address := (*n.core.GetAddress())[:] + subnet := (*n.core.GetSubnet())[:] + subnet = append(subnet, 0, 0, 0, 0, 0, 0, 0, 0) + logger.Printf("Your IPv6 address is %s", net.IP(address).String()) + logger.Printf("Your IPv6 subnet is %s/64", net.IP(subnet).String()) if cfg.Multicast { addr, err := net.ResolveUDPAddr("udp", multicastAddr) if err != nil {