Skip to content

Commit 6754e09

Browse files
committed
Add proxy configuration
1 parent f7d7eb3 commit 6754e09

File tree

10 files changed

+21
-15
lines changed

10 files changed

+21
-15
lines changed

builder_derive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "builder_derive"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <wvvwwvw@gmail.com>"]
55
edition = "2018"
66

core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rollbar-rust"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <andrew@rollbar.com>"]
55
edition = "2018"
66

core/src/configuration.rs

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ pub struct Configuration {
1010
pub code_version: Option<String>,
1111
pub log_level: Level,
1212
pub timeout: u64,
13+
pub proxy: Option<String>,
1314
}
1415

1516
impl Default for Configuration {
@@ -22,6 +23,7 @@ impl Default for Configuration {
2223
code_version: None,
2324
log_level: Level::Info,
2425
timeout: 10,
26+
proxy: None,
2527
}
2628
}
2729
}

core/src/transport.rs

+9-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use std::time::Duration;
66

77
use crate::configuration::Configuration;
88
use crate::types::Item;
9-
use reqwest::Client;
9+
use reqwest::{Client, Proxy};
1010

1111
const QUEUE_DEPTH: usize = 50;
1212

@@ -32,11 +32,15 @@ impl HttpTransport {
3232
let (tx, rx) = sync_channel(QUEUE_DEPTH);
3333
let signal = Arc::new(Condvar::new());
3434
let shutdown = Arc::new(AtomicBool::new(false));
35-
let client = Client::builder()
35+
let client_builder = Client::builder()
3636
.gzip(true)
37-
.timeout(Duration::from_secs(configuration.timeout))
38-
.build()
39-
.unwrap();
37+
.timeout(Duration::from_secs(configuration.timeout));
38+
let client_builder = if let Some(proxy) = &configuration.proxy {
39+
client_builder.proxy(Proxy::all(proxy).unwrap())
40+
} else {
41+
client_builder
42+
};
43+
let client = client_builder.build().unwrap();
4044
#[allow(clippy::mutex_atomic)]
4145
let queue_depth = Arc::new(Mutex::new(0));
4246
let endpoint = configuration.endpoint.clone();

jvm_bare_agent/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rollbar-jvm-agent"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <wvvwwvw@gmail.com>"]
55
edition = "2018"
66

jvm_bare_agent/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ use rollbar_jvm::jvmti::*;
1616
use rollbar_rust::Configuration;
1717
use std::env;
1818
use std::os::raw::{c_char, c_void};
19-
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
19+
use std::sync::atomic::{AtomicBool, Ordering};
2020
use std::sync::Once;
2121

22-
static INIT_SUCCESS: AtomicBool = ATOMIC_BOOL_INIT;
22+
static INIT_SUCCESS: AtomicBool = AtomicBool::new(false);
2323

2424
static mut CONFIG: Option<Configuration> = None;
2525
static INIT: Once = Once::new();

jvm_core/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rollbar-jvm"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <wvvwwvw@gmail.com>"]
55
build = "build.rs"
66
edition = "2018"

jvm_sdk_agent/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rollbar-java-agent"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <wvvwwvw@gmail.com>"]
55
edition = "2018"
66

jvm_sdk_agent/src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use rollbar_jvm::env::JvmTiEnv;
1111
use rollbar_jvm::jni::JniEnv;
1212
use rollbar_jvm::jvmti::{jint, jlocation, jmethodID, jobject, jthread, jvmtiEnv, JNIEnv, JavaVM};
1313
use std::os::raw::{c_char, c_void};
14-
use std::sync::atomic::{AtomicBool, Ordering, ATOMIC_BOOL_INIT};
14+
use std::sync::atomic::{AtomicBool, Ordering};
1515

16-
static INIT_SUCCESS: AtomicBool = ATOMIC_BOOL_INIT;
16+
static INIT_SUCCESS: AtomicBool = AtomicBool::new(false);
1717

1818
/// This is the Agent entry point that is called by the JVM during the loading phase.
1919
/// Any failures in this function will cause the JVM not to start which is strictly

pyagent/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pyagent"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Andrew Weiss <wvvwwvw@gmail.com>"]
55
edition = "2018"
66

0 commit comments

Comments
 (0)