client

package
v0.1.0-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 17 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package client is a Connect-RPC client for the local Raminga API. It is used by the CLI and e2e runner; it never opens go-libp2p directly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDaemonNotRunning

func IsDaemonNotRunning(err error) bool

IsDaemonNotRunning reports whether err is the actionable local-daemon error.

Types

type Client

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

Client talks to one local daemon over its UDS.

func New

func New(dataDir string) (*Client, error)

New opens the explicitly selected local API transport. The protected TCP discovery file is authoritative when present; there is no automatic fallback to the Unix socket if it is stale or unreachable. When RAMINGA_API_TCP is set, a missing TCP endpoint is an error rather than a UDS fallback.

func (*Client) AddBootstrapCard

func (c *Client) AddBootstrapCard(ctx context.Context, shareCode string) (*apiv1.AddBootstrapPeerResponse, error)

AddBootstrapCard saves the addresses in a contact card as a bootstrap role.

func (*Client) AddBootstrapPeer

func (c *Client) AddBootstrapPeer(ctx context.Context, multiaddr string) (*apiv1.AddBootstrapPeerResponse, error)

AddBootstrapPeer calls AddBootstrapPeer.

func (*Client) Close

func (c *Client) Close()

Close closes idle UDS connections.

func (*Client) Connect

func (c *Client) Connect(ctx context.Context, peerID, multiaddr string) (*apiv1.ConnectResponse, error)

Connect calls Connect. At least one of peerID and multiaddr must be set.

func (*Client) ConnectContactCard

func (c *Client) ConnectContactCard(ctx context.Context, code string, summaryOnly bool) (*apiv1.ConnectResponse, error)

func (*Client) ConnectListedPeer

func (c *Client) ConnectListedPeer(ctx context.Context, peerID string, addrs []string) (*apiv1.ConnectListedPeerResponse, error)

func (*Client) ContactCard

func (c *Client) ContactCard(ctx context.Context, peerID string, includeAddresses bool) (*apiv1.GetContactCardResponse, error)

func (*Client) ContactCardForScopes

func (c *Client) ContactCardForScopes(ctx context.Context, peerID string, addressScopes uint32) (*apiv1.GetContactCardResponse, error)

func (*Client) DhtAddPeer

func (c *Client) DhtAddPeer(ctx context.Context, multiaddr string) (*apiv1.DhtAddPeerResponse, error)

DhtAddPeer calls DhtAddPeer.

func (*Client) DhtFindPeer

func (c *Client) DhtFindPeer(ctx context.Context, peerID string) (*apiv1.DhtFindPeerResponse, error)

DhtFindPeer calls DhtFindPeer.

func (*Client) DhtStatus

func (c *Client) DhtStatus(ctx context.Context) (*apiv1.DhtStatusResponse, error)

DhtStatus calls DhtStatus.

func (*Client) DisconnectPeer

func (c *Client) DisconnectPeer(ctx context.Context, peerID string) (*apiv1.DisconnectPeerResponse, error)

DisconnectPeer closes all connections to a peer through the normal API.

func (*Client) DownloadPeerFile

func (c *Client) DownloadPeerFile(ctx context.Context, peerID, path string) (*connect.ServerStreamForClient[apiv1.DownloadPeerFileResponse], error)

func (*Client) DownloadPeerFileWithEvidence

func (c *Client) DownloadPeerFileWithEvidence(ctx context.Context, peerID, path, source string) (*connect.ServerStreamForClient[apiv1.DownloadPeerFileResponse], error)

DownloadPeerFileWithEvidence is used only by the Agent content tool. It asks the daemon to persist the successful acquisition as discovery evidence.

func (*Client) Events

Events opens the server-streaming Events call.

func (*Client) GetPeerFriends

func (c *Client) GetPeerFriends(ctx context.Context, peerID string) (*apiv1.GetPeerFriendsResponse, error)

func (*Client) GetPeerManifest

