pub struct Client { /* private fields */ }
Expand description
Client to run netchecks.
Creating this creates a netcheck actor which runs in the background. Most of the time
it is idle unless Client::get_report
is called, which is the main interface.
The Client
struct can be cloned and results multiple handles to the running actor.
If all Client
s are dropped the actor stops running.
While running the netcheck actor expects to be passed all received stun packets using
Addr::receive_stun_packet
.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(
port_mapper: Option<Client>,
dns_resolver: DnsResolver,
) -> Result<Self>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub fn new( port_mapper: Option<Client>, dns_resolver: DnsResolver, ) -> Result<Self>
Creates a new netcheck client.
This starts a connected actor in the background. Once the client is dropped it will stop running.
Sourcepub async fn get_report(
&mut self,
dm: RelayMap,
stun_conn4: Option<Arc<UdpSocket>>,
stun_conn6: Option<Arc<UdpSocket>>,
) -> Result<Arc<Report>>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn get_report( &mut self, dm: RelayMap, stun_conn4: Option<Arc<UdpSocket>>, stun_conn6: Option<Arc<UdpSocket>>, ) -> Result<Arc<Report>>
Runs a netcheck, returning the report.
It may not be called concurrently with itself, &mut self
takes care of that.
The stun_conn4 and stun_conn6 endpoints are bound UDP sockets to use to send out
STUN packets. This function will not read from the sockets, as they may be
receiving other traffic as well, normally they are the sockets carrying the real
traffic. Thus all stun packets received on those sockets should be passed to
Addr::receive_stun_packet
in order for this function to receive the stun
responses and function correctly.
If these are not passed in this will bind sockets for STUN itself, though results may not be as reliable.
Sourcepub async fn get_report_channel(
&mut self,
dm: RelayMap,
stun_conn4: Option<Arc<UdpSocket>>,
stun_conn6: Option<Arc<UdpSocket>>,
) -> Result<Receiver<Result<Arc<Report>>>>
👎Deprecated: This crate has been renamed from ‘iroh-net’ to ‘iroh’, please use the new crate
pub async fn get_report_channel( &mut self, dm: RelayMap, stun_conn4: Option<Arc<UdpSocket>>, stun_conn6: Option<Arc<UdpSocket>>, ) -> Result<Receiver<Result<Arc<Report>>>>
Get report with channel