Skip to content

Commit

Permalink
notls
Browse files Browse the repository at this point in the history
  • Loading branch information
zephyrchien committed Jun 5, 2022
1 parent 11f61f3 commit 6b8190f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 6 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/cross_compile.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
name: build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: push

env:
CARGO_TERM_COLOR: always
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,5 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
prerelease: true
files: release-${{ matrix.target }}/*
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tokio = { version = "1", features = ["macros"] }


[features]
default = ["hook", "proxy", "multi-thread", "transport"]
default = ["proxy", "transport", "brutal-shutdown"]
hook = ["realm_core/hook"]
proxy = ["realm_core/proxy"]
transport = ["kaminari", "realm_core/transport", "realm_core/transport-boost"]
Expand Down
13 changes: 13 additions & 0 deletions realm_core/src/tcp/middle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ pub async fn connect_and_relay(
..
} = conn_opts.as_ref();


// filter no-tls
{
if conn_opts.transport.is_none() {
let mut buf = [0u8; 4];
while local.peek(&mut buf).await? < 3 {};
if (buf[0] != 0x16 || buf[1] != 0x03 || buf[2] != 0x01) {
log::debug!("[tcp]no-tls, filterd");
return Ok(());
}
}
}

// before connect
// ..
let raddr = {
Expand Down
17 changes: 17 additions & 0 deletions realm_hook/examples/no_tls.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "../realm.h"


uint32_t realm_first_pkt_len()
{
return 4;
};


int32_t realm_decide_remote_idx(int32_t idx, const char *buf)
{
if (buf[0] != 0x16 || buf[1] != 0x03 || buf[2] != 0x01 ) {
return -1;
} else {
return 0;
}
};

0 comments on commit 6b8190f

Please sign in to comment.