pub struct ScionStackBuilder { /* private fields */ }Expand description
Builder for creating a ScionStack.
§Example
use scion_stack::scionstack::builder::ScionStackBuilder;
use url::Url;
async fn setup_scion_stack() {
let control_plane_url: Url = "http://127.0.0.1:1234".parse().unwrap();
let scion_stack = ScionStackBuilder::new(control_plane_url)
.with_auth_token("snap_token".to_string())
.build()
.await
.unwrap();
}Implementations§
Source§impl ScionStackBuilder
impl ScionStackBuilder
Sourcepub fn new(endhost_api_url: Url) -> Self
pub fn new(endhost_api_url: Url) -> Self
Create a new ScionStackBuilder.
The stack uses the the endhost API to discover the available data planes. By default, udp dataplanes are preferred over snap dataplanes.
Sourcepub fn with_prefer_snap(self) -> Self
pub fn with_prefer_snap(self) -> Self
When discovering data planes, prefer SNAP data planes if available.
Sourcepub fn with_prefer_udp(self) -> Self
pub fn with_prefer_udp(self) -> Self
When discovering data planes, prefer UDP data planes if available.
Sourcepub fn with_endhost_api_auth_token_source(
self,
source: impl TokenSource,
) -> Self
pub fn with_endhost_api_auth_token_source( self, source: impl TokenSource, ) -> Self
Set a token source to use for authentication with the endhost API.
Sourcepub fn with_endhost_api_auth_token(self, token: String) -> Self
pub fn with_endhost_api_auth_token(self, token: String) -> Self
Set a static token to use for authentication with the endhost API.
Sourcepub fn with_auth_token_source(self, source: impl TokenSource) -> Self
pub fn with_auth_token_source(self, source: impl TokenSource) -> Self
Set a token source to use for authentication both with the endhost API and the SNAP control plane. If a more specific token source is set, it takes precedence over this token source.
Sourcepub fn with_auth_token(self, token: String) -> Self
pub fn with_auth_token(self, token: String) -> Self
Set a static token to use for authentication both with the endhost API and the SNAP control plane. If a more specific token is set, it takes precedence over this token.
Sourcepub fn with_snap_underlay_config(self, config: SnapUnderlayConfig) -> Self
pub fn with_snap_underlay_config(self, config: SnapUnderlayConfig) -> Self
Set SNAP underlay specific configuration for the SCION stack.
Sourcepub fn with_udp_underlay_config(self, config: UdpUnderlayConfig) -> Self
pub fn with_udp_underlay_config(self, config: UdpUnderlayConfig) -> Self
Set UDP underlay specific configuration for the SCION stack.
Sourcepub async fn build(self) -> Result<ScionStack, BuildScionStackError>
pub async fn build(self) -> Result<ScionStack, BuildScionStackError>
Auto Trait Implementations§
impl Freeze for ScionStackBuilder
impl !RefUnwindSafe for ScionStackBuilder
impl Send for ScionStackBuilder
impl Sync for ScionStackBuilder
impl Unpin for ScionStackBuilder
impl !UnwindSafe for ScionStackBuilder
Blanket Implementations§
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
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request