p2p

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: AGPL-3.0 Imports: 72 Imported by: 1 module, 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

Index

Constants

View Source
const (
	DirextalkRoomTypeDirect  = productpolicy.DirextalkRoomTypeDirect
	DirextalkRoomTypeGroup   = productpolicy.DirextalkRoomTypeGroup
	DirextalkRoomTypeChannel = productpolicy.DirextalkRoomTypeChannel
	DirextalkRoomTypeSystem  = "io.dirextalk.room.system"

	DirextalkRoomProfileEventType  = productpolicy.DirextalkRoomProfileEventType
	DirextalkMemberPolicyEventType = productpolicy.DirextalkMemberPolicyEventType
	DirextalkJoinRequestEventType  = productpolicy.DirextalkJoinRequestEventType

	DirextalkAgentStatusEventType = "io.dirextalk.agent.status"
	AgentGatewayContentKey        = "io.dirextalk.agent_gateway"
	AgentGatewaySourceContentKey  = "io.dirextalk.gateway_source"
)
View Source
const PathPrefix = "/_p2p/"

Variables

This section is empty.

Functions

func Register

func Register(router *mux.Router, service *Service)

func RegisterMCP

func RegisterMCP(router *mux.Router, service *Service)

func RegisterWellKnown

func RegisterWellKnown(router *mux.Router, service *Service)

Types

type AccountDeactivator

type AccountDeactivator interface {
	DeactivateAccount(ctx context.Context, localpart string) error
}

type AccountDeprovisioner

type AccountDeprovisioner interface {
	DeprovisionAccount(ctx context.Context) error
}

type CompositeMatrixHistoryReader

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

func NewCompositeMatrixHistoryReader

func NewCompositeMatrixHistoryReader(messages MatrixHistoryReader, channelContent MatrixChannelContentReader) *CompositeMatrixHistoryReader

func (*CompositeMatrixHistoryReader) ListChannelContent

func (r *CompositeMatrixHistoryReader) ListChannelContent(ctx context.Context, roomID string, limit int) ([]matrixhistory.Event, error)

func (*CompositeMatrixHistoryReader) ListOrdinaryMessages

type Config

type Config struct {
	ServerName string
	Homeserver string
	// AccountGeneration is the immutable deployment generation shared with
	// Agent and Product Capability mTLS metadata. A deleted/recreated account
	// stack must boot with a new value so stale grants cannot cross the fence.
	AccountGeneration               int64
	RemoteNodeInsecureSkipTLSVerify bool
	RemoteNodeAllowPrivateBaseURLs  bool
	P2PEventRetentionMaxRows        int64
	P2PEventRetentionPruneOnWrite   bool
	PushRules                       PushRuleManager
	RealtimeSessions                *realtime.SessionStore
	PluginRunner                    PluginRunner
	NativeAgentRunner               NativeAgentRunner
	NativeAgentGateway              *agentgateway.Client
	// NativeAgentVoiceCallbackURL is the HTTPS base URL of the private Agent
	// callback listener.  In external Native Agent mode public voice callback
	// paths are relayed here; they never fall back to a local voice runtime.
	NativeAgentVoiceCallbackURL            string
	NativeAgentVoiceCallbackAuthToken      string
	NativeAgentVoiceCallbackCAFile         string
	NativeAgentVoiceCallbackClientCertFile string
	NativeAgentVoiceCallbackClientKeyFile  string
	NativeAgentVoiceCallbackServerName     string
	NativeAgentVoiceCallbackHTTPClient     *http.Client
	NativeAgentVoiceCallbackMaxBodyBytes   int64
	NativeAgentVoiceCallbackTimeout        time.Duration
	// NativeAgentGrantPrivateKey is held only by message-server, which signs
	// capability grants before forwarding Agent operations. Product and Agent
	// receive the public verification key only.
	NativeAgentGrantPrivateKey []byte
	// NativeAgentRequiredActions extends the fail-closed external catalog
	// baseline. Deployments use it to opt in optional voice/AWS/execution
	// capabilities without making disabled features poison readiness.
	NativeAgentRequiredActions []string
	// NativeAgentCatalogProbe is a test/deployment seam for a bounded catalog
	// probe when the concrete gateway client is supplied elsewhere. Production
	// normally leaves it nil and uses NativeAgentRunner's ProbeCatalog method.
	NativeAgentCatalogProbe   func(context.Context, []agentgateway.CatalogRequirement) error
	ReleaseController         releasecontrol.Controller
	CentralVersionSource      releasecontrol.CentralVersionSource
	CentralAgentVersionSource releasecontrol.CentralAgentVersionSource
	// AllowAccountDeleteWithoutUpdater is an explicit standalone deployment
	// opt-in. Production deployments with an updater keep the fail-closed
	// watchdog; isolated local stacks rely on the durable Agent/message-server
	// deprovision fences instead of a Unix updater sidecar.
	AllowAccountDeleteWithoutUpdater bool
}

