pub struct Client { /* private fields */ }Expand description
Port mapping client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn with_metrics(config: Config, metrics: Arc<Metrics>) -> Self
pub fn with_metrics(config: Config, metrics: Arc<Metrics>) -> Self
Creates a new port mapping client with a previously created metrics collector.
Sourcepub fn with_observer(
config: Config,
metrics: Arc<Metrics>,
observer: Observer,
) -> Self
pub fn with_observer( config: Config, metrics: Arc<Metrics>, observer: Observer, ) -> Self
Create a client whose discovery, lease and release transitions are observed.
Sourcepub fn probe(&self) -> Receiver<Result<ProbeOutput, ProbeError>> ⓘ
pub fn probe(&self) -> Receiver<Result<ProbeOutput, ProbeError>> ⓘ
Request a probe to the port mapping protocols.
Returns the oneshot::Receiver used to obtain the result of the probe.
Sourcepub fn procure_mapping(&self)
pub fn procure_mapping(&self)
Try to get a mapping for the last local port if there isn’t one already.
Sourcepub fn update_local_port(&self, local_port: NonZeroU16)
pub fn update_local_port(&self, local_port: NonZeroU16)
Update the local port.
If the port changes, this will trigger a port mapping attempt.
Sourcepub fn deactivate(&self)
pub fn deactivate(&self)
Deactivate port mapping.
Sourcepub async fn deactivate_and_wait(&self)
pub async fn deactivate_and_wait(&self)
Deactivate and acknowledge completion of lease cleanup. Observer events distinguish successful release from a gateway error.
Sourcepub fn watch_external_address(&self) -> Receiver<Option<SocketAddrV4>>
pub fn watch_external_address(&self) -> Receiver<Option<SocketAddrV4>>
Watch the external address for changes in the mappings.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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