go-http-peering: forge.cadoles.com/wpetit/go-http-peering Index | Files | Directories

package peering

import "forge.cadoles.com/wpetit/go-http-peering"

Index

Package Files

peer.go request.go store.go

Constants

const (
    AdvertisePath = "/advertise"
    UpdatePath    = "/update"
    PingPath      = "/ping"
)

Variables

var (
    ErrPeerNotFound = errors.New("peer not found")
    ErrPeerExists   = errors.New("peer exists")
)

type AdvertisingRequest Uses

type AdvertisingRequest struct {
    Attributes PeerAttributes
    PublicKey  []byte
}

type ClientTokenClaims Uses

type ClientTokenClaims struct {
    jwt.StandardClaims
    BodySum []byte `json:"bodySum"`
}

type Peer Uses

type Peer struct {
    PeerHeader
    Attributes PeerAttributes
    PublicKey  []byte
}

type PeerAttributes Uses

type PeerAttributes map[string]interface{}

type PeerHeader Uses

type PeerHeader struct {
    ID          PeerID
    Status      PeerStatus
    LastAddress string
    LastContact time.Time
}

type PeerID Uses

type PeerID string

func NewPeerID Uses

func NewPeerID() PeerID

type PeerStatus Uses

type PeerStatus int
const (
    StatusPending PeerStatus = iota
    StatusPeered
    StatusRejected
)

type ServerTokenClaims Uses

type ServerTokenClaims struct {
    jwt.StandardClaims
    PeerID PeerID `json:"peerID"`
}

type Store Uses

type Store interface {
    Create(id PeerID, attrs PeerAttributes) (*Peer, error)
    Get(id PeerID) (*Peer, error)
    Delete(id PeerID) error
    List() ([]PeerHeader, error)

    UpdatePublicKey(id PeerID, publicKey []byte) error
    UpdateAttributes(id PeerID, attrs PeerAttributes) error
    UpdateLastContact(id PeerID, remoteAddress string, ts time.Time) error

    Accept(id PeerID) error
    Forget(id PeerID) error
    Reject(id PeerID) error
}

type UpdateRequest Uses

type UpdateRequest struct {
    Attributes PeerAttributes
}

Directories

PathSynopsis
chi
client
crypto
memory
server

Package peering imports 4 packages (graph) and is imported by 5 packages. Updated 2019-06-19. Refresh now. Tools for package owners.