type DatabaseStore

type DatabaseStore = p2pstorage.DatabaseStore

func NewDatabaseStore

func NewDatabaseStore(ctx context.Context, cm *sqlutil.Connections, dbProperties *config.DatabaseOptions) (*DatabaseStore, error)

func NewUnmigratedDatabaseStore

func NewUnmigratedDatabaseStore(db *sql.DB, writer sqlutil.Writer) *DatabaseStore

type DendriteMatrixSessionIssuer

type DendriteMatrixSessionIssuer = dirextalksession.Issuer

func NewDendriteAccountDeactivator

func NewDendriteAccountDeactivator(userAPI userapi.UserInternalAPI, serverName spec.ServerName) *DendriteMatrixSessionIssuer

func NewDendriteMatrixSessionIssuer

func NewDendriteMatrixSessionIssuer(userAPI userapi.UserInternalAPI, serverName spec.ServerName) *DendriteMatrixSessionIssuer

type DendriteTransport

type DendriteTransport = dendrite.DendriteTransport

type HTTPMatrixHistoryReader

type HTTPMatrixHistoryReader = matrixhistory.HTTPMessageReader

func NewHTTPMatrixHistoryReader

func NewHTTPMatrixHistoryReader(baseURL string, token func(context.Context) (string, error), client *http.Client) *HTTPMatrixHistoryReader

type HTTPMatrixProfileResolver

type HTTPMatrixProfileResolver = dirextalkmatrix.HTTPProfileResolver

func NewHTTPMatrixProfileResolver

func NewHTTPMatrixProfileResolver(baseURL string, client *http.Client) *HTTPMatrixProfileResolver

type JoinRoomResult

type JoinRoomResult = dirextalktransport.JoinRoomResult

type MatrixChannelContentReader

type MatrixChannelContentReader interface {
	ListChannelContent(ctx context.Context, roomID string, limit int) ([]matrixhistory.Event, error)
}

type MatrixHistoryReader

type MatrixHistoryReader interface {
	ListOrdinaryMessages(ctx context.Context, roomID string, page matrixhistory.Page) (matrixhistory.MessagePageResult, error)
}

type MatrixProfileUpdater

type MatrixProfileUpdater interface {
	UpdateMatrixProfile(ctx context.Context, userID, displayName, avatarURL string) error
}

type MatrixSessionIssuer

type MatrixSessionIssuer interface {
	EnsureMatrixSession(ctx context.Context, userID, displayName, avatarURL, deviceID string, revokeExistingDevices bool) (string, error)
}

type NativeAgentRunner

type NativeAgentRunner interface {
	Apply(context.Context, string) error
	Invoke(context.Context, string, map[string]any) (map[string]any, error)
	Stream(context.Context, string, map[string]any, func(agentstream.Event) error) error
}

NativeAgentRunner is the external Native Agent capability boundary.

type OutputRoomEventConsumer

type OutputRoomEventConsumer = projectormodule.OutputRoomEventConsumer

func NewOutputRoomEventConsumer

func NewOutputRoomEventConsumer(process *process.ProcessContext, cfg *config.JetStream, js nats.JetStreamContext, service *Service) *OutputRoomEventConsumer

type PluginInvokeRequest

type PluginInvokeRequest = pluginsmodule.InvokeRequest

type PluginRunner

type PluginRunner = pluginsmodule.Runner

Public aliases preserve Config.PluginRunner and custom runner integrations.

type PluginRunnerOperation

type PluginRunnerOperation = pluginsmodule.RunnerOperation

type PluginStreamEvent

type PluginStreamEvent = pluginsmodule.StreamEvent

