diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..93e8fc1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,34 @@ +name: Test + +on: [push, pull_request] + +jobs: + build_and_test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: dtolnay/rust-toolchain@stable + with: + toolchain: stable + components: rustfmt, clippy + + - name: Cache dependencies + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + restore-keys: | + ${{ runner.os }}-cargo- + + - name: Run cargo clippy + run: cargo clippy -- -D warnings + + - name: Run cargo test + run: cargo test diff --git a/src/lib.rs b/src/lib.rs index c16a0ff..63c0d39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -39,10 +39,7 @@ impl ProxyServer { .with_single_cert(cert_chain.clone(), key) .expect("Failed to create rustls server config"); - let server = - Self::new_with_tls_config(cert_chain, server_config.into(), local, target).await; - - server + Self::new_with_tls_config(cert_chain, server_config.into(), local, target).await } /// Start with preconfigured TLS @@ -133,10 +130,7 @@ impl ProxyClient { .with_root_certificates(root_store) .with_no_client_auth(); - let client = - Self::new_with_tls_config(client_config.into(), address, server_address, server_name) - .await; - client + Self::new_with_tls_config(client_config.into(), address, server_address, server_name).await } pub async fn new_with_tls_config( @@ -151,7 +145,7 @@ impl ProxyClient { Self { connector, listener, - target: target.into(), + target, target_name, attestation_platform: MockAttestation, }