Skip to main content

Crate pb_mapper

Crate pb_mapper 

Source
Expand description

Client SDK for a deployed pb-mapper relay.

ⓘ
use std::time::Duration;

use pb_mapper::{Client, ClientConfig, ConnectRequest, RegisterRequest, Transport};

let client = Client::new(ClientConfig {
    server: "relay.example.com:7666".into(),
    credential: std::env::var("MSG_HEADER_KEY").expect("MSG_HEADER_KEY"),
    keep_alive: true,
    namespace: None,
})?;

let registration = client
    .register(RegisterRequest {
        key: "echo".into(),
        local_addr: "127.0.0.1:8080".into(),
        transport: Transport::Tcp,
        codec: false,
        force_namespace: false,
    })
    .await?;
registration.wait_ready().await?;

let _keys = client.list_keys().await?;
let issued = client
    .admin()?
    .issue_key(Duration::from_secs(3600), Some("agent".into()))
    .await?;
client.admin()?.revoke_key(issued.key_id).await?;

registration.stop().await?;

The CLI binary still lives in pb-mapper-cli. That crate is publish = false, so build it from a checkout — make build-pb-mapper, or cargo build --release --bin pb-mapper — rather than installing it from a registry.

Structs§

Admin
Administrator RPCs. Constructed via super::Client::admin.
AuthStatusInfo
Relay-side snapshot of the credential subsystem.
Client
Session against one deployed relay.
ClientConfig
Configuration for a Client session.
ConnectRequest
Subscribe to a registered service and listen locally.
Connection
A live connect tunnel: a local listener forwarding to a registered service.
ConnectionInfo
One control connection the relay holds for a registered service.
ConnectionPage
One page of live service connections.
IssuedKey
A temporary credential, with the secret the relay just minted.
KeyListPage
One page of temporary credentials.
KeyMetadata
A temporary credential without its secret.
RegisterRequest
Register a local TCP/UDP service with the relay.
Registration
A live register tunnel: a local service published on the relay.
RemoteId
Relay mapping dump from status remote-id.
ServiceConnection
One control connection the relay is holding for a service key.
ServiceInfo
A registered service as the relay sees it.
ServicePage
One page of registered services.
TunnelDiagnostics
A point-in-time view of this tunnel and its process-shared relay budget.

Enums§

Error
Errors returned by the client SDK.
LegacyProtocol
Legacy framing policy, matching pb-mapper admin legacy-protocol.
RecoveryFailure
Why a recovery attempt failed, without credentials or application data.
RecoveryPhase
The phase most recently entered by a tunnel worker.
Transport
Transport used by a registered service or a local subscriber.
TunnelStatus
Observed lifecycle of a super::Registration or super::Connection.

Constants§

SDK_VERSION
The SDK version compiled into this process.

Type Aliases§

Result