noise: github.com/perlin-network/noise/protocol Index | Files

package protocol

import "github.com/perlin-network/noise/protocol"

Index

Package Files

identity.go mod.go

Constants

const (
    KeySharedKey = "identity.shared_key"
    KeyID        = "node.id"
    KeyPeerID    = "peer.id"
)
const (
    KeyProtocolCurrentBlockIndex = "protocol.current_block_index"
    KeyProtocolEnforceOnce       = "protocol.enforce_once"
)

Variables

var (
    DisconnectPeer = errors.New("peer disconnect requested")
)

func DeleteNodeID Uses

func DeleteNodeID(node *noise.Node)

func DeletePeerID Uses

func DeletePeerID(peer *noise.Peer)

func DeleteSharedKey Uses

func DeleteSharedKey(peer *noise.Peer)

func HasPeerID Uses

func HasPeerID(peer *noise.Peer) bool

func HasSharedKey Uses

func HasSharedKey(peer *noise.Peer) bool

func LoadSharedKey Uses

func LoadSharedKey(peer *noise.Peer) []byte

func MustSharedKey Uses

func MustSharedKey(peer *noise.Peer) []byte

func Peer Uses

func Peer(node *noise.Node, id ID) *noise.Peer

func SetNodeID Uses

func SetNodeID(node *noise.Node, id ID)

func SetPeerID Uses

func SetPeerID(peer *noise.Peer, id ID)

func SetSharedKey Uses

func SetSharedKey(peer *noise.Peer, sharedKey []byte)

type Block Uses

type Block interface {
    OnRegister(p *Protocol, node *noise.Node)
    OnBegin(p *Protocol, peer *noise.Peer) error
    OnEnd(p *Protocol, peer *noise.Peer) error
}

type ID Uses

type ID interface {
    fmt.Stringer
    noise.Message

    Equals(other ID) bool

    PublicKey() []byte
    Hash() []byte
}

func NodeID Uses

func NodeID(node *noise.Node) ID

func PeerID Uses

func PeerID(peer *noise.Peer) ID

type Protocol Uses

type Protocol struct {
    // contains filtered or unexported fields
}

func New Uses

func New() *Protocol

func (*Protocol) Enforce Uses

func (p *Protocol) Enforce(node *noise.Node)

Enforce enforces that all peers of a node follow the given protocol.

func (*Protocol) Register Uses

func (p *Protocol) Register(blk Block) *Protocol

Register registers a block to this protocol sequentially.

Package protocol imports 6 packages (graph) and is imported by 5 packages. Updated 2019-03-05. Refresh now. Tools for package owners.