aboutsummaryrefslogtreecommitdiff
path: root/tests/integration_test.rs
diff options
context:
space:
mode:
authorGravatar sunmy2019 <59365878+sunmy2019@users.noreply.github.com> 2024-02-18 17:17:17 +0800
committerGravatar GitHub <noreply@github.com> 2024-02-18 17:17:17 +0800
commit4ac53a5a39e74d5eb12bee22d0fd4783acaae670 (patch)
treeca442e698e6870b7f6c5053b54fff82e2a95626e /tests/integration_test.rs
parent7251759bdaf4b7d170575bdd6d2062bbd9f338bb (diff)
downloadrathole-4ac53a5a39e74d5eb12bee22d0fd4783acaae670.tar.gz
rathole-4ac53a5a39e74d5eb12bee22d0fd4783acaae670.tar.zst
rathole-4ac53a5a39e74d5eb12bee22d0fd4783acaae670.zip
feat: optional rustls support (#330)
* initial implementation of rustls support * Refactor create_self_signed_cert.sh script * resolve lint errors * Fix handling of Option in tls.rs * Update cargo-hack check command and feature dependencies * fix missing point * Add conditional check to skip test if client or server is not enabled * clean up things * fix for windows CI * try fixing Windows CI * Update src/main.rs * Update src/transport/websocket.rs * add missing messages * split the tls mod Co-authored-by: Ning Sun <n@sunng.info>
Diffstat (limited to 'tests/integration_test.rs')
-rw-r--r--tests/integration_test.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/integration_test.rs b/tests/integration_test.rs
index 3b8dec9..7b5d408 100644
--- a/tests/integration_test.rs
+++ b/tests/integration_test.rs
@@ -1,4 +1,4 @@
-use anyhow::Result;
+use anyhow::{Ok, Result};
use common::{run_rathole_client, PING, PONG};
use rand::Rng;
use std::time::Duration;
@@ -57,17 +57,17 @@ async fn tcp() -> Result<()> {
test("tests/for_tcp/tcp_transport.toml", Type::Tcp).await?;
// FIXME: Self-signed certificate on Mac requires mannual interference. Disable CI for now
#[cfg(not(target_os = "macos"))]
- #[cfg(feature="tls")]
+ #[cfg(any(feature = "native-tls", feature = "rustls"))]
test("tests/for_tcp/tls_transport.toml", Type::Tcp).await?;
- #[cfg(feature="noise")]
+ #[cfg(feature = "noise")]
test("tests/for_tcp/noise_transport.toml", Type::Tcp).await?;
- #[cfg(feature="websocket")]
+ #[cfg(any(feature = "websocket-native-tls", feature = "websocket-rustls"))]
test("tests/for_tcp/websocket_transport.toml", Type::Tcp).await?;
#[cfg(not(target_os = "macos"))]
- #[cfg(feature="websocket")]
+ #[cfg(any(feature = "websocket-native-tls", feature = "websocket-rustls"))]
test("tests/for_tcp/websocket_tls_transport.toml", Type::Tcp).await?;
Ok(())
@@ -94,17 +94,17 @@ async fn udp() -> Result<()> {
test("tests/for_udp/tcp_transport.toml", Type::Udp).await?;
// See above
#[cfg(not(target_os = "macos"))]
- #[cfg(feature="tls")]
+ #[cfg(any(feature = "native-tls", feature = "rustls"))]
test("tests/for_udp/tls_transport.toml", Type::Udp).await?;
- #[cfg(feature="noise")]
+ #[cfg(feature = "noise")]
test("tests/for_udp/noise_transport.toml", Type::Udp).await?;
- #[cfg(feature="websocket")]
+ #[cfg(any(feature = "websocket-native-tls", feature = "websocket-rustls"))]
test("tests/for_udp/websocket_transport.toml", Type::Udp).await?;
#[cfg(not(target_os = "macos"))]
- #[cfg(feature="websocket")]
+ #[cfg(any(feature = "websocket-native-tls", feature = "websocket-rustls"))]
test("tests/for_udp/websocket_tls_transport.toml", Type::Udp).await?;
Ok(())
@@ -112,6 +112,11 @@ async fn udp() -> Result<()> {
#[instrument]
async fn test(config_path: &'static str, t: Type) -> Result<()> {
+ if cfg!(not(all(feature = "client", feature = "server"))) {
+ // Skip the test if the client or the server is not enabled
+ return Ok(());
+ }
+
let (client_shutdown_tx, client_shutdown_rx) = broadcast::channel(1);
let (server_shutdown_tx, server_shutdown_rx) = broadcast::channel(1);