type PushRuleManager

type PushRuleManager interface {
	QueryPushRules(ctx context.Context, userID string) (*pushrules.AccountRuleSets, error)
	PerformPushRulesPut(ctx context.Context, userID string, ruleSets *pushrules.AccountRuleSets) error
}

type RoomChannel

type RoomChannel = dirextalktransport.RoomChannel

type RoomCreatorReader added in v1.0.6

type RoomCreatorReader = dirextalktransport.RoomCreatorReader

type RoomMember

type RoomMember = dirextalktransport.RoomMember

type RoomStateEvent

type RoomStateEvent = dirextalktransport.RoomStateEvent

type Service

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

func NewService

func NewService(cfg Config) *Service

func NewServiceWithStore

func NewServiceWithStore(ctx context.Context, cfg Config, store Store) (*Service, error)

func NewServiceWithStoreAndTransport

func NewServiceWithStoreAndTransport(ctx context.Context, cfg Config, store Store, transport Transport) (*Service, error)

func NewServiceWithTransport

func NewServiceWithTransport(cfg Config, transport Transport) *Service

func (*Service) AccessToken

func (s *Service) AccessToken() string

func (*Service) AgentToken

func (s *Service) AgentToken() string

func (*Service) Authenticate

func (s *Service) Authenticate(token string) bool

func (*Service) Authorize

func (s *Service) Authorize(token, action string) bool

func (*Service) BlockedDirectMessage added in v1.0.9

func (s *Service) BlockedDirectMessage(ctx context.Context, roomID, peerMXID string) (bool, error)

BlockedDirectMessage checks the owner's exact contact-and-room block pair.

func (*Service) DurableMatrixMutationReady added in v1.1.3

func (s *Service) DurableMatrixMutationReady() bool

func (*Service) Handle

func (s *Service) Handle(ctx context.Context, action string, params map[string]any) (any, *apiError)

func (*Service) InvokeProductCapability added in v1.1.3

func (s *Service) InvokeProductCapability(ctx context.Context, action string, params map[string]any) (any, error)

InvokeProductCapability is the single ProductCapability SPI used by the external Native Agent gateway. It delegates to the existing ProductCore / Matrix MCP modules, so capability additions do not create another HTTP action or a second persistence model.

func (*Service) MatrixHistoryAccessToken

func (s *Service) MatrixHistoryAccessToken(ctx context.Context) (string, error)

MatrixHistoryAccessToken remains the public setup callback for the existing owner Matrix history reader.

func (*Service) OwnerMXID

func (s *Service) OwnerMXID() string

func (*Service) PreparedMatrixMutationStore added in v1.1.3

func (s *Service) PreparedMatrixMutationStore() dirextalktransport.PreparedMatrixMutationStore

func (*Service) ProductCapabilityDatabase added in v1.1.3

func (s *Service) ProductCapabilityDatabase() *sql.DB

ProductCapabilityDatabase exposes the already-migrated shared PostgreSQL handle for durable capability operation records. It is intentionally narrow: capability handlers still use ProductCore/Matrix ports, not this database.

func (*Service) ProjectOutputEvent

func (s *Service) ProjectOutputEvent(ctx context.Context, output roomserverAPI.OutputEvent) error

func (*Service) ProjectRoomEvent

func (s *Service) ProjectRoomEvent(ctx context.Context, event *types.HeaderedEvent) error

func (*Service) SetAccountDeactivator

func (s *Service) SetAccountDeactivator(deactivator AccountDeactivator)

func (*Service) SetAccountDeprovisioner

func (s *Service) SetAccountDeprovisioner(deprovisioner AccountDeprovisioner)

func (*Service) SetMatrixMessageReader

func (s *Service) SetMatrixMessageReader(reader matrixMessageReader)

func (*Service) SetMatrixProfileResolver

func (s *Service) SetMatrixProfileResolver(resolver matrixProfileResolver)

func (*Service) SetMatrixSessionIssuer

func (s *Service) SetMatrixSessionIssuer(issuer MatrixSessionIssuer)

func (*Service) SetProjectorStarted

func (s *Service) SetProjectorStarted(started bool)

func (*Service) SetPushRuleManager

func (s *Service) SetPushRuleManager(manager PushRuleManager)

func (*Service) SetReadMarkerPositionResolver added in v1.0.4

