build: include QUIC outbound in FFI crate

This commit is contained in:
eric
2023-08-27 10:27:29 +08:00
parent 26f7543174
commit b38aaca42b
4 changed files with 10 additions and 5 deletions

View File

@@ -22,6 +22,10 @@ default-openssl = [
"leaf/default-openssl",
]
outbound-quic = [
"leaf/outbound-quic",
]
auto-reload = ["leaf/auto-reload"]
[dependencies]

View File

@@ -99,7 +99,7 @@ outbound-static= []
outbound-tryall = []
outbound-chain = []
outbound-amux= ["tokio-util"]
outbound-quic = ["quinn", "rustls", "webpki-roots"]
outbound-quic = ["quinn", "rustls", "webpki-roots", "rustls-pemfile"]
outbound-select = []
outbound-vmess = ["lz_fnv", "cfb-mode", "hmac", "aes", "sha3", "digest", "uuid", "md-5", "tokio-util"]

View File

@@ -154,10 +154,10 @@ impl OutboundStreamHandler for Handler {
} else {
sess.destination.host()
};
trace!("wrapping tls with name {}", &name);
if let Some(stream) = stream {
#[cfg(feature = "rustls-tls")]
{
trace!("handling TLS {} with rustls", &name);
let connector = TlsConnector::from(self.tls_config.clone());
let domain = ServerName::try_from(name.as_str()).map_err(|e| {
io::Error::new(
@@ -179,6 +179,7 @@ impl OutboundStreamHandler for Handler {
}
#[cfg(feature = "openssl-tls")]
{
trace!("handling TLS {} with openssl", &name);
let mut ssl = Ssl::new(self.ssl_connector.context()).map_err(|e| {
io::Error::new(
io::ErrorKind::InvalidInput,

View File

@@ -21,9 +21,9 @@ fi
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
rustup target add aarch64-apple-ios
cargo build -p $package $release_flag --no-default-features --features "default-openssl" --target x86_64-apple-darwin
cargo build -p $package $release_flag --no-default-features --features "default-openssl" --target aarch64-apple-darwin
cargo build -p $package $release_flag --no-default-features --features "default-openssl" --target aarch64-apple-ios
cargo build -p $package $release_flag --no-default-features --features "default-openssl outbound-quic" --target x86_64-apple-darwin
cargo build -p $package $release_flag --no-default-features --features "default-openssl outbound-quic" --target aarch64-apple-darwin
cargo build -p $package $release_flag --no-default-features --features "default-openssl outbound-quic" --target aarch64-apple-ios
# Directories to put the libraries.
rm -rf target/apple/$mode