Documentation ¶
Index ¶
Constants ¶
View Source
const ( // PayloadSize is 50 bytes // 32 byte pubkey + 18 byte NetAddr PayloadSize = crypto.PublicKeySize + NetAddrSize // NetAddrSize is 18 bytes // 16 byte ipv6 address + 2 byte port NetAddrSize = 18 )
Variables ¶
View Source
var ( // ErrNodeID is thrown on parsing an invalid node ID ErrNodeID = errors.New("invalid node id") // ErrPubkey is thrown on an invalid pubkey ErrPubkey = errors.New("invalid public key") )
View Source
var ( // ErrHost is thrown on an invalid listening address ErrHost = errors.New("invalid host") // ErrDisconnect is thrown when disconnecting from an invalid peer ErrDisconnect = errors.New("already disconnected") )
View Source
var ( // ErrDelete is thrown on an unsuccessful delete ErrDelete = errors.New("unsuccessful delete") )
Functions ¶
Types ¶
type Key ¶
type Key struct { ID primitive.ObjectID `bson:"_id,omitempty"` CreatedAt time.Time `bson:"created_at,omitempty"` UpdatedAt time.Time `bson:"updated_at,omitempty"` Raw []byte `bson:"raw"` }
Key represents an encrypted key pair
type Node ¶
type Node struct { ID string // unique node ID Addr net.IP // public listening addr Port uint16 // listening port KeyPair *crypto.KeyPair // Node identifier Server rpc.Server // RPC server Store Store // persistent store Ctx context.Context // calling context Peers map[string]Peer // connected peers PeerUpdates chan Peer // provider manager }
Node represents a host on the network
func (*Node) Disconnect ¶
Disconnect from a peer if connected
type Peer ¶
type Peer struct { Pubkey []byte // public key Host net.IP // host ip Port uint16 // tcp port // contains filtered or unexported fields }
Peer wraps an RPC client used to connect to a peer
type Store ¶
type Store struct { Ctx ctx.Context // calling context ID *mongo.Collection // collection of encrypted node identifiers }
Store wraps a mongo connection to a node store
func (*Store) GetEntries ¶
GetEntries decrypts the node store
Click to show internal directories.
Click to hide internal directories.