pub struct ServiceEndpoint { /* private fields */ }Expand description
Represents a service endpoint for external validation testing
Internally stores a validated URL and the server IP address.
For HTTPS endpoints, the IP is used to resolve the domain locally
(since we can’t rely on DNS for .local domains).
§Examples
use std::net::SocketAddr;
use torrust_tracker_deployer_types::ServiceEndpoint;
// HTTP endpoint
let socket_addr: SocketAddr = "10.0.0.1:1212".parse().unwrap();
let endpoint = ServiceEndpoint::http(socket_addr, "/api/health_check").unwrap();
assert_eq!(endpoint.url().as_str(), "http://10.0.0.1:1212/api/health_check");Implementations§
Source§impl ServiceEndpoint
impl ServiceEndpoint
Sourcepub fn http(
socket_addr: SocketAddr,
path: impl Into<String>,
) -> Result<ServiceEndpoint, InvalidServiceEndpointUrl>
pub fn http( socket_addr: SocketAddr, path: impl Into<String>, ) -> Result<ServiceEndpoint, InvalidServiceEndpointUrl>
Sourcepub fn https(
domain: &DomainName,
path: impl Into<String>,
server_ip: IpAddr,
) -> Result<ServiceEndpoint, InvalidServiceEndpointUrl>
pub fn https( domain: &DomainName, path: impl Into<String>, server_ip: IpAddr, ) -> Result<ServiceEndpoint, InvalidServiceEndpointUrl>
Create a new HTTPS endpoint with TLS
§Arguments
domain- The domain name for HTTPS access (required for certificate issuance)path- The health check path (e.g.,/api/health_check)server_ip- The IP address to resolve the domain to
§Errors
Returns an error if the domain and path don’t form a valid URL.
Sourcepub fn port(&self) -> u16
pub fn port(&self) -> u16
Returns the port for this endpoint
For HTTP: the configured port from the URL. For HTTPS: 443 (the default HTTPS port).
Sourcepub fn is_local_domain(&self) -> bool
pub fn is_local_domain(&self) -> bool
Check if the domain ends with .local (for self-signed cert handling)
Sourcepub fn socket_addr(&self) -> SocketAddr
pub fn socket_addr(&self) -> SocketAddr
Returns the socket address for connecting to this endpoint
Combines the server IP with the port from the URL.
Trait Implementations§
Source§impl Clone for ServiceEndpoint
impl Clone for ServiceEndpoint
Source§fn clone(&self) -> ServiceEndpoint
fn clone(&self) -> ServiceEndpoint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ServiceEndpoint
impl Debug for ServiceEndpoint
Source§impl PartialEq for ServiceEndpoint
impl PartialEq for ServiceEndpoint
impl StructuralPartialEq for ServiceEndpoint
Auto Trait Implementations§
impl Freeze for ServiceEndpoint
impl RefUnwindSafe for ServiceEndpoint
impl Send for ServiceEndpoint
impl Sync for ServiceEndpoint
impl Unpin for ServiceEndpoint
impl UnsafeUnpin for ServiceEndpoint
impl UnwindSafe for ServiceEndpoint
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,
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