38 lines
484 B
Go
38 lines
484 B
Go
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
|
|
}
|