1mod client;
6mod provider;
7
8use fidl_fuchsia_net_dhcpv6::ClientProviderRequestStream;
9use fuchsia_component::server::{ServiceFs, ServiceFsDir};
10use futures::{future, StreamExt as _, TryStreamExt as _};
11
12use anyhow::{Error, Result};
13use log::info;
14
15enum IncomingService {
16 ClientProvider(ClientProviderRequestStream),
17}
18
19#[fuchsia::main()]
20pub async fn main() -> Result<()> {
21 info!("starting");
22
23 let mut fs = ServiceFs::new_local();
24 let _: &mut ServiceFsDir<'_, _> =
25 fs.dir("svc").add_fidl_service(IncomingService::ClientProvider);
26 let _: &mut ServiceFs<_> = fs.take_and_serve_directory_handle()?;
27
28 fs.then(future::ok::<_, Error>)
29 .try_for_each_concurrent(None, |request| async {
30 match request {
31 IncomingService::ClientProvider(client_provider_request_stream) => {
32 Ok(provider::run_client_provider(
33 client_provider_request_stream,
34 client::serve_client,
35 )
36 .await)
37 }
38 }
39 })
40 .await
41}