func (s *Service) SetReadMarkerPositionResolver(resolver readMarkerPositionResolver)

func (*Service) StopNativeAgentCatalogProbe added in v1.1.3

func (s *Service) StopNativeAgentCatalogProbe()

StopNativeAgentCatalogProbe is registered with the process shutdown path in production and is harmless for tests or embedded mode.

type Store

type Store interface {
	operationsmodule.Store

	channelsmodule.ContentStore

	pluginsmodule.Store
	reportsmodule.Store
	// contains filtered or unexported methods
}

type Transport

type Transport = dirextalktransport.Transport

Directories

Path Synopsis
internal
action
Package action owns the shared ProductCore action boundary primitives.
Package action owns the shared ProductCore action boundary primitives.
agent
Package agent owns the narrow account projection shared by the external Native Agent gateway and the Matrix-backed Online Agent.
Package agent owns the narrow account projection shared by the external Native Agent gateway and the Matrix-backed Online Agent.
blocks
Package blocks owns ProductCore contact-block actions and block lookups.
Package blocks owns ProductCore contact-block actions and block lookups.
calls
Package calls owns ProductCore call-session actions and lifecycle projection.
Package calls owns ProductCore call-session actions and lifecycle projection.
channels
Package channels owns ProductCore channel CRUD, listing, lifecycle, and member-count persistence orchestration.
Package channels owns ProductCore channel CRUD, listing, lifecycle, and member-count persistence orchestration.
contacts
Package contacts owns contact reads and durable contact-save orchestration.
Package contacts owns contact reads and durable contact-save orchestration.
conversation
Package conversation owns ProductCore conversation actions and read-model presentation.
Package conversation owns ProductCore conversation actions and read-model presentation.
events
Package events owns the durable ProductCore event stream, sequence allocation, retention, cursor validation, and live waiter notification.
Package events owns the durable ProductCore event stream, sequence allocation, retention, cursor validation, and live waiter notification.
groups
Package groups owns ProductCore group CRUD, listing, lifecycle, and policy actions.
Package groups owns ProductCore group CRUD, listing, lifecycle, and policy actions.
httpapi
Package httpapi owns the ProductCore and MCP HTTP protocol adapters.
Package httpapi owns the ProductCore and MCP HTTP protocol adapters.
mcp
Package mcp adapts Dirextalk product state and Matrix transport to the shared internal/dirextalkmcp capability service.
Package mcp adapts Dirextalk product state and Matrix transport to the shared internal/dirextalkmcp capability service.
members
Package members owns shared ProductCore group and channel member reads and lifecycle and policy mutations.
Package members owns shared ProductCore group and channel member reads and lifecycle and policy mutations.
operations
Package operations defines durable records for recoverable ProductCore operations.
Package operations defines durable records for recoverable ProductCore operations.
plugins
Package plugins owns the non-Agent plugin ProductCore actions, persistence orchestration, invocation validation, and Docker runner boundary.
Package plugins owns the non-Agent plugin ProductCore actions, persistence orchestration, invocation validation, and Docker runner boundary.
portal
Package portal owns portal authentication, session rotation, password, and runtime-status ProductCore workflows.
Package portal owns portal authentication, session rotation, password, and runtime-status ProductCore workflows.
profile
Package profile owns the owner profile ProductCore workflow and public well-known projection.
Package profile owns the owner profile ProductCore workflow and public well-known projection.
projector
Package projector owns roomserver output consumption and projection dispatch.
Package projector owns roomserver output consumption and projection dispatch.
realtimews
Package realtimews owns the ProductCore realtime WebSocket transport.
Package realtimews owns the ProductCore realtime WebSocket transport.
registryjson
Package registryjson contains strict JSON primitives for built-in registries.
Package registryjson contains strict JSON primitives for built-in registries.
release
Package release owns the ProductCore release status, apply, and client-build reporting workflows.
Package release owns the ProductCore release status, apply, and client-build reporting workflows.
reports
Package reports owns report submission, durable report creation, and the related Matrix system-notification projection.
Package reports owns report submission, durable report creation, and the related Matrix system-notification projection.
social
Package social owns ProductCore favorite and follow actions.
Package social owns ProductCore favorite and follow actions.

Jump to

Keyboard shortcuts

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