Versions in this module Expand all Collapse all v0 v0.1.0 Apr 14, 2026 Changes in this version + const EMADecay + const IdentityConflictWindow + const MaxDriftBeforeChallenge + const TrustThresholdPending + const TrustThresholdSuspect + const TrustThresholdTrusted + func CanonicalizeEvent(payload *EventPayload) ([]byte, error) + func FormatNodeID(nodeID string) string + func HashEvent(canonicalBytes []byte) string + func PublicKeyFromDER(der []byte) (*ecdsa.PublicKey, error) + func RegisterHandlers(mux *http.ServeMux, node *Node) + func Run() + func SaveIdentity(id *NodeIdentity, dir string) error + func TrustLevel(score float64) string + func Verify(pubKey *ecdsa.PublicKey, data, signature []byte) bool + func VerifyHeartbeat(hb *Heartbeat) (bool, *ecdsa.PublicKey, error) + type CoherenceCheck struct + Detail string + Layer string + Pass bool + type CoherenceReport struct + Checks []CoherenceCheck + Pass bool + Timestamp string + func ValidateCoherence(events []*EventEnvelope) *CoherenceReport + type EventEnvelope struct + HashedPayload EventPayload + Metadata EventMetadata + func NewEvent(nodeID, eventType string, seq int64, priorHash string, ...) (*EventEnvelope, error) + type EventMetadata struct + Hash string + Seq int64 + type EventPayload struct + Data map[string]interface{} + NodeID string + PriorHash string + Timestamp string + Type string + type GitStore struct + func NewGitStore(path string) (*GitStore, error) + func (gs *GitStore) AppendEvent(envelope *EventEnvelope) error + func (gs *GitStore) CommitHash() (string, error) + func (gs *GitStore) CorruptEvent(seq int64) error + func (gs *GitStore) LastEvent() (*EventEnvelope, error) + func (gs *GitStore) ReadEventRange(startSeq, endSeq int64) ([]*EventEnvelope, error) + func (gs *GitStore) TreeHash() (string, error) + type Heartbeat struct + LastHash string + ListenAddr string + NodeID string + PublicKey string + Seq int64 + Signature string + Timestamp string + TreeHash string + type HeartbeatRunner struct + func NewHeartbeatRunner(node *Node, interval time.Duration) *HeartbeatRunner + func (hr *HeartbeatRunner) Start() + func (hr *HeartbeatRunner) Stop() + type Node struct + DataDir string + Hostname string + Identity *NodeIdentity + Name string + Peers *PeerRegistry + Port int + Store *GitStore + func NewNode(name string, port int, dataDir string) (*Node, error) + func (n *Node) AppendEvent(eventType string, data map[string]any) error + func (n *Node) CurrentState() (*NodeState, error) + func (n *Node) ListenAddr() string + func (n *Node) SelfCheck() (*CoherenceReport, error) + func (n *Node) Start(initialPeers []string) error + func (n *Node) Stop() + type NodeIdentity struct + NodeID string + PrivateKey *ecdsa.PrivateKey + PublicKey *ecdsa.PublicKey + func GenerateIdentity() (*NodeIdentity, error) + func LoadIdentity(dir string) (*NodeIdentity, error) + func (id *NodeIdentity) MarshalPublicKey() ([]byte, error) + func (id *NodeIdentity) Sign(data []byte) ([]byte, error) + type NodeState struct + LastHash string + Name string + NodeID string + Seq int64 + TreeHash string + type PeerRegistry struct + func NewPeerRegistry() *PeerRegistry + func (pr *PeerRegistry) AddPeer(addr string) + func (pr *PeerRegistry) AllPeers() []*PeerState + func (pr *PeerRegistry) GetByID(nodeID string) *PeerState + func (pr *PeerRegistry) GetPeer(addr string) *PeerState + func (pr *PeerRegistry) ProcessHeartbeat(addr string, hb *Heartbeat, pubKey *ecdsa.PublicKey) error + func (pr *PeerRegistry) Summarize() []PeerSummary + type PeerState struct + Addr string + DriftCount int + LastHash string + LastSeen time.Time + LastSeq int64 + NodeID string + PublicDER []byte + PublicKey *ecdsa.PublicKey + Rejected bool + TreeHash string + Trust float64 + type PeerSummary struct + Addr string + DriftCount int + LastSeen string + NodeID string + Rejected bool + Seq int64 + Trust float64 + TrustLevel string