2022-01-10 18:43:13 +01:00
|
|
|
package peer
|
|
|
|
|
|
|
|
import log "github.com/sirupsen/logrus"
|
|
|
|
|
|
|
|
type ConnStatus int
|
|
|
|
|
|
|
|
func (s ConnStatus) String() string {
|
|
|
|
switch s {
|
|
|
|
case StatusConnecting:
|
2022-07-05 19:47:50 +02:00
|
|
|
return "Connecting"
|
2022-01-10 18:43:13 +01:00
|
|
|
case StatusConnected:
|
2022-07-05 19:47:50 +02:00
|
|
|
return "Connected"
|
2022-01-10 18:43:13 +01:00
|
|
|
case StatusDisconnected:
|
2022-07-05 19:47:50 +02:00
|
|
|
return "Disconnected"
|
2022-01-10 18:43:13 +01:00
|
|
|
default:
|
|
|
|
log.Errorf("unknown status: %d", s)
|
|
|
|
return "INVALID_PEER_CONNECTION_STATUS"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
2022-07-05 19:47:50 +02:00
|
|
|
StatusConnected ConnStatus = iota
|
2022-01-10 18:43:13 +01:00
|
|
|
StatusConnecting
|
|
|
|
StatusDisconnected
|
|
|
|
)
|