| 636 | } |
| 637 | |
| 638 | func (c *configMaps) fillPeerDiagnostics(d *PeerDiagnostics, peerID uuid.UUID) { |
| 639 | status := c.status() |
| 640 | c.L.Lock() |
| 641 | defer c.L.Unlock() |
| 642 | if c.derpMap != nil { |
| 643 | for j, r := range c.derpMap.Regions { |
| 644 | d.DERPRegionNames[j] = r.RegionName |
| 645 | } |
| 646 | } |
| 647 | lc, ok := c.peers[peerID] |
| 648 | if !ok || lc.node == nil { |
| 649 | return |
| 650 | } |
| 651 | |
| 652 | d.ReceivedNode = lc.node |
| 653 | ps, ok := status.Peer[lc.node.Key] |
| 654 | if !ok { |
| 655 | return |
| 656 | } |
| 657 | d.LastWireguardHandshake = ps.LastHandshake |
| 658 | } |
| 659 | |
| 660 | func (c *configMaps) knownPeerIDs() []uuid.UUID { |
| 661 | c.L.Lock() |