Documentation
¶
Overview ¶
Package pluginmain is the common executable entrypoint helper for CloudPath process plugins. It reads the launch identity the A4 Plugin Host injects through the process environment, renders the single handshake line the host parses with pluginhost.ParseHandshake, dials the host's loopback endpoint, and serves an SDK RPC server over that authenticated transport.
This package is public and must never import internal/pluginhost, so the handshake format and environment contract are defined here independently and locked by the tests in this package.
Index ¶
Constants ¶
const ( EnvPluginID = "CLOUDPATH_PLUGIN_ID" EnvProtocol = "CLOUDPATH_PROTOCOL" EnvProtocolVersion = "CLOUDPATH_PROTOCOL_VERSION" EnvLaunchID = "CLOUDPATH_LAUNCH_ID" EnvProof = "CLOUDPATH_PROOF" EnvPluginEndpoint = "CLOUDPATH_PLUGIN_ENDPOINT" )
Environment variables injected by the A4 Plugin Host. These names mirror the host contract in internal/pluginhost/handshake.go.
const HandshakeMarker = "CP1"
HandshakeMarker is the fixed first field of a plugin handshake line.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run is the standard plugin entrypoint: it validates the environment, prints the unique handshake line to out, dials the host, serves the RPC server and closes the transport. Diagnostics are written to errw; Proof is never written to out or errw except as the final field of the single handshake line.
func Serve ¶
func Serve(ctx context.Context, cfg Config, newServer ServerFactory) error
Serve dials the host, builds the RPC server with newServer, serves frames until ctx is canceled or the transport closes, and then closes the transport. A canceled context is reported as nil: signal-driven shutdown is the normal plugin exit path.
Types ¶
type Config ¶
type Config struct {
PluginID string
Protocol string
ProtocolVersion uint32
LaunchID string
Proof string
Endpoint pluginruntime.Endpoint
}
Config is the validated launch identity and endpoint for one plugin process.
func FromEnv ¶
FromEnv reads and validates the host-injected environment. getenv is os.Getenv in production and a map lookup in tests. Missing or malformed values fail fast; error messages never contain secret values such as Proof.
type Handshake ¶
type Handshake struct {
Marker string
PluginID string
Protocol string
ProtocolVersion uint32
Transport string
Endpoint string
RPC string
LaunchID string
Proof string
}
Handshake is the public mirror of the host's parsed handshake record. Its String form is the canonical handshake line.