Skip to content

Commit

Permalink
enable rustls on windows (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
ozgrakkurt committed Apr 18, 2023
1 parent e97957e commit e5418e6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ concurrency:
cancel-in-progress: true

jobs:
test-windows-rustls:
name: Run tests on Windows with rustls
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: Swatinem/rust-cache@v2
with:
key: windows-latest-rustls-test
- name: Test
run: cargo test --features rust_tls
test:
name: Check ${{ matrix.check }} on (${{ matrix.os }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -97,6 +112,7 @@ jobs:
done:
name: Done
needs:
- test-windows-rustls
- test
- wasm_test
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fluvio-future"
version = "0.4.5"
version = "0.4.6"
edition = "2021"
authors = ["Fluvio Contributors <[email protected]>"]
description = "I/O futures for Fluvio project"
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ pub mod zero_copy;
#[cfg(feature = "net")]
pub mod net;

#[cfg(all(unix, feature = "rust_tls"))]
#[cfg(all(any(unix, windows), feature = "rust_tls"))]
pub mod rust_tls;

#[cfg(all(unix, feature = "rust_tls", not(feature = "native2_tls")))]
#[cfg(all(any(unix, windows), feature = "rust_tls", not(feature = "native2_tls")))]
pub use rust_tls as tls;

#[cfg(all(any(unix, windows), feature = "native2_tls"))]
Expand Down
14 changes: 6 additions & 8 deletions src/rust_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,17 @@ mod cert {
}

mod connector {

use std::io::Error as IoError;

use std::io::ErrorKind;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;

use async_rustls::rustls::ServerName;
use async_trait::async_trait;
use log::debug;

use crate::net::{
BoxReadConnection, BoxWriteConnection, DomainConnector, SplitConnection, TcpDomainConnector,
AsConnectionFd, BoxReadConnection, BoxWriteConnection, ConnectionFd, DomainConnector,
SplitConnection, TcpDomainConnector,
};

use super::TcpStream;
Expand All @@ -135,9 +133,9 @@ mod connector {
async fn connect(
&self,
domain: &str,
) -> Result<(BoxWriteConnection, BoxReadConnection, RawFd), IoError> {
) -> Result<(BoxWriteConnection, BoxReadConnection, ConnectionFd), IoError> {
let tcp_stream = TcpStream::connect(domain).await?;
let fd = tcp_stream.as_raw_fd();
let fd = tcp_stream.as_connection_fd();
let (write, read) = self
.0
.connect(
Expand Down Expand Up @@ -180,10 +178,10 @@ mod connector {
async fn connect(
&self,
addr: &str,
) -> Result<(BoxWriteConnection, BoxReadConnection, RawFd), IoError> {
) -> Result<(BoxWriteConnection, BoxReadConnection, ConnectionFd), IoError> {
debug!("connect to tls addr: {}", addr);
let tcp_stream = TcpStream::connect(addr).await?;
let fd = tcp_stream.as_raw_fd();
let fd = tcp_stream.as_connection_fd();
debug!("connect to tls domain: {}", self.domain);
let (write, read) = self
.connector
Expand Down

0 comments on commit e5418e6

Please sign in to comment.