pub struct ServiceEndpoints {
pub udp_trackers: Vec<Url>,
pub http_trackers: Vec<Url>,
pub api_endpoint: Option<Url>,
pub health_check_url: Option<Url>,
}Expand description
Service endpoints for deployed tracker services
This struct stores the URLs for all deployed tracker services. These URLs
are computed from the tracker configuration and instance IP after the
run command successfully starts the services.
§Purpose
Having service endpoints as first-class data allows:
- Displaying service URLs without recomputation
- Sharing URLs with external tools/integrations
- Validating service availability against stored endpoints
§Examples
use torrust_tracker_deployer_lib::domain::environment::runtime_outputs::ServiceEndpoints;
use url::Url;
let endpoints = ServiceEndpoints {
udp_trackers: vec![
Url::parse("udp://10.0.0.1:6969/announce").unwrap(),
],
http_trackers: vec![
Url::parse("http://10.0.0.1:7070/announce").unwrap(),
],
api_endpoint: Some(Url::parse("http://10.0.0.1:1212/api").unwrap()),
health_check_url: Some(Url::parse("http://10.0.0.1:1313/health_check").unwrap()),
};Fields§
§udp_trackers: Vec<Url>UDP tracker announce URLs (e.g., udp://10.0.0.1:6969/announce)
http_trackers: Vec<Url>HTTP tracker announce URLs (e.g., http://10.0.0.1:7070/announce)
api_endpoint: Option<Url>HTTP API endpoint URL (e.g., http://10.0.0.1:1212/api)
health_check_url: Option<Url>Health check API URL (e.g., http://10.0.0.1:1313/health_check)
Implementations§
Source§impl ServiceEndpoints
impl ServiceEndpoints
Sourcepub fn new(
udp_trackers: Vec<Url>,
http_trackers: Vec<Url>,
api_endpoint: Option<Url>,
health_check_url: Option<Url>,
) -> Self
pub fn new( udp_trackers: Vec<Url>, http_trackers: Vec<Url>, api_endpoint: Option<Url>, health_check_url: Option<Url>, ) -> Self
Create new ServiceEndpoints from the provided URLs
Sourcepub fn from_tracker_config(
tracker_config: &TrackerConfig,
instance_ip: IpAddr,
) -> Self
pub fn from_tracker_config( tracker_config: &TrackerConfig, instance_ip: IpAddr, ) -> Self
Build ServiceEndpoints from tracker configuration and instance IP
Constructs service URLs by combining the configured bind addresses with the actual instance IP address.
§Examples
use torrust_tracker_deployer_lib::domain::environment::runtime_outputs::ServiceEndpoints;
use torrust_tracker_deployer_lib::domain::tracker::TrackerConfig;
use std::net::{IpAddr, Ipv4Addr};
let tracker_config = TrackerConfig::default();
let instance_ip = IpAddr::V4(Ipv4Addr::new(10, 0, 0, 1));
let endpoints = ServiceEndpoints::from_tracker_config(&tracker_config, instance_ip);Trait Implementations§
Source§impl Clone for ServiceEndpoints
impl Clone for ServiceEndpoints
Source§impl Debug for ServiceEndpoints
impl Debug for ServiceEndpoints
Source§impl<'de> Deserialize<'de> for ServiceEndpoints
impl<'de> Deserialize<'de> for ServiceEndpoints
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ServiceEndpoints
impl RefUnwindSafe for ServiceEndpoints
impl Send for ServiceEndpoints
impl Sync for ServiceEndpoints
impl Unpin for ServiceEndpoints
impl UnsafeUnpin for ServiceEndpoints
impl UnwindSafe for ServiceEndpoints
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> ⓘ
Converts
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> ⓘ
Converts
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>
Wrap the input message
T in a tonic::Request