go-http-peering/peer.go

38 lines
484 B
Go
Raw Normal View History

2019-02-03 20:56:58 +01:00
package peering
import (
"time"
"github.com/pborman/uuid"
)
type PeerID string
func NewPeerID() PeerID {
id := uuid.New()
return PeerID(id)
}
type PeerStatus int
const (
StatusPending PeerStatus = iota
StatusPeered
StatusRejected
)
type PeerHeader struct {
ID PeerID
Status PeerStatus
LastAddress string
LastContact time.Time
}
type PeerAttributes map[string]interface{}
type Peer struct {
PeerHeader
Attributes PeerAttributes
PublicKey []byte
}