Skip to content

Commit

Permalink
Increase max. no. of file descriptors for cijail-proxy.
Browse files Browse the repository at this point in the history
  • Loading branch information
igankevich committed May 11, 2024
1 parent 6332787 commit ab18d81
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

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

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cijail"
version = "0.6.4"
version = "0.6.5"
edition = "2021"
publish = false

Expand All @@ -21,6 +21,7 @@ passfd = { version = "0.1.6", features = [], default-features = false }
punycode = { version = "0.4.1", features = [], default-features = false }
rcgen = { version = "0.13.1", features = [], default-features = true }
regex = { version = "1.10.4", features = [], default-features = true }
rlimit = { version = "0.10.1", features = [], default-features = false }
socketpair = { version = "0.19.5", features = [], default-features = false }
tempfile = { version = "3.10.1", features = [], default-features = false }
thiserror = { version = "1.0.58", features = [], default-features = false }
Expand Down
8 changes: 8 additions & 0 deletions src/bin/cijail-proxy/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,22 @@ use cijail::SSL_CERT_FILE;
use http_mitm_proxy::futures::StreamExt;
use http_mitm_proxy::MitmProxy;
use hyper::Request;
use log::error;
use log::info;
use rlimit::increase_nofile_limit;
use rlimit::Resource;
use socketpair::SocketpairStream;
use tempfile::NamedTempFile;
use tokio_native_tls::native_tls::TlsConnector;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
Logger::init("cijail-proxy").map_err(|_| "failed to set logger")?;
if let Ok(max_nofile) = Resource::NOFILE.get_hard() {
if let Err(e) = increase_nofile_limit(max_nofile) {
error!("failed to increase NOFILE limit to {}: {}", max_nofile, e);
}
}
let is_dry_run = env_to_bool(CIJAIL_DRY_RUN)?;
let allowed_endpoints: EndpointSet = match std::env::var(CIJAIL_ENDPOINTS) {
Ok(string) => EndpointSet::from_base64(string.as_str())?,
Expand Down

0 comments on commit ab18d81

Please sign in to comment.