weirdnet_ext_proto/lib.rs
1//! `weirdnet.ext.v1`: the protobuf contract between a Weirdnet extension host and its
2//! extensions, with tonic client and server stubs. See `proto/weirdnet/ext/v1/ext.proto`.
3//!
4//! App-specific services (such as Morph's `morph.ext.v1`) travel inside [`v1::CallRequest`]
5//! and [`v1::AppEvent`] as prost-encoded bytes, so this contract stays the same for every app.
6
7/// The session metadata key sent on every call after the handshake.
8pub const SESSION_HEADER: &str = "x-weirdnet-session";
9/// The environment variable holding the one-time token.
10pub const ENV_TOKEN: &str = "WEIRDNET_EXT_TOKEN";
11/// The environment variable holding the file descriptor of the extension's end of the
12/// private socket the host made for it (Unix). The extension needs no `socket()` call.
13pub const ENV_FD: &str = "WEIRDNET_EXT_FD";
14/// The environment variable holding a host socket path instead (or a named pipe on Windows).
15pub const ENV_SOCKET: &str = "WEIRDNET_EXT_SOCKET";
16/// The environment variable holding the extension id.
17pub const ENV_ID: &str = "WEIRDNET_EXT_ID";
18/// The host API version this contract describes.
19pub const API_VERSION: u32 = 1;
20
21/// The generated messages and stubs.
22#[allow(missing_docs, clippy::all)]
23pub mod v1 {
24 tonic::include_proto!("weirdnet.ext.v1");
25}
26
27/// tonic's status types, for implementing services without a direct tonic dependency.
28pub mod tonic_status {
29 pub use tonic::{Code, Status};
30}