Skip to main content

FlowServiceTlsOptions

Struct FlowServiceTlsOptions 

Source
pub struct FlowServiceTlsOptions { /* private fields */ }
Expand description

Enables verified TLS for a Client or Worker’s outbound FlowService connection.

Pass independently to crate::ClientOptions::flow_service_tls and crate::WorkerOptions::flow_service_tls. Omitting these settings keeps plaintext gRPC. An empty options value enables TLS 1.2 or newer with native system roots. Additional roots extend that trust store. The endpoint must negotiate HTTP/2 through ALPN h2. The address must be host:port, dns:///host:port, or dns://authority/host:port. DNS authority syntax is accepted, but resolution uses the operating system resolver. Credentials remain bearer call metadata. These settings do not change an API-key token endpoint.

crate::Client::try_new and crate::Worker::try_new return SdkError::InvalidArgument for an invalid address, nonempty bundle without a valid root, or invalid server name. Native-root loading errors are logged; successfully loaded roots remain usable. An empty trust store constructs successfully but cannot verify a server. Connections open lazily: certificate, hostname, and handshake failures appear on the first Client call or crate::Worker::start as service errors.

use std::sync::Arc;
use dex_sdk::{BlobCache, BlobCacheConfig, Client, ClientOptions, FileCredential,
    FlowServiceTlsOptions, Registry, Worker, WorkerOptions};
let cache = Arc::new(BlobCache::open(BlobCacheConfig::new(
    "/tmp/dex-tls-blobs", 64 * 1024 * 1024, 0,
)?)?);
let tls = FlowServiceTlsOptions::new()
    .additional_root_cas_pem(std::fs::read("/etc/dex/root-ca.pem")?);
let credential = Arc::new(FileCredential::new("/var/run/secrets/dex/token")?);
let registry = Registry::new();
let worker = Worker::try_new(registry.clone(), cache.clone(), WorkerOptions::new()
    .server_address("dex.example.com:443").flow_service_tls(tls.clone())
    .credential(credential.clone()))?;
let client = Client::try_new(registry, cache, ClientOptions::new()
    .server_address("dex.example.com:443").flow_service_tls(tls)
    .credential(credential))?;
client.health_check()?;
worker.start()?;

Implementations§

Source§

impl FlowServiceTlsOptions

Source

pub fn new() -> Self

Creates verified TLS options using native system roots and the address host.

Equivalent to Self::default. No additional roots or server name override are set. Pass these options to a Client or Worker as shown in the enclosing type’s example.

Source

pub fn additional_root_cas_pem(self, value: impl Into<Vec<u8>>) -> Self

Adds PEM-encoded CA certificates to the native system trust store.

Defaults to no additional certificates. Empty bytes have the same effect. Takes ownership of value and returns these options with that bundle. Construction reads the bytes once; file changes are not watched. A nonempty bundle must contain at least one parsable certificate, or construction returns SdkError::InvalidArgument. Other blocks and malformed certificates are skipped when another certificate parses. Additional roots remain usable when the native store is empty or fails to load. See the enclosing type’s example.

Source

pub fn server_name(self, value: impl Into<String>) -> Self

Overrides the address host for certificate verification, SNI, and HTTP/2 authority.

Defaults to verifying the address host and retaining its host and port as authority. Takes ownership of value and returns these options with that override. Use a DNS name or unbracketed IP address without a port. Empty or invalid names cause construction to return SdkError::InvalidArgument. An IP address sends no SNI and requires a matching IP SAN. An override becomes the authority without a port; a gateway must accept that name. An IPv6 override is bracketed in :authority (for example, [::1]), while certificate verification uses the bare address. See the enclosing type’s example, adding .server_name("dex.example.com") to the TLS options when a gateway requires that name.

Trait Implementations§

Source§

impl Clone for FlowServiceTlsOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FlowServiceTlsOptions

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FlowServiceTlsOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more