5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 12:15:39 +00:00

Show your IPv6 address and subnet when starting

This commit is contained in:
Neil Alexander 2018-05-21 16:15:31 +01:00
parent bd32f5890b
commit 04b3e84023
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
2 changed files with 13 additions and 0 deletions

View File

@ -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())
}

View File

@ -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 {