Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions util/src/vnet/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ impl VNet {
Ok(conn)
}

pub(crate) async fn dail(
pub(crate) async fn dial(
&self,
use_ipv4: bool,
remote_addr: &str,
Expand Down Expand Up @@ -524,15 +524,15 @@ impl Net {
}
}

pub async fn dail(
pub async fn dial(
&self,
use_ipv4: bool,
remote_addr: &str,
) -> Result<Arc<dyn Conn + Send + Sync>> {
match self {
Net::VNet(vnet) => {
let net = vnet.lock().await;
net.dail(use_ipv4, remote_addr).await
net.dial(use_ipv4, remote_addr).await
}
Net::Ifs(_) => {
let any_ip = if use_ipv4 {
Expand Down
14 changes: 7 additions & 7 deletions util/src/vnet/net/net_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ async fn test_net_native_bind() -> Result<()> {
}

#[tokio::test]
async fn test_net_native_dail() -> Result<()> {
async fn test_net_native_dial() -> Result<()> {
let nw = Net::new(None);
assert!(!nw.is_virtual(), "should be false");

let conn = nw.dail(true, "127.0.0.1:1234").await?;
let conn = nw.dial(true, "127.0.0.1:1234").await?;
let laddr = conn.local_addr()?;
assert_eq!(
laddr.ip().to_string(),
Expand Down Expand Up @@ -443,11 +443,11 @@ async fn test_net_virtual_bind_specific_port() -> Result<()> {
}

#[tokio::test]
async fn test_net_virtual_dail_lo0() -> Result<()> {
async fn test_net_virtual_dial_lo0() -> Result<()> {
let nw = Net::new(Some(NetConfig::default()));
assert!(nw.is_virtual(), "should be true");

let conn = nw.dail(true, "127.0.0.1:1234").await?;
let conn = nw.dial(true, "127.0.0.1:1234").await?;
let laddr = conn.local_addr()?;
assert_eq!(
laddr.ip().to_string().as_str(),
Expand All @@ -461,7 +461,7 @@ async fn test_net_virtual_dail_lo0() -> Result<()> {
}

#[tokio::test]
async fn test_net_virtual_dail_eth0() -> Result<()> {
async fn test_net_virtual_dial_eth0() -> Result<()> {
let wan = Arc::new(Mutex::new(Router::new(RouterConfig {
cidr: "1.2.3.0/24".to_string(),
..Default::default()
Expand All @@ -479,7 +479,7 @@ async fn test_net_virtual_dail_eth0() -> Result<()> {
n.set_router(Arc::clone(&wan)).await?;
};

let conn = nw.dail(true, "27.3.4.5:1234").await?;
let conn = nw.dial(true, "27.3.4.5:1234").await?;
let laddr = conn.local_addr()?;
assert_eq!(
laddr.ip().to_string().as_str(),
Expand Down Expand Up @@ -523,7 +523,7 @@ async fn test_net_virtual_resolver() -> Result<()> {
tokio::spawn(async move {
let (conn, raddr) = {
let raddr = nw.resolve_addr(true, "test.webrtc.rs:1234").await?;
(nw.dail(true, "test.webrtc.rs:1234").await?, raddr)
(nw.dial(true, "test.webrtc.rs:1234").await?, raddr)
};

let laddr = conn.local_addr()?;
Expand Down
Loading