|
@@ -227,7 +227,7 @@ async fn run_data_channel<T: Transport>(args: Arc<RunDataChannelArgs<T>>) -> Res
|
|
|
if args.service.service_type != ServiceType::Udp {
|
|
if args.service.service_type != ServiceType::Udp {
|
|
|
bail!("Expect UDP traffic. Please check the configuration.")
|
|
bail!("Expect UDP traffic. Please check the configuration.")
|
|
|
}
|
|
}
|
|
|
- run_data_channel_for_udp::<T>(conn, &args.service.local_addr).await?;
|
|
|
|
|
|
|
+ run_data_channel_for_udp::<T>(conn, &args.service.local_addr, args.service.prefer_ipv6).await?;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
Ok(())
|
|
Ok(())
|
|
@@ -255,7 +255,7 @@ async fn run_data_channel_for_tcp<T: Transport>(
|
|
|
type UdpPortMap = Arc<RwLock<HashMap<SocketAddr, mpsc::Sender<Bytes>>>>;
|
|
type UdpPortMap = Arc<RwLock<HashMap<SocketAddr, mpsc::Sender<Bytes>>>>;
|
|
|
|
|
|
|
|
#[instrument(skip(conn))]
|
|
#[instrument(skip(conn))]
|
|
|
-async fn run_data_channel_for_udp<T: Transport>(conn: T::Stream, local_addr: &str) -> Result<()> {
|
|
|
|
|
|
|
+async fn run_data_channel_for_udp<T: Transport>(conn: T::Stream, local_addr: &str, prefer_ipv6: bool) -> Result<()> {
|
|
|
debug!("New data channel starts forwarding");
|
|
debug!("New data channel starts forwarding");
|
|
|
|
|
|
|
|
let port_map: UdpPortMap = Arc::new(RwLock::new(HashMap::new()));
|
|
let port_map: UdpPortMap = Arc::new(RwLock::new(HashMap::new()));
|
|
@@ -305,7 +305,7 @@ async fn run_data_channel_for_udp<T: Transport>(conn: T::Stream, local_addr: &st
|
|
|
// grabbing the writer lock
|
|
// grabbing the writer lock
|
|
|
let mut m = port_map.write().await;
|
|
let mut m = port_map.write().await;
|
|
|
|
|
|
|
|
- match udp_connect(local_addr).await {
|
|
|
|
|
|
|
+ match udp_connect(local_addr, prefer_ipv6).await {
|
|
|
Ok(s) => {
|
|
Ok(s) => {
|
|
|
let (inbound_tx, inbound_rx) = mpsc::channel(UDP_SENDQ_SIZE);
|
|
let (inbound_tx, inbound_rx) = mpsc::channel(UDP_SENDQ_SIZE);
|
|
|
m.insert(packet.from, inbound_tx);
|
|
m.insert(packet.from, inbound_tx);
|