func (c *Client) GetPeerManifest(ctx context.Context, peerID string, offset, limit int32) (*apiv1.GetPeerManifestResponse, error)

func (*Client) GetPeerProfile

func (c *Client) GetPeerProfile(ctx context.Context, peerID string) (*apiv1.GetPeerProfileResponse, error)

func (*Client) ListBootstrapPeers

func (c *Client) ListBootstrapPeers(ctx context.Context) (*apiv1.ListBootstrapPeersResponse, error)

ListBootstrapPeers calls ListBootstrapPeers.

func (*Client) ListConversations

func (c *Client) ListConversations(ctx context.Context, before string, limit uint32) (*apiv1.ListConversationsResponse, error)

ListConversations calls the per-Peer summary query.

func (*Client) ListDiscoveries

func (c *Client) ListDiscoveries(ctx context.Context, before string, limit int32, familiarOnly bool) (*apiv1.ListDiscoveriesResponse, error)

ListDiscoveries reads the private acquisition index with its opaque cursor.

func (*Client) ListDiscoveriesForPeer

func (c *Client) ListDiscoveriesForPeer(ctx context.Context, before string, limit int32, familiarOnly bool, peerID string) (*apiv1.ListDiscoveriesResponse, error)

ListDiscoveriesForPeer narrows the acquisition index to one author. An empty peerID preserves the unfiltered behavior used by older callers.

func (*Client) ListDiscoveryRefreshPeers

func (c *Client) ListDiscoveryRefreshPeers(ctx context.Context, familiarOnly bool, limit int32, after string) (*apiv1.ListDiscoveryRefreshPeersResponse, error)

ListDiscoveryRefreshPeers reads the bounded local candidate set for an explicit Feed refresh. It is a local read; it never dials a peer.

func (*Client) ListFavorites

func (c *Client) ListFavorites(ctx context.Context, before string, limit int32) (*apiv1.ListFavoritesResponse, error)

ListFavorites reads private public-post bookmarks with a stable cursor.

func (*Client) ListFriends

func (c *Client) ListFriends(ctx context.Context) (*apiv1.ListFriendsResponse, error)

ListFriends lists local friend rows.

func (*Client) ListHumanOutboundPeers

func (c *Client) ListHumanOutboundPeers(ctx context.Context, before string, limit uint32) (*apiv1.ListHumanOutboundPeersResponse, error)

ListHumanOutboundPeers calls the durable stage-6 relation query.

func (*Client) ListMessages

func (c *Client) ListMessages(ctx context.Context, peerID, before string, limit uint32) (*apiv1.ListMessagesResponse, error)

ListMessages calls the stable per-Peer message query.

func (*Client) ListPostCandidateDiscoveries

func (c *Client) ListPostCandidateDiscoveries(ctx context.Context, before string, limit int32, familiarOnly bool, peerID string) (*apiv1.ListDiscoveriesResponse, error)

ListPostCandidateDiscoveries asks the daemon to apply its versioned-post path prefilter before the keyset LIMIT. It is additive: ListDiscoveries keeps the legacy mixed-file contract for old callers.

func (*Client) MarkConversationRead

func (c *Client) MarkConversationRead(ctx context.Context, peerID, throughMessageID string) (*apiv1.MarkConversationReadResponse, error)

MarkConversationRead advances the human cursor through one retained message.

func (*Client) OutboxCancel

func (c *Client) OutboxCancel(ctx context.Context, messageID string) (*apiv1.OutboxCancelResponse, error)

OutboxCancel cancels one pending outbox entry.

func (*Client) OutboxList

func (c *Client) OutboxList(ctx context.Context, limit uint32) (*apiv1.OutboxListResponse, error)

OutboxList lists durable unacknowledged outbound messages.

func (*Client) Peers

func (c *Client) Peers(ctx context.Context, includeCached bool) (*apiv1.PeersResponse, error)

