Skip to content

Commit

Permalink
Update proxer-cli to version 0.3.3 and enhance connection handling
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
doroved committed Dec 18, 2024
1 parent 105eb17 commit 223796c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proxer-cli"
version = "0.3.2"
version = "0.3.3"
edition = "2021"
authors = ["doroved"]
description = "Proxy TCP traffic on macOS with domain filtering."
Expand Down
13 changes: 7 additions & 6 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,18 @@ pub struct ProxyConfig {
}

pub async fn run() -> Result<(), Box<dyn std::error::Error>> {
// Close all proxer-cli processes
terminate_proxer();

// Parse command-line options
let options = Opt::parse();

tracing::info!(
"Default open connection limit: {:?}",
rlimit::Resource::NOFILE.get_soft()?
);

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

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

// Close all proxer-cli processes
terminate_proxer();

// Parse command-line options
let options = Opt::parse();

// Read the config file or use the default one
let config_path = options.config.unwrap_or_else(|| {
tracing::info!("Using default config file ~/.proxer-cli/config.json5");
Expand Down

0 comments on commit 223796c

Please sign in to comment.