Documentation
¶
Index ¶
- Constants
- Variables
- func CheckHost(hostProtocol *uint16, hostVersion *string) error
- func NetworkRelayURLs(_ context.Context, selection protocol.NetworkSelection) ([]string, error)
- func ProbeRelay(ctx context.Context, address string) (time.Duration, error)
- func RelayInputAddress(value string) string
- func ResolveNetworkSelection(ctx context.Context, selection protocol.NetworkSelection, ...) (protocol.NetworkSelection, error)
- func StreamPair() (Stream, Stream)
- func ValidHostRemovalState(state string) bool
- type Admission
- type ConnectionInfo
- type EndpointAddress
- type EndpointOptions
- type FaultError
- type Handler
- type HostRemovalAttempt
- type HostRemovalNotice
- type HostRemovalStore
- type Identity
- type Invitation
- func (invitation *Invitation) Close() error
- func (invitation *Invitation) ExpiresAtMS() uint64
- func (*Invitation) GoString() string
- func (invitation *Invitation) IsPaired() bool
- func (invitation *Invitation) Paired(ctx context.Context) error
- func (*Invitation) String() string
- func (invitation *Invitation) Ticket() string
- type InvitationScope
- type Link
- func (link *Link) Address(ctx context.Context) (EndpointAddress, error)
- func (link *Link) ApplyDirectory(ctx context.Context, directory protocol.HostDirectory) error
- func (link *Link) Close() error
- func (link *Link) Direction(peer protocol.NodeID) PeerDirection
- func (link *Link) Disconnect(peer protocol.NodeID)
- func (link *Link) HostRemovals(ctx context.Context) ([]HostRemovalAttempt, error)
- func (link *Link) Inspect(ctx context.Context, address EndpointAddress) (PeerInfo, error)
- func (link *Link) Invite(ctx context.Context) (*Invitation, error)
- func (link *Link) InviteFor(ctx context.Context, scope InvitationScope) (*Invitation, error)
- func (link *Link) MyDevice(ctx context.Context, peer protocol.NodeID) (bool, error)
- func (link *Link) Name() string
- func (link *Link) NarrowLegacyController(ctx context.Context, peer protocol.NodeID) error
- func (link *Link) NetworkChanged(ctx context.Context) error
- func (link *Link) NetworkSelection() *protocol.NetworkSelection
- func (link *Link) Online(ctx context.Context) error
- func (link *Link) Pair(ctx context.Context, encoded string) (EndpointAddress, error)
- func (link *Link) PairPIN(ctx context.Context, origin, pin string, claim *PairingClaim) (EndpointAddress, error)
- func (link *Link) PairPINOnNetwork(ctx context.Context, origin, pin string, selection protocol.NetworkSelection, ...) (EndpointAddress, error)
- func (link *Link) PeerDirections(ctx context.Context) ([]PeerTrust, error)
- func (link *Link) Peers(ctx context.Context) ([]EndpointAddress, error)
- func (link *Link) PrepareHostRemoval(ctx context.Context, host protocol.NodeID) (HostRemovalAttempt, error)
- func (link *Link) PrepareHostRemovalNotice(ctx context.Context, host protocol.NodeID) (HostRemovalAttempt, *HostRemovalNotice, error)
- func (link *Link) RecordHostRemoval(ctx context.Context, host protocol.NodeID, request protocol.RequestID, ...) error
- func (link *Link) RefreshPeers(ctx context.Context) error
- func (link *Link) Relationships(ctx context.Context) ([]PeerRelationship, error)
- func (link *Link) RememberPeerName(ctx context.Context, peer protocol.NodeID, name string) error
- func (link *Link) Remote(address EndpointAddress) *Remote
- func (link *Link) SelectNetwork(ctx context.Context, selection protocol.NetworkSelection) error
- func (link *Link) SetDirection(ctx context.Context, peer protocol.NodeID, direction PeerDirection) error
- func (link *Link) SetName(name string) error
- func (link *Link) SetTrust(ctx context.Context, peer protocol.NodeID, trusted bool) error
- func (link *Link) Share(ctx context.Context, origin string) (*ShareSession, error)
- func (link *Link) ShareFor(ctx context.Context, origin string, scope InvitationScope) (*ShareSession, error)
- func (link *Link) UpdatePeer(ctx context.Context, address EndpointAddress) error
- func (link *Link) Via(entry EndpointAddress, target protocol.NodeID) *Remote
- func (link *Link) WatchPeers(ctx context.Context, callback func()) error
- type Local
- func (local *Local) Dispatch(ctx context.Context, request protocol.Request) (Admission, error)
- func (local *Local) ForTarget(target protocol.NodeID) Transport
- func (local *Local) LocalResource(ctx context.Context, call protocol.ResourceCall) (Admission, error)
- func (local *Local) Open(ctx context.Context, id protocol.StreamID) (Stream, error)
- func (local *Local) ScopedKnowledge(ctx context.Context, call protocol.ScopedKnowledgeCall) (Admission, error)
- func (local *Local) Subscribe(ctx context.Context, topic protocol.Topic) (Subscription, error)
- func (local *Local) Target() protocol.NodeID
- func (local *Local) WatchConnection(ctx context.Context, changed func(ConnectionInfo)) error
- type MembershipStore
- type NetworkScope
- type PairingClaim
- type PeerDirection
- type PeerIdentityStore
- type PeerInfo
- type PeerNameStore
- type PeerRelationship
- type PeerStore
- type PeerTrust
- type Remote
- func (remote *Remote) Dispatch(ctx context.Context, request protocol.Request) (Admission, error)
- func (remote *Remote) ForTarget(target protocol.NodeID) Transport
- func (remote *Remote) Open(ctx context.Context, resource protocol.StreamID) (Stream, error)
- func (remote *Remote) Resource(ctx context.Context, call protocol.ResourceCall) (Admission, error)
- func (remote *Remote) Route() protocol.RouteKey
- func (remote *Remote) ScopedKnowledge(ctx context.Context, call protocol.ScopedKnowledgeCall) (Admission, error)
- func (remote *Remote) Subscribe(ctx context.Context, topic protocol.Topic) (Subscription, error)
- func (remote *Remote) Target() protocol.NodeID
- func (remote *Remote) WatchConnection(ctx context.Context, callback func(ConnectionInfo)) error
- type ResourceHandler
- type Response
- type Route
- type ScopedKnowledgeHandler
- type ShareSession
- type ShareState
- type Stream
- type Subscription
- type Transport
Constants ¶
const DefaultPairingService = "https://sailry.link.dux.plus"
Variables ¶
var ProductVersion = identity.OfficialVersion
Functions ¶
func NetworkRelayURLs ¶
NetworkRelayURLs retains its historical name; active relay selections use Libp2p multiaddrs. Direct returns a non-nil empty list.
func ProbeRelay ¶ added in v0.2.5
func RelayInputAddress ¶ added in v0.2.5
RelayInputAddress formats a pinned relay for editing without changing the address used by the transport. Unresolved input stays editable as entered.
func ResolveNetworkSelection ¶ added in v0.2.5
func ResolveNetworkSelection(ctx context.Context, selection protocol.NetworkSelection, presets []protocol.NetworkPreset) (protocol.NetworkSelection, error)
ResolveNetworkSelection resolves user input before a selection is applied or persisted. Stored selections and transport addresses never depend on DNSADDR to recover the relay's identity.
func StreamPair ¶
StreamPair supplies the same independently closable read/write directions as a remote bidirectional stream. Standard pipes apply backpressure to each side.
func ValidHostRemovalState ¶
Types ¶
type ConnectionInfo ¶
type EndpointAddress ¶
type EndpointAddress = peertransport.Address
func CandidateAddress ¶
func CandidateAddress(address EndpointAddress, selection protocol.NetworkSelection) (EndpointAddress, error)
type EndpointOptions ¶
type FaultError ¶
FaultError carries a protocol fault through an ordinary Go error boundary.
func (*FaultError) Error ¶
func (err *FaultError) Error() string
func (*FaultError) Unwrap ¶
func (err *FaultError) Unwrap() error
type Handler ¶
type Handler interface {
Open(context.Context, protocol.NodeID, protocol.StreamID) (Stream, error)
Dispatch(context.Context, protocol.NodeID, protocol.Request) (Admission, error)
Subscribe(context.Context, protocol.NodeID, protocol.Topic) (Subscription, error)
}
Handler is implemented by the execution Node, which owns the request ledger.
type HostRemovalAttempt ¶
type HostRemovalAttempt struct {
Request protocol.Request `json:"request"`
State string `json:"state"`
Fault *protocol.Fault `json:"fault,omitempty"`
Active bool `json:"active"`
}
HostRemovalAttempt retains the exact remote self-revocation request even after local trust is removed. It is diagnostic history, never a retry worker.
type HostRemovalNotice ¶
type HostRemovalNotice struct {
// contains filtered or unexported fields
}
HostRemovalNotice owns one already authenticated connection after local trust is removed. It can only notify the saved self-revocation or inspect its ID. It never reconnects, and belongs to the Link rather than the caller's view.
func (*HostRemovalNotice) Close ¶
func (notice *HostRemovalNotice) Close()
Close abandons an unstarted reservation after a failed local save, or releases the detached connection after notification, re-pairing or Link shutdown.
func (*HostRemovalNotice) Start ¶
func (notice *HostRemovalNotice) Start() error
Start follows successful local removal. Its ten-second budget includes queue time, stream admission and completion; no request survives for a later retry.
type HostRemovalStore ¶
type Identity ¶
type Identity struct {
// contains filtered or unexported fields
}
Identity belongs to the exclusive profile owner.
func OpenIdentity ¶
func ReadIdentity ¶ added in v0.2.4
ReadIdentity loads the existing key without creating one.
type Invitation ¶
type Invitation struct {
// contains filtered or unexported fields
}
func (*Invitation) Close ¶
func (invitation *Invitation) Close() error
func (*Invitation) ExpiresAtMS ¶
func (invitation *Invitation) ExpiresAtMS() uint64
func (*Invitation) GoString ¶
func (*Invitation) GoString() string
func (*Invitation) IsPaired ¶
func (invitation *Invitation) IsPaired() bool
func (*Invitation) String ¶
func (*Invitation) String() string
func (*Invitation) Ticket ¶
func (invitation *Invitation) Ticket() string
type InvitationScope ¶
type InvitationScope struct {
Kind protocol.InvitationKind
User *protocol.UserID
}
InvitationScope is captured by the endpoint sharing the invitation. User is meaningful only on a Node; it is never accepted from a pairing claimant.
type Link ¶
type Link struct {
// contains filtered or unexported fields
}
func OpenController ¶
func (*Link) ApplyDirectory ¶
ApplyDirectory imports only outbound hosts from an authenticated my-device source. Store provenance preserves direct pairs and explicit local removals.
func (*Link) Disconnect ¶
Disconnect closes the cached connection to a paired peer; the next use dials again. It is for a caller that knows the peer's process was replaced: a connection to a process that is gone is otherwise noticed only when an operation on it times out.
func (*Link) HostRemovals ¶
func (link *Link) HostRemovals(ctx context.Context) ([]HostRemovalAttempt, error)
func (*Link) InviteFor ¶
func (link *Link) InviteFor(ctx context.Context, scope InvitationScope) (*Invitation, error)
func (*Link) NarrowLegacyController ¶
NarrowLegacyController runs only after authenticated inspection positively identifies a controller without execution. The store checks legacy state in the same write, so a newer explicit pairing cannot be narrowed by a stale read.
func (*Link) NetworkChanged ¶
NetworkChanged rebinds the endpoint, then verifies each cached outgoing connection with one inspection. A libp2p inspection checks only the path carrying its stream; other paths and their admitted streams remain usable.
func (*Link) NetworkSelection ¶
func (link *Link) NetworkSelection() *protocol.NetworkSelection
func (*Link) PairPIN ¶
func (link *Link) PairPIN(ctx context.Context, origin, pin string, claim *PairingClaim) (EndpointAddress, error)
func (*Link) PairPINOnNetwork ¶
func (link *Link) PairPINOnNetwork(ctx context.Context, origin, pin string, selection protocol.NetworkSelection, claim *PairingClaim) (EndpointAddress, error)
func (*Link) PeerDirections ¶
func (*Link) PrepareHostRemoval ¶
func (*Link) PrepareHostRemovalNotice ¶
func (link *Link) PrepareHostRemovalNotice(ctx context.Context, host protocol.NodeID) (HostRemovalAttempt, *HostRemovalNotice, error)
PrepareHostRemovalNotice persists the original request and reserves only an existing live connection. An offline host needs no notification or dial.
func (*Link) RecordHostRemoval ¶
func (*Link) RefreshPeers ¶
RefreshPeers reconciles trust changed by a Node command transaction. Removed inbound access closes existing connections before another request can use it.
func (*Link) Relationships ¶
func (link *Link) Relationships(ctx context.Context) ([]PeerRelationship, error)
func (*Link) RememberPeerName ¶
func (*Link) Remote ¶
func (link *Link) Remote(address EndpointAddress) *Remote
func (*Link) SelectNetwork ¶
func (*Link) SetDirection ¶
func (link *Link) SetDirection(ctx context.Context, peer protocol.NodeID, direction PeerDirection) error
SetDirection changes an existing relationship and releases connections that held access removed by the change. It does not pair an unknown peer.
func (*Link) ShareFor ¶
func (link *Link) ShareFor(ctx context.Context, origin string, scope InvitationScope) (*ShareSession, error)
func (*Link) UpdatePeer ¶
func (link *Link) UpdatePeer(ctx context.Context, address EndpointAddress) error
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
Local is constructed by the Node owner; caller identity never comes from wire data.
func (*Local) ForTarget ¶
ForTarget lets the local controller's resource router choose a directly connected storage Node without changing the prepared request or caller.
func (*Local) LocalResource ¶
func (local *Local) LocalResource(ctx context.Context, call protocol.ResourceCall) (Admission, error)
LocalResource restores a prepared resource mutation through the local controller entry. Its user and package are verified by that Node.
func (*Local) ScopedKnowledge ¶
func (*Local) WatchConnection ¶
func (local *Local) WatchConnection(ctx context.Context, changed func(ConnectionInfo)) error
type MembershipStore ¶
type MembershipStore interface {
Relationships(context.Context) ([]PeerRelationship, error)
ApplyDirectory(context.Context, protocol.NodeID, uint64, []EndpointAddress, ...map[protocol.NodeID]string) error
}
MembershipStore extends persistent peer stores. The base interface remains usable by transports that do not support identity invitations or directories.
type NetworkScope ¶
type PairingClaim ¶
type PairingClaim struct {
// contains filtered or unexported fields
}
func (*PairingClaim) GoString ¶
func (*PairingClaim) GoString() string
func (*PairingClaim) String ¶
func (*PairingClaim) String() string
type PeerDirection ¶
type PeerDirection string
PeerDirection describes which endpoint may call the other's execution service.
const ( DirectionController PeerDirection = "controller" DirectionHost PeerDirection = "host" DirectionBoth PeerDirection = "both" )
func (PeerDirection) AllowsInbound ¶
func (direction PeerDirection) AllowsInbound() bool
func (PeerDirection) AllowsOutbound ¶
func (direction PeerDirection) AllowsOutbound() bool
func (PeerDirection) Valid ¶
func (direction PeerDirection) Valid() bool
type PeerIdentityStore ¶
PeerIdentityStore binds the type reported by an authenticated peer to its existing membership. Classification cannot add trust or execution direction.
type PeerInfo ¶
type PeerInfo struct {
Execution bool
Name *string
Platform string
SoftwareVersion *string
Protocol *uint16
Latency time.Duration
Zstd bool
HasNode *bool
}
func (PeerInfo) Compatibility ¶
type PeerNameStore ¶
PeerNameStore retains display metadata learned from authenticated endpoints. Names never establish trust or change an address's certified identity.
type PeerRelationship ¶
type PeerRelationship struct {
ID protocol.NodeID `json:"id"`
Name string `json:"name,omitempty"`
Direct bool `json:"direct"`
DirectDirection PeerDirection `json:"direct_direction,omitempty"`
MyDevice bool `json:"my_device"`
Removed bool `json:"removed"`
Sources []protocol.NodeID `json:"sources"`
DirectoryRevision uint64 `json:"directory_revision"`
}
type PeerStore ¶
type PeerStore interface {
Peers(context.Context) ([]protocol.NodeID, error)
Addresses(context.Context) ([]EndpointAddress, error)
Remember(context.Context, EndpointAddress) error
SetTrust(context.Context, protocol.NodeID, bool) error
Directions(context.Context) ([]PeerTrust, error)
PairPeer(context.Context, protocol.NodeID, PeerDirection) error
// A resumed invitation can refresh an existing inbound peer's address, but
// cannot grant access again or change its membership.
SavePairing(ctx context.Context, address EndpointAddress, direction PeerDirection, scope InvitationScope, hasNode *bool, resume bool) error
SetDirection(context.Context, protocol.NodeID, PeerDirection) error
}
type PeerTrust ¶
type PeerTrust struct {
ID protocol.NodeID `json:"id"`
Direction PeerDirection `json:"direction"`
Legacy bool `json:"legacy,omitempty"`
}
PeerTrust is one persisted relationship. Both is retained for legacy pairings or two independently accepted invitations in opposite directions.
type Remote ¶
type Remote struct {
// contains filtered or unexported fields
}
func (*Remote) ForTarget ¶
ForTarget retains this authenticated entry for a shell resource selection.
func (*Remote) Resource ¶
Resource carries captured knowledge context between directly paired Nodes. It never enables ordinary reverse commands.
func (*Remote) ScopedKnowledge ¶
func (*Remote) WatchConnection ¶
func (remote *Remote) WatchConnection(ctx context.Context, callback func(ConnectionInfo)) error
type ResourceHandler ¶
type ResourceHandler interface {
Resource(context.Context, protocol.NodeID, protocol.ResourceCall) (Admission, error)
}
ResourceHandler implements only the limited reverse resource channel. caller is always the authenticated execution peer, never a wire-supplied user.
type ScopedKnowledgeHandler ¶
type ScopedKnowledgeHandler interface {
ScopedKnowledge(context.Context, protocol.NodeID, protocol.ScopedKnowledgeCall) (Admission, error)
}
ScopedKnowledgeHandler validates a controller's plugin scope at its execution Node. Unlike ResourceHandler it accepts no trusted runtime capture.
type ShareSession ¶
type ShareSession struct {
// contains filtered or unexported fields
}
func (*ShareSession) Close ¶
func (session *ShareSession) Close() error
func (*ShareSession) Next ¶
func (session *ShareSession) Next(ctx context.Context) (ShareState, error)
type ShareState ¶
type ShareState struct {
}
type Stream ¶
type Stream interface {
io.ReadWriteCloser
CloseWrite() error
}
Stream carries one authorized resource. CloseWrite finishes upload bytes while retaining the read side for the resource owner's publication acknowledgment.
type Subscription ¶
Subscription observes one resource owned by the selected Node. Next honors its context; Close releases the observation and is safe to call more than once.
type Transport ¶
type Transport interface {
Open(context.Context, protocol.StreamID) (Stream, error)
Target() protocol.NodeID
Dispatch(context.Context, protocol.Request) (Admission, error)
Subscribe(context.Context, protocol.Topic) (Subscription, error)
WatchConnection(context.Context, func(ConnectionInfo)) error
}
Transport binds a controller to one Node without owning business state.
Source Files
¶
- compatibility.go
- connection.go
- controller_directory.go
- controller_files_unix.go
- controller_migration.go
- controller_removal.go
- controller_store.go
- framing.go
- host_removal.go
- host_removal_notice.go
- identity.go
- identity_file_unix.go
- libp2p_address.go
- libp2p_connection.go
- libp2p_endpoint.go
- libp2p_lan.go
- libp2p_liveness.go
- libp2p_relay.go
- libp2p_stream.go
- local.go
- local_target.go
- membership.go
- network.go
- outgoing.go
- pairing.go
- peer_kind.go
- peers.go
- relay.go
- relay_input.go
- relay_probe.go
- relays.go
- remote.go
- rendezvous.go
- resource.go
- scoped_knowledge.go
- server.go
- sharing.go
- stream.go
- transport.go
- trust.go