You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

peer.go 484B

12345678910111213141516171819202122232425262728293031323334353637
  1. package peering
  2. import (
  3. "time"
  4. "github.com/pborman/uuid"
  5. )
  6. type PeerID string
  7. func NewPeerID() PeerID {
  8. id := uuid.New()
  9. return PeerID(id)
  10. }
  11. type PeerStatus int
  12. const (
  13. StatusPending PeerStatus = iota
  14. StatusPeered
  15. StatusRejected
  16. )
  17. type PeerHeader struct {
  18. ID PeerID
  19. Status PeerStatus
  20. LastAddress string
  21. LastContact time.Time
  22. }
  23. type PeerAttributes map[string]interface{}
  24. type Peer struct {
  25. PeerHeader
  26. Attributes PeerAttributes
  27. PublicKey []byte
  28. }