Peers calls Peers.

func (*Client) Published

func (c *Client) Published(ctx context.Context) (*apiv1.PublishedResponse, error)

Published lists the local public manifest after a forced scan.

func (*Client) RecentMessages

func (c *Client) RecentMessages(ctx context.Context, limit uint32) (*apiv1.RecentMessagesResponse, error)

RecentMessages calls RecentMessages.

func (*Client) RelayStatus

func (c *Client) RelayStatus(ctx context.Context) (*apiv1.RelayStatusResponse, error)

RelayStatus calls RelayStatus.

func (*Client) RemoveBootstrapPeer

func (c *Client) RemoveBootstrapPeer(ctx context.Context, peerID string) (*apiv1.RemoveBootstrapPeerResponse, error)

RemoveBootstrapPeer calls RemoveBootstrapPeer.

func (*Client) RemoveFriend

func (c *Client) RemoveFriend(ctx context.Context, peerID string, cancelPending bool) (*apiv1.RemoveFriendResponse, error)

RemoveFriend deletes a friend row; pending outbox requires cancelPending.

func (*Client) SendChat

func (c *Client) SendChat(ctx context.Context, peerID, multiaddr, text string) (*apiv1.SendChatResponse, error)

SendChat calls SendChat for a human-initiated TUI/CLI send. It deliberately leaves agent_origin unset, so daemon-side agent safety checks do not apply.

func (*Client) SendChatFromAgent

func (c *Client) SendChatFromAgent(ctx context.Context, peerID, multiaddr, text string) (*apiv1.SendChatResponse, error)

SendChatFromAgent calls SendChat with agent_origin set. Every Agent shell must use this method (or set the field directly), so the daemon can reject private-data leaks and excessive automated sends.

func (*Client) SetFavorite

func (c *Client) SetFavorite(ctx context.Context, peerID, publicPath, sha256, title string, favorite bool) (*apiv1.SetFavoriteResponse, error)

SetFavorite idempotently adds or removes one public-post bookmark.

func (*Client) SetFriendDescription

func (c *Client) SetFriendDescription(ctx context.Context, peerID, description string) (*apiv1.SetFriendDescriptionResponse, error)

SetFriendDescription replaces one existing friend's description. The value is always sent explicitly, so an empty string is distinguishable from omission.

func (*Client) SetFriendName

func (c *Client) SetFriendName(ctx context.Context, peerID, name string) (*apiv1.SetFriendNameResponse, error)

SetFriendName replaces one existing friend's local name. The value is always sent explicitly, so an empty string is distinguishable from an omitted edit.

func (*Client) Shutdown

func (c *Client) Shutdown(ctx context.Context) (*apiv1.ShutdownResponse, error)

Shutdown asks the daemon to stop gracefully.

func (*Client) Status

func (c *Client) Status(ctx context.Context) (*apiv1.StatusResponse, error)

Status calls Status.

func (*Client) SyncFriends

func (c *Client) SyncFriends(ctx context.Context) (*apiv1.SyncFriendsResponse, error)

SyncFriends regenerates public/friends.json immediately.

func (*Client) TestDisconnectPeer

func (c *Client) TestDisconnectPeer(ctx context.Context, peerID string) (*apiv1.TestDisconnectPeerResponse, error)

TestDisconnectPeer calls the test-only disconnect RPC.

func (*Client) TestPing

func (c *Client) TestPing(ctx context.Context, echo string) (*apiv1.TestPingResponse, error)

TestPing calls the test-only TestPing RPC.

type DaemonNotRunningError

type DaemonNotRunningError struct {
	DataDir string
	Err     error
}

DaemonNotRunningError adds the actionable "start the daemon" hint while preserving the original dial/token error through Unwrap.

func (*DaemonNotRunningError) Error

func (e *DaemonNotRunningError) Error() string

func (*DaemonNotRunningError) Unwrap

func (e *DaemonNotRunningError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL