Skip to content

Commit fd199f8

Browse files
author
e1732a364fed
committed
extract recorder to seperate crate in crates/
1 parent a89dc95 commit fd199f8

File tree

9 files changed

+66
-48
lines changed

9 files changed

+66
-48
lines changed

Cargo.lock

Lines changed: 20 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ members = [
2525
"crates/ruci-cmd",
2626
"crates/ruci-rustls22",
2727
"crates/ruci-rustls21",
28+
"crates/ruci-recorder",
2829
]
2930

3031
[workspace.dependencies]
@@ -60,6 +61,8 @@ reqwest = { version = "0.12", default-features = false, features = [
6061
] }
6162

6263
toml = "0.8"
64+
chrono = { version = "0.4", features = ["serde"] }
65+
serde_json = "1.0"
6366

6467

6568
[dependencies]

crates/ruci-recorder/Cargo.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[package]
2+
name = "ruci-recorder"
3+
version = "0.0.1"
4+
edition = "2021"
5+
license = "MIT OR Apache-2.0"
6+
7+
[dependencies]
8+
ruci = { path = "../.." }
9+
macro_map = { path = "../macro_map" }
10+
tracing = { workspace = true }
11+
anyhow = { workspace = true }
12+
async-trait = { workspace = true }
13+
serde = { workspace = true }
14+
serde_json = { workspace = true }
15+
tokio = { workspace = true }
16+
chrono = { workspace = true }
17+
futures = { workspace = true }
18+
pin-project = { workspace = true }
19+
20+
serde_cbor = { version = "0.11" }
21+
har = { version = "0.8.1" }
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ impl From<InfoData> for har::Har {
728728
log: har::Spec::V1_2(har::v1_2::Log {
729729
creator: har::v1_2::Creator {
730730
name: "ruci".to_string(),
731-
version: crate::VERSION.to_string(),
731+
version: ruci::VERSION.to_string(),
732732
comment: None,
733733
},
734734

rucimp/Cargo.toml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ edition = "2021"
66
[dependencies]
77
ruci = { path = ".." }
88
macro_map = { path = "../crates/macro_map" }
9+
ruci-recorder = { path = "../crates/ruci-recorder" }
910
ruci-rustls22 = { path = "../crates/ruci-rustls22" }
1011
ruci-rustls21 = { path = "../crates/ruci-rustls21", optional = true }
1112
user_trait = { workspace = true }
@@ -32,10 +33,9 @@ utoipa = { workspace = true, optional = true }
3233
reqwest = { workspace = true }
3334
utoipa-swagger-ui = { version = "9", optional = true, features = ["axum"] }
3435

35-
chrono = { version = "0.4", features = ["serde"] }
36+
chrono = { workspace = true }
3637

37-
serde_json = "1.0"
38-
serde_cbor = "0.11"
38+
serde_json = { workspace = true }
3939
serde_path_to_error = "0.1"
4040

4141
strum = "0.27"
@@ -47,13 +47,16 @@ base64 = "0.22"
4747
itertools = "0.14"
4848
thiserror = "2"
4949

50-
51-
ipnet = { version = "2" }
52-
iprange = { version = "0.6" }
53-
regex = { version = "1" }
5450
clash_rules = "0.1.19"
5551
geosite-rs = "0.1.6"
5652

53+
54+
http = "1.1"
55+
tokio-tungstenite = "0.21"
56+
h2 = { version = "0.4" }
57+
hpack = "0.3"
58+
59+
5760
mlua = { version = "0.10", features = [
5861
"serialize",
5962
"async",
@@ -72,11 +75,6 @@ rlimit = { version = "0.10", optional = true }
7275
native-tls = { version = "0.2", features = ["alpn"], optional = true }
7376
tokio-native-tls = { version = "0.3", optional = true }
7477

75-
http = "1.1"
76-
tokio-tungstenite = "0.21"
77-
h2 = { version = "0.4" }
78-
hpack = "0.3"
79-
8078

8179
quinn = { version = "0.10", optional = true }
8280

@@ -108,8 +106,6 @@ md5 = "0.7"
108106
zip = "2.2"
109107

110108

111-
har = "0.8.1"
112-
113109
TinyUFO = { version = "0.1", optional = true }
114110

115111

@@ -135,32 +131,29 @@ wiremock = "0.6"
135131

136132
[features]
137133
default = ["sockopt"]
134+
135+
trace = ["ruci/trace"]
136+
138137
steganography = []
139138
api_server = ["axum", "tower-http", "TinyUFO", "utoipa", "utoipa-swagger-ui"]
140139
file_server = ["axum", "tower-http"]
141140

142141
# quic = ["s2n-quic", "s2n-quic-rustls", "ruci-rustls21"]
143142
quinn = ["ruci-rustls21", "dep:quinn"]
144143

145-
trace = ["ruci/trace"]
146144

147145
lua = ["mlua/luau", "serde-lua-table", "rustyline"]
148146
lua54 = ["mlua/lua54", "mlua/vendored", "serde-lua-table", "rustyline"]
149147

150-
# route = ["ipnet", "iprange", "regex"]
151-
152148
sockopt = ["libc", "socket2", "rlimit"]
153149

154150
use-native-tls = ["native-tls", "tokio-native-tls"]
155-
156151
native-tls-vendored = ["native-tls/vendored", "tokio-native-tls/vendored"]
157152

158153

159154
lwip = ["netstack-lwip"]
160155
smoltcp = ["netstack-smoltcp"]
161156

162-
# smoltcp = ["dep:smoltcp", "netstack-smoltcp"]
163-
164157

165158
[[example]]
166159
name = "lua"

rucimp/src/map/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Defines some [`ruci::map::Map`]s.
44

55
pub mod h2;
66
pub mod quic_common;
7-
pub mod recorder;
87
pub mod ws;
98

109
#[cfg(feature = "steganography")]

rucimp/src/map/steganography/embed/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
1515
use tokio::sync::mpsc::{self, Receiver, Sender};
1616
use tracing::{debug, info};
1717

18-
use crate::map::recorder::{PayloadInfo, READ_DIRECTION, WRITE_DIRECTION};
18+
use ruci_recorder::{PayloadInfo, READ_DIRECTION, WRITE_DIRECTION};
1919

2020
pub const WRTIE_IS_STEGO: u8 = 0;
2121
pub const WRTIE_IS_REAL: u8 = 1;
@@ -36,12 +36,12 @@ impl Embedder {
3636
let extension = ext.as_str();
3737

3838
let extension = match extension {
39-
"json" => crate::map::recorder::OutputFileExtension::Json,
40-
"cbor" => crate::map::recorder::OutputFileExtension::Cbor,
39+
"json" => ruci_recorder::OutputFileExtension::Json,
40+
"cbor" => ruci_recorder::OutputFileExtension::Cbor,
4141
_ => anyhow::bail!("invalid file extension: {}", extension),
4242
};
4343

44-
let info_data = crate::map::recorder::InfoData::new(file_content, extension)?;
44+
let info_data = ruci_recorder::InfoData::new(file_content, extension)?;
4545
Ok(Self {
4646
file: Arc::new(info_data.payload),
4747
ext_fields: Default::default(),

rucimp/src/modes/chain/config/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ use ruci::{
4343
use serde::{Deserialize, Serialize};
4444
use tracing::warn;
4545

46-
use crate::{
47-
map::{recorder, ws},
48-
utils::init_tls_server_pem_option,
49-
};
46+
use crate::{map::ws, utils::init_tls_server_pem_option};
5047
use data_source::{DataSource, SyncFolderSource};
5148

5249
#[cfg(feature = "steganography")]
@@ -383,7 +380,7 @@ pub enum InMapConfig {
383380
value: i8,
384381
},
385382
Counter,
386-
Recorder(recorder::Config),
383+
Recorder(ruci_recorder::Config),
387384
TLS(ruci::map::tls_config::ServerOptions),
388385

389386
#[cfg(any(feature = "use-native-tls", feature = "native-tls-vendored"))]
@@ -405,10 +402,9 @@ pub enum InMapConfig {
405402
#[cfg(feature = "quinn")]
406403
Quic(crate::map::quic_common::ServerConfig),
407404

408-
/// tcp/ip stack
405+
// tcp/ip stack
409406
// #[cfg(feature = "smoltcp")]
410407
// Stack2,
411-
412408
#[cfg(feature = "smoltcp")]
413409
StackSmoltcp,
414410
#[cfg(feature = "lwip")]
@@ -446,7 +442,7 @@ pub enum OutMapConfig {
446442
value: i8,
447443
},
448444
Counter,
449-
Recorder(recorder::Config),
445+
Recorder(ruci_recorder::Config),
450446
TLS(ruci::map::tls_config::ClientOptions),
451447

452448
#[cfg(feature = "sockopt")]

0 commit comments

Comments
 (0)