Skip to content

Commit 223796c

Browse files
committed
Update proxer-cli to version 0.3.3 and enhance connection handling
- Bump version of `proxer-cli` in `Cargo.toml` and `Cargo.lock` from 0.3.2 to 0.3.3. - Refactor connection handling in `src/server/mod.rs` by moving the termination of proxer-cli processes and command-line options parsing to the beginning of the `run` function for improved clarity and flow.
1 parent 105eb17 commit 223796c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "proxer-cli"
3-
version = "0.3.2"
3+
version = "0.3.3"
44
edition = "2021"
55
authors = ["doroved"]
66
description = "Proxy TCP traffic on macOS with domain filtering."

src/server/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,18 @@ pub struct ProxyConfig {
4242
}
4343

4444
pub async fn run() -> Result<(), Box<dyn std::error::Error>> {
45+
// Close all proxer-cli processes
46+
terminate_proxer();
47+
48+
// Parse command-line options
49+
let options = Opt::parse();
50+
4551
tracing::info!(
4652
"Default open connection limit: {:?}",
4753
rlimit::Resource::NOFILE.get_soft()?
4854
);
4955

56+
// Set open connection limit
5057
let connection_limit = match rlimit::Resource::NOFILE.get() {
5158
Ok(limit) if limit.0 < 1024 * 10 => {
5259
tracing::info!("Setting open connection limit to {}", limit.1);
@@ -61,12 +68,6 @@ pub async fn run() -> Result<(), Box<dyn std::error::Error>> {
6168

6269
let _ = rlimit::setrlimit(rlimit::Resource::NOFILE, connection_limit, rlimit::INFINITY);
6370

64-
// Close all proxer-cli processes
65-
terminate_proxer();
66-
67-
// Parse command-line options
68-
let options = Opt::parse();
69-
7071
// Read the config file or use the default one
7172
let config_path = options.config.unwrap_or_else(|| {
7273
tracing::info!("Using default config file ~/.proxer-cli/config.json5");

0 commit comments

Comments
 (0)