mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-25 17:43:38 +01:00
337d3edcc4
The ConnStatus is a custom type based on iota like an enum. The problem was nowhere used to the benefits of this implementation. All ConnStatus instances has been compared with strings. I suppose the reason to do it to avoid a circle dependency. In this commit the separated status package has been moved to peer package. Remove unused, exported functions from engine
30 lines
690 B
Go
30 lines
690 B
Go
package peer
|
|
|
|
import log "github.com/sirupsen/logrus"
|
|
|
|
const (
|
|
// StatusConnected indicate the peer is in connected state
|
|
StatusConnected ConnStatus = iota
|
|
// StatusConnecting indicate the peer is in connecting state
|
|
StatusConnecting
|
|
// StatusDisconnected indicate the peer is in disconnected state
|
|
StatusDisconnected
|
|
)
|
|
|
|
// ConnStatus describe the status of a peer's connection
|
|
type ConnStatus int
|
|
|
|
func (s ConnStatus) String() string {
|
|
switch s {
|
|
case StatusConnecting:
|
|
return "Connecting"
|
|
case StatusConnected:
|
|
return "Connected"
|
|
case StatusDisconnected:
|
|
return "Disconnected"
|
|
default:
|
|
log.Errorf("unknown status: %d", s)
|
|
return "INVALID_PEER_CONNECTION_STATUS"
|
|
}
|
|
}
|