| 998 | } |
| 999 | |
| 1000 | func (s *connectionStatusHandler) setConnectionStatus(address string, err error) { |
| 1001 | if errors.Is(err, context.Canceled) { |
| 1002 | return |
| 1003 | } |
| 1004 | |
| 1005 | status := ConnectionStatusEntry{When: time.Now().UTC().Truncate(time.Second)} |
| 1006 | if err != nil { |
| 1007 | errStr := err.Error() |
| 1008 | status.Error = &errStr |
| 1009 | } |
| 1010 | |
| 1011 | s.connectionStatusMut.Lock() |
| 1012 | s.connectionStatus[address] = status |
| 1013 | s.connectionStatusMut.Unlock() |
| 1014 | } |
| 1015 | |
| 1016 | func (s *service) NATType() string { |
| 1017 | s.listenersMut.RLock() |