localclient

package
v0.1.0-preview.7 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package localclient binds secure daemon endpoint discovery and local IPC to the transport-neutral client contracts. It never resolves network names, falls back to TCP, starts a process, or retries an RPC.

Index

Constants

This section is empty.

Variables

View Source
var ErrExplicitEndpointMismatch = errors.New("explicit local endpoint does not match protected metadata")

ErrExplicitEndpointMismatch reports that protected current-user metadata names a different endpoint than the address explicitly requested. Neither address is included because local paths may contain user information.

Functions

This section is empty.

Types

type Connector

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

Connector lazily owns one authenticated local gRPC channel and grpcclient adapter. Reusing that adapter across Initialize calls preserves reconnect fencing state until Connector closes or endpoint discovery replaces it.

func New

func New(metadata endpoint.Metadata) (*Connector, error)

New constructs a lazy connector for one immutable endpoint description.

func (*Connector) Close

func (connector *Connector) Close() error

Close fences every returned session and closes the one shared local gRPC channel. It is idempotent and safe to race with Initialize and Session.Close.

func (*Connector) Format

func (*Connector) Format(state fmt.State, _ rune)

Format prevents every fmt verb from traversing private fields.

func (*Connector) GoString

func (connector *Connector) GoString() string

GoString prevents Go-syntax formatting from traversing private fields.

func (*Connector) Initialize

func (connector *Connector) Initialize(
	ctx context.Context,
	request client.InitializeRequest,
) (result client.Session, resultErr error)

Initialize lazily dials the exact endpoint address and delegates one authenticated negotiation to the shared grpcclient adapter. It never retries a failed negotiation.

func (*Connector) LogValue

func (connector *Connector) LogValue() slog.Value

LogValue prevents endpoint material from entering structured logs.

func (*Connector) MarshalJSON

func (*Connector) MarshalJSON() ([]byte, error)

MarshalJSON makes accidental serialization visibly redacted.

func (*Connector) String

func (*Connector) String() string

String prevents endpoint metadata and credentials from entering formatting.

type Discovery

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

Discovery adapts secure endpoint.Store discovery to managed connector discovery. Only endpoint.ErrNotFound returned as the exact error authorizes managed daemon startup.

func NewDiscovery

func NewDiscovery(store *endpoint.Store) (*Discovery, error)

NewDiscovery binds one endpoint store without performing discovery.

func (*Discovery) Close

func (discovery *Discovery) Close() error

Close prevents future discovery and closes the currently cached connector.

func (*Discovery) Discover

func (discovery *Discovery) Discover(ctx context.Context) (client.Connector, error)

Discover resolves one secure endpoint into a lazy local connector.

func (*Discovery) Format

func (*Discovery) Format(state fmt.State, _ rune)

func (*Discovery) GoString

func (discovery *Discovery) GoString() string

func (*Discovery) LogValue

func (discovery *Discovery) LogValue() slog.Value

func (*Discovery) MarshalJSON

func (*Discovery) MarshalJSON() ([]byte, error)

func (*Discovery) String

func (*Discovery) String() string

type ExplicitDiscovery

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

ExplicitDiscovery resolves only one caller-selected address through the protected endpoint store. It never treats absence as startup authorization and never dials an address without matching active metadata and its token.

func NewExplicitDiscovery

func NewExplicitDiscovery(store *endpoint.Store, requestedAddress string) (*ExplicitDiscovery, error)

NewExplicitDiscovery binds one protected endpoint store and exact requested address without reading metadata or opening an IPC connection.

func (*ExplicitDiscovery) Close

func (discovery *ExplicitDiscovery) Close() error

Close prevents future discovery and closes the cached lazy connector.

func (*ExplicitDiscovery) Discover

func (discovery *ExplicitDiscovery) Discover(ctx context.Context) (client.Connector, error)

Discover reads active protected metadata, requires an exact address match, and returns a lazy authenticated connector. Endpoint absence, stale cleanup, malformed metadata, and mismatch are hard attach failures; none can authorize managed startup.

func (*ExplicitDiscovery) Format

func (*ExplicitDiscovery) Format(state fmt.State, _ rune)

func (*ExplicitDiscovery) GoString

func (discovery *ExplicitDiscovery) GoString() string

func (*ExplicitDiscovery) LogValue

func (discovery *ExplicitDiscovery) LogValue() slog.Value

func (*ExplicitDiscovery) MarshalJSON

func (*ExplicitDiscovery) MarshalJSON() ([]byte, error)

func (*ExplicitDiscovery) String

func (*ExplicitDiscovery) String() string

type StartupLock

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

StartupLock adapts endpoint.Store startup serialization to managed startup.

func NewStartupLock

func NewStartupLock(store *endpoint.Store) (*StartupLock, error)

NewStartupLock binds one endpoint store without acquiring its startup lock.

func (*StartupLock) Acquire

func (lock *StartupLock) Acquire(ctx context.Context) (managed.StartupLease, error)

Acquire obtains one context-bounded, idempotently releasable startup lease.

func (*StartupLock) Format

func (*StartupLock) Format(state fmt.State, _ rune)

func (*StartupLock) GoString

func (lock *StartupLock) GoString() string

func (*StartupLock) LogValue

func (lock *StartupLock) LogValue() slog.Value

func (*StartupLock) MarshalJSON

func (*StartupLock) MarshalJSON() ([]byte, error)

func (*StartupLock) String

func (*StartupLock) String() string

Jump to

Keyboard shortcuts

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