Documentation
¶
Overview ¶
Package node orchestrates identity, config, storage, network and protocol. It is the only package that composes the base modules; it never reimplements their policies.
Index ¶
- Constants
- Variables
- func NewPeerCache(store *storage.Store) network.PeerCache
- type AckEvent
- type AutoNATStatus
- type BootstrapPeer
- type CachedPeer
- type ChatEvent
- type ConnectResult
- type ConnectionEvent
- type Conversation
- type ConversationPage
- type DCUtRStatus
- type DHTPeer
- type DHTStatus
- type DialAttempt
- type DiscoveryRefreshPeer
- type DiscoveryRefreshPeerPage
- type DownloadOptions
- type DownloadProgress
- type DownloadResult
- type DraftUpdate
- type Event
- type Favorite
- type FavoritePage
- type Friend
- type HumanOutboundPage
- type HumanOutboundPeer
- type MarkReadResult
- type MessagePage
- type MessageRetention
- type NetworkStatus
- type Node
- func (n *Node) AddBootstrapCard(ctx context.Context, code string) (BootstrapPeer, bool, error)
- func (n *Node) AddBootstrapPeer(ctx context.Context, multiaddr string) (BootstrapPeer, bool, error)
- func (n *Node) AddPeer(ctx context.Context, multiaddr string) (network.PeerEntry, error)
- func (n *Node) BootstrapPeers(ctx context.Context) ([]BootstrapPeer, error)
- func (n *Node) CancelOutbox(ctx context.Context, messageID string) error
- func (n *Node) Connect(ctx context.Context, peerID, multiaddr string) (ConnectResult, error)
- func (n *Node) ConnectContactCard(ctx context.Context, code string) (ConnectResult, error)
- func (n *Node) ConnectListedPeer(ctx context.Context, peerID string, addrs []string) (ConnectResult, error)
- func (n *Node) ContactCard(ctx context.Context, rawPeerID string, includeAddresses bool) (contactcard.Card, bool, error)
- func (n *Node) ContactCardForScopes(ctx context.Context, rawPeerID string, scopes contactcard.AddressScopes) (contactcard.Card, contactcard.AddressScopes, error)
- func (n *Node) DHTFindPeer(ctx context.Context, peerID string) (network.DHTPeer, error)
- func (n *Node) DHTStatus() network.DHTStatus
- func (n *Node) DeletePublicDraft(ctx context.Context, id string, expectedRevision int64) (bool, error)
- func (n *Node) Disconnect(ctx context.Context, peerID string) error
- func (n *Node) Download(ctx context.Context, peerID, remotePath string, ...) (DownloadResult, error)
- func (n *Node) DownloadPeerFile(ctx context.Context, peerID, path string, progress func(DownloadProgress), ...) (DownloadResult, error)
- func (n *Node) DownloadWithOptions(ctx context.Context, peerID, remotePath string, ...) (DownloadResult, error)
- func (n *Node) FetchManifest(ctx context.Context, peerID string, offset, limit int) (PeerManifest, error)
- func (n *Node) Friends(ctx context.Context) ([]Friend, error)
- func (n *Node) GetPeerFriends(ctx context.Context, peerID string) (PeerFriends, error)
- func (n *Node) GetPeerManifest(ctx context.Context, peerID string, offset, limit int) (PeerManifest, error)
- func (n *Node) GetPeerProfile(ctx context.Context, peerID string) (PeerProfile, error)
- func (n *Node) GetPublicDraft(ctx context.Context, id string) (PublicDraft, bool, error)
- func (n *Node) GetPublicDraftAsset(ctx context.Context, draftID, assetID string) (PublicDraftAsset, bool, error)
- func (n *Node) ImportPublicPost(ctx context.Context, rel string) (PublicDraft, error)
- func (n *Node) ListConversations(ctx context.Context, before string, limit int) (ConversationPage, error)
- func (n *Node) ListDiscoveries(ctx context.Context, before string, limit int, familiarOnly bool, ...) (PublicDiscoveryPage, error)
- func (n *Node) ListDiscoveryRefreshPeers(ctx context.Context, familiarOnly bool, limit int, after string) (DiscoveryRefreshPeerPage, error)
- func (n *Node) ListFavorites(ctx context.Context, before string, limit int) (FavoritePage, error)
- func (n *Node) ListFriends(ctx context.Context) ([]Friend, error)
- func (n *Node) ListHumanOutboundPeers(ctx context.Context, before string, limit int) (HumanOutboundPage, error)
- func (n *Node) ListMessages(ctx context.Context, peerID, before string, limit int) (MessagePage, error)
- func (n *Node) ListOutbox(ctx context.Context, limit int) ([]OutboxEntry, error)
- func (n *Node) ListPublicDrafts(ctx context.Context, kind, before string, limit int) ([]PublicDraft, bool, string, error)
- func (n *Node) MarkConversationRead(ctx context.Context, peerID, throughMessageID string) (MarkReadResult, error)
- func (n *Node) Outbox(ctx context.Context, limit int) ([]OutboxEntry, OutboxStats, error)
- func (n *Node) OutboxStats(ctx context.Context) (OutboxStats, error)
- func (n *Node) PausePeer(ctx context.Context, peerID string) error
- func (n *Node) Peers(ctx context.Context) ([]PeerStatus, error)
- func (n *Node) PreviewContactCard(ctx context.Context, code string) (contactcard.Card, string, error)
- func (n *Node) PublishPublicDraft(ctx context.Context, id string, expectedRevision int64, ...) (PublishResult, error)
- func (n *Node) Published(ctx context.Context) (Published, error)
- func (n *Node) PutPublicDraftImage(ctx context.Context, draftID, role, filename string, data []byte) (PublicDraftAsset, error)
- func (n *Node) RecentMessages(ctx context.Context, limit int) ([]StoredMessage, error)
- func (n *Node) RecoverPublication(ctx context.Context) ([]string, error)
- func (n *Node) RelayProvider() network.RelayProviderStatus
- func (n *Node) RelayReservations() []network.RelayReservation
- func (n *Node) RemoveBootstrapPeer(ctx context.Context, peerID string) (bool, error)
- func (n *Node) RemoveFriend(ctx context.Context, peerID string, cancelPending bool) (bool, int, error)
- func (n *Node) ResumePeer(ctx context.Context, pid peer.ID) error
- func (n *Node) SavePublicDraft(ctx context.Context, in DraftUpdate) (PublicDraft, error)
- func (n *Node) SendChat(ctx context.Context, peerIDStr, multiaddrStr, text string) (SendResult, error)
- func (n *Node) SendChatOrigin(ctx context.Context, peerIDStr, multiaddrStr, text, origin, requestID string) (SendResult, error)
- func (n *Node) SetFavorite(ctx context.Context, peerID, publicPath, digest, title string, favorite bool) (Favorite, bool, error)
- func (n *Node) SetFriendDescription(ctx context.Context, peerID, description string) (Friend, error)
- func (n *Node) SetFriendName(ctx context.Context, peerID, name string) (Friend, error)
- func (n *Node) Start(ctx context.Context) error
- func (n *Node) Status(ctx context.Context) (Status, error)
- func (n *Node) Stop(context.Context) error
- func (n *Node) Subscribe(ctx context.Context) (<-chan Event, func(), error)
- func (n *Node) SyncFriends(ctx context.Context) (bool, error)
- func (n *Node) ViewFriends(ctx context.Context, peerID string) (PeerFriends, error)
- func (n *Node) ViewProfile(ctx context.Context, peerID string) (PeerProfile, error)
- type Options
- type OutboxEntry
- type OutboxStats
- type PeerEntry
- type PeerFriend
- type PeerFriends
- type PeerManifest
- type PeerProfile
- type PeerStatus
- type PublicDiscovery
- type PublicDiscoveryPage
- type PublicDraft
- type PublicDraftAsset
- type PublicProfile
- type PublishFile
- type PublishResult
- type Published
- type PublishedFile
- type PublishedSkip
- type RelayProviderStatus
- type RelayReservation
- type ResourceStatus
- type SendResult
- type Status
- type StoredMessage
Constants ¶
const ( PublishStatusPublished = publication.StatusPublished PublishStatusAlreadyPublished = publication.StatusAlreadyPublished PublishStatusConflict = publication.StatusConflict PublishStatusInvalid = publication.StatusInvalid PublishStatusPartial = publication.StatusPartial )
const ( OriginHuman = storage.OriginHuman OriginAgent = storage.OriginAgent OriginUnknown = storage.OriginUnknown )
Local send provenance values. They are an operator model, not strong auth.
const ( DeliveryPending = storage.DeliveryPending DeliveryAcked = storage.DeliveryAcked DeliveryFailed = storage.DeliveryFailed DeliveryCancelled = storage.DeliveryCancelled DeliveryUnknown = storage.DeliveryUnknown DeliveryReceived = storage.DeliveryReceived )
Delivery states exposed by the local API.
Variables ¶
var ( ErrFriendNotFound = storage.ErrFriendNotFound ErrFriendNameTaken = storage.ErrFriendNameTaken ErrFriendPendingOutbox = storage.ErrFriendPendingOutbox )
Friend sentinel errors are stable API-facing aliases for the storage errors.
var ( ErrDraftConflict = storage.ErrDraftConflict ErrDraftNotFound = storage.ErrDraftNotFound ErrDraftInvalid = publication.ErrDraftInvalid )
var ErrContactNotFound = errors.New("contact was not found")
var ErrFavoriteTarget = errors.New("node: favorite target is not an available public post")
ErrFavoriteTarget reports a favorite target that is not a verified public post version or not an accepted post path.
var ErrInvalidCursor = storage.ErrInvalidCursor
ErrInvalidCursor reports a malformed message or conversation cursor.
var ErrMessageNotFound = storage.ErrMessageNotFound
ErrMessageNotFound reports a missing message inside the stated Peer's retained history.
var ErrOwnContactCard = errors.New("this is your own Raminga ID")
Functions ¶
Types ¶
type AutoNATStatus ¶
type AutoNATStatus = network.AutoNATStatus
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type BootstrapPeer ¶
type BootstrapPeer struct {
PeerID string
Addrs []string
Online bool
Paused bool
SavedAt time.Time
}
BootstrapPeer is one saved bootstrap role. Online is a live connection fact, not a claim that the saved address is reachable; Paused is the persistent explicit-disconnect flag, which add/remove/restart never clear.
type CachedPeer ¶
type CachedPeer = network.CachedPeer
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type ChatEvent ¶
type ChatEvent struct {
MessageID string
FromPeerID string
FromNodeID string
Text string
Duplicate bool
Accepted bool
}
ChatEvent reports an inbound chat message.
type ConnectResult ¶
type ConnectResult struct {
PeerID string
Transport string
Route string
RelayPeerID string
Direct bool
Limited bool
RemoteMultiaddr string
Reused bool
RequestedTransport string
TransportChanged bool
Source string
Attempts []network.DialAttempt
Note string
}
ConnectResult is the outcome of an explicit dial or a peer-ID dial.
type ConnectionEvent ¶
type ConnectionEvent struct {
PeerID string
Direction string
Transport string
Route string
RelayPeerID string
RemoteMultiaddr string
Kind string // "connected" or "disconnected"
Direct bool
Limited bool
}
ConnectionEvent reports a connection change.
type Conversation ¶
type Conversation struct {
PeerID string
LastMessageID string
Direction string
Preview string
LastAt time.Time
DeliveryStatus string
Origin string
MessageCount int
UnreadCount int
LastReadMessageID string
LastReadAt time.Time
}
Conversation is one Peer's latest retained message.
type ConversationPage ¶
type ConversationPage struct {
Conversations []Conversation
NextBefore string
HasMore bool
Retention MessageRetention
TotalUnread int
}
ConversationPage is one keyset page of conversation summaries.
type DCUtRStatus ¶
type DCUtRStatus = network.DCUtRStatus
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type DHTPeer ¶
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type DHTStatus ¶
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type DialAttempt ¶
type DialAttempt = network.DialAttempt
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type DiscoveryRefreshPeer ¶
DiscoveryRefreshPeer is one bounded local Feed refresh candidate.
type DiscoveryRefreshPeerPage ¶
type DiscoveryRefreshPeerPage struct {
Peers []DiscoveryRefreshPeer
Total int
Truncated bool
HasMore bool
NextAfter string
}
DiscoveryRefreshPeerPage is one bounded local refresh candidate snapshot.
type DownloadOptions ¶
DownloadOptions controls optional evidence recording for one download.
type DownloadProgress ¶
type DownloadResult ¶
type DraftUpdate ¶
type DraftUpdate = publication.DraftUpdate
Public draft views are aliases so the local API does not duplicate storage or publication schemas.
type Event ¶
type Event struct {
At time.Time
Chat *ChatEvent
Ack *AckEvent
Connection *ConnectionEvent
}
Event is one local-API notification.
type Favorite ¶
type Favorite struct {
ID string
PeerID string
Path string
SHA256 string
Title string
CreatedAt time.Time
Available bool
}
Favorite is one private public-post bookmark. There is deliberately no kind/message/contact field.
type FavoritePage ¶
FavoritePage is one keyset page of favorites.
type Friend ¶
type Friend struct {
PeerID string
Name string
Addrs []string
Description string
ManuallyConnected bool
RelayCapable bool
DHTCapable bool
Paused bool
FirstSeen time.Time
LastInteraction time.Time
UnreadCount int
}
Friend is the node-facing friend view. Names/descriptions are local only.
type HumanOutboundPage ¶
type HumanOutboundPage struct {
Peers []HumanOutboundPeer
NextBefore string
HasMore bool
}
HumanOutboundPage is one keyset page of durable human-outbound relations.
type HumanOutboundPeer ¶
type HumanOutboundPeer struct {
PeerID string
FirstAt time.Time
LastAt time.Time
// PagingRowID and PagingSnapshotID are opaque keyset positions for the
// stable relation snapshot. They are not serialized as public relation data.
PagingRowID int64
PagingSnapshotID int64
}
HumanOutboundPeer is one durable human-outbound relation.
type MarkReadResult ¶
type MarkReadResult struct {
PeerID string
LastReadMessageID string
LastReadAt time.Time
UnreadCount int
}
MarkReadResult is one monotonic human read-cursor update.
type MessagePage ¶
type MessagePage struct {
Messages []StoredMessage
NextBefore string
HasMore bool
Retention MessageRetention
}
MessagePage is one keyset page of retained messages, newest first.
type MessageRetention ¶
MessageRetention describes currently retained rows, not pruned history.
type NetworkStatus ¶
type NetworkStatus struct {
Reachability string
AutoNAT network.AutoNATStatus
DCUtR network.DCUtRStatus
Relays []network.RelayReservation
RelayProvider network.RelayProviderStatus
DHT network.DHTStatus
Resources network.ResourceStatus
PeerCache []network.CachedPeer
UPNP bool
NATPMP bool
STUN bool
}
NetworkStatus groups G2 diagnostics. Cached addresses are never online.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is the running node orchestration.
func (*Node) AddBootstrapCard ¶
AddBootstrapCard saves the addresses together as a bootstrap setting. It does not import the card into the contacts list.
func (*Node) AddBootstrapPeer ¶
AddBootstrapPeer persists one validated bootstrap role and applies it to the live DHT. Persistence is the save receipt; the bootstrap dial continues in the background and never turns into a false "online" result.
func (*Node) BootstrapPeers ¶
func (n *Node) BootstrapPeers(ctx context.Context) ([]BootstrapPeer, error)
BootstrapPeers returns saved bootstrap roles with separate live online and persistent paused flags. It never dials or treats cache presence as online.
func (*Node) CancelOutbox ¶
CancelOutbox cancels one pending entry; terminal entries are rejected.
func (*Node) Connect ¶
Connect dials a peer by explicit multiaddr or, when only a Peer ID is given, through resolved PeerStore/cache/DHT candidates.
func (*Node) ConnectContactCard ¶
func (*Node) ConnectListedPeer ¶
func (*Node) ContactCard ¶
func (*Node) ContactCardForScopes ¶
func (n *Node) ContactCardForScopes(ctx context.Context, rawPeerID string, scopes contactcard.AddressScopes) (contactcard.Card, contactcard.AddressScopes, error)
func (*Node) DHTFindPeer ¶
DHTFindPeer performs a real DHT lookup with a cache fallback source label.
func (*Node) DeletePublicDraft ¶
func (n *Node) DeletePublicDraft(ctx context.Context, id string, expectedRevision int64) (bool, error)
DeletePublicDraft removes one private draft and its assets.
func (*Node) Disconnect ¶
Disconnect closes all connections to a peer (test-only API).
func (*Node) Download ¶
func (n *Node) Download(ctx context.Context, peerID, remotePath string, progress func(DownloadProgress)) (DownloadResult, error)
func (*Node) DownloadPeerFile ¶
func (n *Node) DownloadPeerFile(ctx context.Context, peerID, path string, progress func(DownloadProgress), options DownloadOptions) (DownloadResult, error)
DownloadPeerFile is the API-facing variant used by Agent tools that may explicitly record acquisition evidence.
func (*Node) DownloadWithOptions ¶
func (n *Node) DownloadWithOptions(ctx context.Context, peerID, remotePath string, progress func(DownloadProgress), options DownloadOptions) (DownloadResult, error)
DownloadWithOptions downloads one manifest file and optionally records the successful acquisition as private discovery evidence. Only Agent tool callers opt in; a manual TUI download, a directory scan or merely listing a manifest does not become a Feed recommendation.
func (*Node) FetchManifest ¶
func (*Node) GetPeerFriends ¶
func (*Node) GetPeerManifest ¶
func (n *Node) GetPeerManifest(ctx context.Context, peerID string, offset, limit int) (PeerManifest, error)
API-facing aliases use explicit Get names.
func (*Node) GetPeerProfile ¶
func (*Node) GetPublicDraft ¶
GetPublicDraft returns one private draft.
func (*Node) GetPublicDraftAsset ¶
func (n *Node) GetPublicDraftAsset(ctx context.Context, draftID, assetID string) (PublicDraftAsset, bool, error)
GetPublicDraftAsset returns one private image/avatar descriptor.
func (*Node) ImportPublicPost ¶
ImportPublicPost opens an existing local post as a private edit draft.
func (*Node) ListConversations ¶
func (n *Node) ListConversations(ctx context.Context, before string, limit int) (ConversationPage, error)
ListConversations returns one summary per Peer from retained messages.
func (*Node) ListDiscoveries ¶
func (n *Node) ListDiscoveries(ctx context.Context, before string, limit int, familiarOnly bool, peerID string, postCandidatesOnly bool) (PublicDiscoveryPage, error)
ListDiscoveries returns the private discovery index page. It is served only on the local API; the remote content protocol does not expose it.
func (*Node) ListDiscoveryRefreshPeers ¶
func (n *Node) ListDiscoveryRefreshPeers(ctx context.Context, familiarOnly bool, limit int, after string) (DiscoveryRefreshPeerPage, error)
ListDiscoveryRefreshPeers returns the bounded local candidate set for an explicit Feed refresh. It reads only local SQLite facts and performs no network request.
func (*Node) ListFavorites ¶
ListFavorites returns private public-post bookmarks and computes availability from retained discovery evidence, the local public snapshot or a verified downloaded copy. A missing target keeps the row with available=false.
func (*Node) ListFriends ¶
ListFriends is the API-facing alias for Friends.
func (*Node) ListHumanOutboundPeers ¶
func (n *Node) ListHumanOutboundPeers(ctx context.Context, before string, limit int) (HumanOutboundPage, error)
ListHumanOutboundPeers returns the durable stage-6 relation page.
func (*Node) ListMessages ¶
func (n *Node) ListMessages(ctx context.Context, peerID, before string, limit int) (MessagePage, error)
ListMessages returns one Peer's retained messages with a stable cursor.
func (*Node) ListOutbox ¶
ListOutbox returns durable outbox entries newest first.
func (*Node) ListPublicDrafts ¶
func (n *Node) ListPublicDrafts(ctx context.Context, kind, before string, limit int) ([]PublicDraft, bool, string, error)
ListPublicDrafts returns a newest-first page of private drafts.
func (*Node) MarkConversationRead ¶
func (n *Node) MarkConversationRead(ctx context.Context, peerID, throughMessageID string) (MarkReadResult, error)
MarkConversationRead advances the human cursor through one retained message. It is the only node path that writes read state; ListMessages and RecentMessages stay read-only.
func (*Node) Outbox ¶
func (n *Node) Outbox(ctx context.Context, limit int) ([]OutboxEntry, OutboxStats, error)
Outbox returns the durable outbox page and accounting in one call for the local API.
func (*Node) OutboxStats ¶
func (n *Node) OutboxStats(ctx context.Context) (OutboxStats, error)
OutboxStats returns bounded outbox accounting.
func (*Node) PausePeer ¶
PausePeer persists a pause, stops local relay/auto-relay work and closes the current connection. It intentionally does not create a friend row.
func (*Node) Peers ¶
func (n *Node) Peers(ctx context.Context) ([]PeerStatus, error)
Peers returns live connections plus cached hints (Online=false).
func (*Node) PreviewContactCard ¶
func (*Node) PublishPublicDraft ¶
func (n *Node) PublishPublicDraft(ctx context.Context, id string, expectedRevision int64, expectedPublishedSHA, requestID string) (PublishResult, error)
PublishPublicDraft atomically commits one draft under the publication lock.
func (*Node) Published ¶
Published forces a fresh local scan and returns what is published, what was skipped and when friends.json was last written. It stays on the local API.
func (*Node) PutPublicDraftImage ¶
func (n *Node) PutPublicDraftImage(ctx context.Context, draftID, role, filename string, data []byte) (PublicDraftAsset, error)
PutPublicDraftImage validates and stores an avatar/image privately.
func (*Node) RecentMessages ¶
RecentMessages returns persisted messages newest first.
func (*Node) RecoverPublication ¶
RecoverPublication runs startup staging cleanup and incomplete-version quarantine before the API serves manifests.
func (*Node) RelayProvider ¶
func (n *Node) RelayProvider() network.RelayProviderStatus
RelayProvider returns the optional relay provider quotas.
func (*Node) RelayReservations ¶
func (n *Node) RelayReservations() []network.RelayReservation
RelayReservations returns real Relay v2 client reservation states.
func (*Node) RemoveBootstrapPeer ¶
RemoveBootstrapPeer removes only the role; history, addresses, contacts, other roles and the pause record are untouched. A missing role is an idempotent no-op.
func (*Node) RemoveFriend ¶
func (n *Node) RemoveFriend(ctx context.Context, peerID string, cancelPending bool) (bool, int, error)
RemoveFriend deletes a friend row; pending outbox requires explicit cancel.
func (*Node) ResumePeer ¶
ResumePeer clears a pause (explicit connect/chat).
func (*Node) SavePublicDraft ¶
func (n *Node) SavePublicDraft(ctx context.Context, in DraftUpdate) (PublicDraft, error)
SavePublicDraft creates or updates a private SQLite draft only.
func (*Node) SendChat ¶
func (n *Node) SendChat(ctx context.Context, peerIDStr, multiaddrStr, text string) (SendResult, error)
SendChat persists an outbound message, sends it and records a matching ACK. It is the legacy internal entry and records unknown provenance; shells use SendChatOrigin with an explicit human/agent origin.
func (*Node) SendChatOrigin ¶
func (n *Node) SendChatOrigin(ctx context.Context, peerIDStr, multiaddrStr, text, origin, requestID string) (SendResult, error)
SendChatOrigin persists an outbound message with local provenance and an optional idempotency key, sends it and records a matching ACK. Transport/ACK failures are returned in SendResult with Acked=false, not as a local RPC error; only invalid input and local persistence errors are errors. A non-empty requestID maps to one deterministic message ID per Peer: replaying it returns the persisted state and never creates or sends a second message.
func (*Node) SetFavorite ¶
func (n *Node) SetFavorite(ctx context.Context, peerID, publicPath, digest, title string, favorite bool) (Favorite, bool, error)
SetFavorite validates one public-post target and idempotently stores or clears its bookmark. It never stores message/contact favorites.
func (*Node) SetFriendDescription ¶
func (n *Node) SetFriendDescription(ctx context.Context, peerID, description string) (Friend, error)
SetFriendDescription replaces a description for an existing friend.
func (*Node) SetFriendName ¶
SetFriendName replaces a name for an existing friend. An empty name clears the local label; non-empty names keep the existing syntax/uniqueness rules in storage. This never changes any remotely published profile.
func (*Node) Start ¶
Start launches the network subsystems, then registers the chat protocol and connection notifiee.
func (*Node) Status ¶
Status returns a point-in-time view. Cached peer hints are listed with Online=false; they are never reported as reachable.
func (*Node) SyncFriends ¶
SyncFriends regenerates public/friends.json immediately.
func (*Node) ViewFriends ¶
func (*Node) ViewProfile ¶
type Options ¶
type Options struct {
DataDir string
Version string
Config config.Config
Identity *identity.Identity
Store *storage.Store
Network *network.Network
Logger *slog.Logger
TestAPI bool
Supervised bool
}
Options constructs a Node. The Node takes ownership of Store and Network and closes them on Stop; the caller keeps ownership of Identity and its lock.
type OutboxEntry ¶
type OutboxEntry struct {
MessageID string
PeerID string
Text string
Multiaddr string
Status string
Attempts int
Bytes int
LastError string
CreatedAt time.Time
ExpiresAt time.Time
NextAttemptAt time.Time
UpdatedAt time.Time
}
OutboxEntry is one durable unacknowledged outbound message.
type OutboxStats ¶
OutboxStats is the bounded outbox accounting view.
type PeerEntry ¶
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type PeerFriend ¶
type PeerFriends ¶
type PeerFriends struct {
PeerID string
Friends []PeerFriend
Limited bool
}
type PeerManifest ¶
type PeerProfile ¶
type PeerStatus ¶
type PeerStatus struct {
PeerID string
Addrs []string
Sources []string
Direction string
Transport string
Route string
RelayPeerID string
Direct bool
Limited bool
Paused bool
Online bool
OpenedAt time.Time
}
PeerStatus is one current connection or cached hint.
type PublicDiscovery ¶
type PublicDiscovery struct {
ID int64
PeerID string
Path string
SHA256 string
SizeBytes int64
FetchedAt time.Time
Source string
Sources []string
}
PublicDiscovery is one successful Agent acquisition from a remote public manifest, with the exact path, hash, time and local acquisition source.
type PublicDiscoveryPage ¶
type PublicDiscoveryPage struct {
Discoveries []PublicDiscovery
NextBefore string
HasMore bool
}
PublicDiscoveryPage is one keyset page of discovery evidence.
type PublicDraft ¶
type PublicDraft = storage.PublicDraft
Public draft views are aliases so the local API does not duplicate storage or publication schemas.
type PublicDraftAsset ¶
type PublicDraftAsset = storage.PublicDraftAsset
Public draft views are aliases so the local API does not duplicate storage or publication schemas.
type PublicProfile ¶
type PublicProfile struct {
AgentName string
AgentDescription string
AgentInterests []string
AgentConversationStyle string
HumanName string
HumanBioMarkdown string
AvatarPath string
AvatarSHA256 string
AvatarMime string
HumanAvatarPath string
HumanAvatarSHA256 string
HumanAvatarMime string
SourcePath string
LegacyFallback bool
Warning string
}
PublicProfile is the structured public profile view returned with GetPeerProfile. The legacy Name/Text fields remain populated separately.
type PublishFile ¶
type PublishFile = publication.PublishFile
Public draft views are aliases so the local API does not duplicate storage or publication schemas.
type PublishResult ¶
type PublishResult = publication.PublishResult
Public draft views are aliases so the local API does not duplicate storage or publication schemas.
type Published ¶
type Published struct {
Files []PublishedFile
Skipped []PublishedSkip
GeneratedAt time.Time
// FriendsSyncedAt is the mtime of friends.json, i.e. when its contents last
// changed, not the last time friends were synced.
FriendsSyncedAt time.Time
}
Published is the local-only /published view. It is never served over the remote content HTTP routes.
type PublishedFile ¶
PublishedFile is one file in the local public manifest.
type PublishedSkip ¶
PublishedSkip is one local path omitted from the public manifest.
type RelayProviderStatus ¶
type RelayProviderStatus = network.RelayProviderStatus
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type RelayReservation ¶
type RelayReservation = network.RelayReservation
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type ResourceStatus ¶
type ResourceStatus = network.ResourceStatus
G2 public type aliases keep the local API dependent on node, not on network internals directly.
type SendResult ¶
type SendResult struct {
MessageID string
Acked bool
AckMessageID string
ACKID string
Route string
Transport string
RelayPeerID string
RemoteMultiaddr string
Reused bool
Source string
Attempts []network.DialAttempt
Note string
Error string
OutboxStatus string
DeliveryStatus string
Replayed bool
RequestID string
}
SendResult is the outcome of one SendChat call. Acked is true only when a matching ACK was received and its ACK state was persisted. DeliveryStatus is the durable history state and outlives the outbox row.
type Status ¶
type Status struct {
PeerID string
NodeID string
ListenAddrs []string
AdvertisedAddrs []string
Version string
ProtocolVersion string
StartedAt time.Time
Peers []PeerStatus
Connections []network.ConnInfo
TestAPI bool
Supervised bool
DataDir string
GoVersion string
Network NetworkStatus
ContentWarnings []string
MaxChatTextBytes int
MaxStoredMessages int
}
Status is a point-in-time view of the running node.
type StoredMessage ¶
type StoredMessage struct {
MessageID string
PeerID string
Direction string
Text string
Acked bool
CreatedAt time.Time
AckedAt time.Time
Origin string
DeliveryStatus string
DeliveryError string
DeliveryUpdatedAt time.Time
ClientRequestID string
}
StoredMessage is a persisted message view.