diff --git a/clash/tests/data/config/wg_config/.donoteditthisfile b/clash/tests/data/config/wg_config/.donoteditthisfile index 3cfff22c3..c68c115c5 100644 --- a/clash/tests/data/config/wg_config/.donoteditthisfile +++ b/clash/tests/data/config/wg_config/.donoteditthisfile @@ -1,5 +1,5 @@ -ORIG_SERVERURL="36.161.169.198" -ORIG_SERVERPORT="51820" +ORIG_SERVERURL="127.0.0.1" +ORIG_SERVERPORT="10002" ORIG_PEERDNS="10.13.13.1" ORIG_PEERS="1" ORIG_INTERFACE="10.13.13" diff --git a/clash/tests/data/config/wg_config/templates/peer.conf b/clash/tests/data/config/wg_config/templates/peer.conf index 196540e87..d987dba98 100644 --- a/clash/tests/data/config/wg_config/templates/peer.conf +++ b/clash/tests/data/config/wg_config/templates/peer.conf @@ -1,7 +1,7 @@ [Interface] Address = ${CLIENT_IP} PrivateKey = $(cat /config/${PEER_ID}/privatekey-${PEER_ID}) -ListenPort = 10002 +ListenPort = 51820 DNS = ${PEERDNS} [Peer] diff --git a/clash_lib/src/proxy/wg/mod.rs b/clash_lib/src/proxy/wg/mod.rs index 48d9f55d6..c0d9f3199 100644 --- a/clash_lib/src/proxy/wg/mod.rs +++ b/clash_lib/src/proxy/wg/mod.rs @@ -306,6 +306,7 @@ mod tests { "PGID=1000", "TZ=Etc/UTC", "SERVERPORT=10002", + "SERVERURL=127.0.0.1", "PEERS=1", "PEERDNS=auto", "INTERNAL_SUBNET=10.13.13.0", @@ -321,7 +322,6 @@ mod tests { #[tokio::test] #[serial_test::serial] - #[ignore = "TODO: fix me please"] async fn test_wg() -> anyhow::Result<()> { let opts = HandlerOpts { name: "wg".to_owned(), @@ -345,11 +345,9 @@ mod tests { // cannot run the ping pong test, since the wireguard server is running on bridge network mode // and the `net.ipv4.conf.all.src_valid_mark` is not supported in the host network mode // the latency test should be enough - run_test_suites_and_cleanup( - handler, - get_runner().await?, - &[Suite::LatencyTcp, Suite::DnsUdp], - ) - .await + let runner = get_runner().await?; + // FIXME: wait for the startup of the test runner in a more elegant way + tokio::time::sleep(tokio::time::Duration::from_secs(2)).await; + run_test_suites_and_cleanup(handler, runner, &[Suite::LatencyTcp, Suite::DnsUdp]).await } }