pub enum BrokerTransportSecurity {
RequireTls,
AllowInsecurePlaintext,
}Expand description
How Photon may connect to an external broker.
Production hosts should use Self::RequireTls. Plaintext endpoints require an explicit
Self::AllowInsecurePlaintext opt-in (builder method or ALLOW_INSECURE_BROKER_ENV).
Variants§
RequireTls
Reject plaintext broker URLs/endpoints; prefer TLS (tls://, SDK TLS options).
AllowInsecurePlaintext
Development/CI only: allow nats:// and other plaintext broker endpoints.
Implementations§
Source§impl BrokerTransportSecurity
impl BrokerTransportSecurity
Sourcepub fn from_env() -> BrokerTransportSecurity
pub fn from_env() -> BrokerTransportSecurity
Load from ALLOW_INSECURE_BROKER_ENV (1/true → insecure; otherwise require TLS).
Sourcepub const fn allows_plaintext(self) -> bool
pub const fn allows_plaintext(self) -> bool
Returns true when plaintext broker endpoints are permitted.
Sourcepub fn check_endpoint(self, endpoint: &str) -> Result<(), PhotonError>
pub fn check_endpoint(self, endpoint: &str) -> Result<(), PhotonError>
Fail closed when endpoint looks like plaintext and insecure opt-in is absent.
Recognizes common plaintext schemes: nats://, kafka://, ftp://, bare host:port
without a tls / ssl / https marker. tls://, nats+tls://, and URLs containing
ssl/tls as the scheme are treated as TLS-oriented.
§Errors
Returns PhotonError::Internal when plaintext would be used without opt-in.
Trait Implementations§
Source§impl Clone for BrokerTransportSecurity
impl Clone for BrokerTransportSecurity
Source§fn clone(&self) -> BrokerTransportSecurity
fn clone(&self) -> BrokerTransportSecurity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BrokerTransportSecurity
Source§impl Debug for BrokerTransportSecurity
impl Debug for BrokerTransportSecurity
Source§impl Default for BrokerTransportSecurity
impl Default for BrokerTransportSecurity
Source§fn default() -> BrokerTransportSecurity
fn default() -> BrokerTransportSecurity
impl Eq for BrokerTransportSecurity
Source§impl PartialEq for BrokerTransportSecurity
impl PartialEq for BrokerTransportSecurity
impl StructuralPartialEq for BrokerTransportSecurity
Auto Trait Implementations§
impl Freeze for BrokerTransportSecurity
impl RefUnwindSafe for BrokerTransportSecurity
impl Send for BrokerTransportSecurity
impl Sync for BrokerTransportSecurity
impl Unpin for BrokerTransportSecurity
impl UnsafeUnpin for BrokerTransportSecurity
impl UnwindSafe for BrokerTransportSecurity
Blanket Implementations§
impl<T> AsyncConnector for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more