Skip to content

Commit

Permalink
🐛 load rustls config at daemon startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Reverier-Xu committed Jul 28, 2024
1 parent 6cfdb28 commit c822ce0
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

env:
APP_NAME: "WebSocketReflectorX"
APP_VERSION: "0.2.19"
APP_VERSION: "0.2.20"

#-------------------------------------------------------------------------------
# Workflow jobs
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ on:

env:
APP_NAME: "WebSocketReflectorX"
APP_VERSION: "0.2.19"
APP_VERSION: "0.2.20"
QT_VERSION: "6.7.1"

#-------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:

env:
APP_NAME: "WebSocketReflectorX"
APP_VERSION: "0.2.19"
APP_VERSION: "0.2.20"
QT_VERSION: "6.7.1"

#-------------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20)

set(VERSION_MAJOR 0)
set(VERSION_MINOR 2)
set(VERSION_PATCH 19)
set(VERSION_PATCH 20)

execute_process(
COMMAND git describe --always --dirty
Expand Down
2 changes: 1 addition & 1 deletion deploy_linux.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

export APP_NAME="WebSocketReflectorX"
export APP_VERSION=0.2.19
export APP_VERSION=0.2.20
export GIT_VERSION=$(git rev-parse --short HEAD)

echo "> $APP_NAME packager (Linux x86_64) [v$APP_VERSION]"
Expand Down
2 changes: 1 addition & 1 deletion deploy_macos.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

export APP_NAME="WebSocketReflectorX"
export APP_VERSION=0.2.19
export APP_VERSION=0.2.20
export GIT_VERSION=$(git rev-parse --short HEAD)

echo "> $APP_NAME packager (macOS x86_64) [v$APP_VERSION]"
Expand Down
2 changes: 1 addition & 1 deletion deploy_windows.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

export APP_NAME="WebSocketReflectorX"
export APP_VERSION=0.2.19
export APP_VERSION=0.2.20
export GIT_VERSION=$(git rev-parse --short HEAD)

echo "> $APP_NAME packager (Windows x86_64) [v$APP_VERSION]"
Expand Down
3 changes: 2 additions & 1 deletion wsrx/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wsrx"
version = "0.2.19"
version = "0.2.20"
edition = "2021"
authors = ["Reverier-Xu <[email protected]>"]
description = "Controlled TCP-over-WebSocket forwarding tunnel."
Expand Down Expand Up @@ -37,6 +37,7 @@ required-features = ["binary"]

[dependencies]
tokio = { version = "1.39", features = ["full"] }
rustls = { version = "0.23", features = ["ring"] }
futures-util = { version = "0.3", features = ["sink"] }
tokio-util = { version = "0.7", features = ["codec"] }
thiserror = "1.0"
Expand Down
19 changes: 19 additions & 0 deletions wsrx/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
use clap::{command, Parser};
use rustls::crypto;
use std::process;
use tracing::{error, info, warn};

mod cli;

Expand Down Expand Up @@ -58,6 +61,22 @@ enum WsrxCli {
#[tokio::main]
async fn main() {
let cli = WsrxCli::parse();
match crypto::aws_lc_rs::default_provider().install_default() {
Ok(_) => info!("using `AWS Libcrypto` as default crypto backend."),
Err(err) => {
error!("`AWS Libcrypto` is not available: {:?}", err);
warn!("try to use `ring` as default crypto backend.");
crypto::ring::default_provider()
.install_default()
.inspect_err(|err| {
error!("`ring` is not available: {:?}", err);
error!("All crypto backend are not available, exiting...");
process::exit(1);
})
.ok();
info!("using `ring` as default crypto backend.");
}
}
match cli {
WsrxCli::Daemon {
host,
Expand Down

0 comments on commit c822ce0

Please sign in to comment.