Skip to content

Commit deea758

Browse files
authored
chore: Move TLS library to vector-core (#13913)
This reduces the knot of feature flag dependencies for a relatively small but core library. Basically, I was trying to run one of the unit tests with minimal flags, but gave up trying to figure out all of the needed "utils" flags I needed to run the test. This is the fruit of that frustration as it removes a number of those flags.
1 parent d8fd8b8 commit deea758

File tree

19 files changed

+151
-194
lines changed

19 files changed

+151
-194
lines changed

Cargo.lock

+6-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+12-19
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,8 @@ heim = { git = "https://github.com/vectordotdev/heim.git", branch="update-nix",
312312
mlua = { version = "0.8.3", default-features = false, features = ["lua54", "send", "vendored"], optional = true }
313313

314314
[target.'cfg(windows)'.dependencies]
315-
schannel = "0.1.20"
316315
windows-service = "0.5.0"
317316

318-
[target.'cfg(target_os = "macos")'.dependencies]
319-
security-framework = "2.7.0"
320-
321317
[target.'cfg(unix)'.dependencies]
322318
atty = { version = "0.2.14", default-features = false }
323319
nix = { version = "0.25.0", default-features = false, features = ["socket", "signal"] }
@@ -487,18 +483,18 @@ sources-metrics = [
487483

488484
sources-apache_metrics = []
489485
sources-aws_ecs_metrics = []
490-
sources-aws_kinesis_firehose = ["dep:base64", "dep:infer", "sources-utils-tls"]
486+
sources-aws_kinesis_firehose = ["dep:base64", "dep:infer"]
491487
sources-aws_s3 = ["aws-core", "dep:aws-sdk-sqs", "dep:aws-sdk-s3", "dep:semver", "dep:async-compression", "sources-aws_sqs", "tokio-util/io"]
492488
sources-aws_sqs = ["aws-core", "dep:aws-sdk-sqs"]
493-
sources-datadog_agent = ["sources-utils-tls", "sources-utils-http-error", "protobuf-build"]
489+
sources-datadog_agent = ["sources-utils-http-error", "protobuf-build"]
494490
sources-demo_logs = ["dep:fakedata"]
495491
sources-dnstap = ["dep:base64", "dep:trust-dns-proto", "dep:dnsmsg-parser", "protobuf-build"]
496492
sources-docker_logs = ["docker"]
497493
sources-eventstoredb_metrics = []
498494
sources-exec = []
499495
sources-file = ["dep:file-source"]
500496
sources-file-descriptor = ["tokio-util/io"]
501-
sources-fluent = ["dep:base64", "listenfd", "tokio-util/net", "dep:rmpv", "dep:rmp-serde", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls", "dep:serde_bytes"]
497+
sources-fluent = ["dep:base64", "listenfd", "tokio-util/net", "dep:rmpv", "dep:rmp-serde", "dep:serde_bytes"]
502498
sources-gcp_pubsub = ["gcp", "dep:h2", "dep:prost-types", "protobuf-build", "dep:tonic"]
503499
sources-heroku_logs = ["sources-utils-http", "sources-utils-http-query", "sources-http"]
504500
sources-host_metrics = ["dep:heim"]
@@ -508,31 +504,28 @@ sources-internal_metrics = []
508504
sources-journald = []
509505
sources-kafka = ["dep:rdkafka"]
510506
sources-kubernetes_logs = ["dep:file-source", "kubernetes", "transforms-reduce"]
511-
sources-logstash = ["listenfd", "tokio-util/net", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls"]
507+
sources-logstash = ["listenfd", "tokio-util/net"]
512508
sources-mongodb_metrics = ["dep:mongodb"]
513509
sources-nats = ["dep:nats", "dep:nkeys"]
514510
sources-nginx_metrics = ["dep:nom"]
515511
sources-opentelemetry = ["dep:hex", "dep:opentelemetry-proto", "dep:prost-types", "sources-http", "sources-utils-http", "sources-vector"]
516512
sources-postgresql_metrics = ["dep:postgres-openssl", "dep:tokio-postgres"]
517513
sources-prometheus = ["dep:prometheus-parser", "sinks-prometheus", "sources-http", "sources-utils-http"]
518514
sources-redis= ["dep:redis"]
519-
sources-socket = ["listenfd", "tokio-util/net", "sources-utils-udp", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls", "sources-utils-unix"]
520-
sources-splunk_hec = ["sources-utils-tls", "dep:roaring"]
521-
sources-statsd = ["listenfd", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls", "sources-utils-udp", "sources-utils-unix", "tokio-util/net"]
515+
sources-socket = ["listenfd", "tokio-util/net", "sources-utils-udp", "sources-utils-unix"]
516+
sources-splunk_hec = ["dep:roaring"]
517+
sources-statsd = ["listenfd", "sources-utils-udp", "sources-utils-unix", "tokio-util/net"]
522518
sources-stdin = ["tokio-util/io"]
523-
sources-syslog = ["listenfd", "tokio-util/net", "sources-utils-udp", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls", "sources-utils-unix", "codecs/syslog"]
524-
sources-utils-http = ["dep:snap", "sources-utils-tls", "sources-utils-http-auth", "sources-utils-http-encoding", "sources-utils-http-error", "sources-utils-http-prelude"]
519+
sources-syslog = ["listenfd", "tokio-util/net", "sources-utils-udp", "sources-utils-unix", "codecs/syslog"]
520+
sources-utils-http = ["dep:snap", "sources-utils-http-auth", "sources-utils-http-encoding", "sources-utils-http-error", "sources-utils-http-prelude"]
525521
sources-utils-http-auth = ["sources-utils-http-error"]
526522
sources-utils-http-encoding = ["dep:snap", "sources-utils-http-error"]
527523
sources-utils-http-error = []
528-
sources-utils-http-prelude = ["sources-utils-http", "sources-utils-tls", "sources-utils-http-auth", "sources-utils-http-encoding", "sources-utils-http-error"]
524+
sources-utils-http-prelude = ["sources-utils-http", "sources-utils-http-auth", "sources-utils-http-encoding", "sources-utils-http-error"]
529525
sources-utils-http-query = []
530-
sources-utils-tcp-keepalive = []
531-
sources-utils-tcp-socket = []
532-
sources-utils-tls = []
533526
sources-utils-udp = []
534527
sources-utils-unix = []
535-
sources-vector = ["listenfd", "sources-utils-tcp-keepalive", "sources-utils-tcp-socket", "sources-utils-tls", "dep:tonic", "protobuf-build"]
528+
sources-vector = ["listenfd", "dep:tonic", "protobuf-build"]
536529

537530
# Transforms
538531
transforms = ["transforms-logs", "transforms-metrics"]
@@ -669,7 +662,7 @@ sinks-nats = ["dep:nats", "dep:nkeys"]
669662
sinks-new_relic_logs = ["sinks-http"]
670663
sinks-new_relic = []
671664
sinks-papertrail = ["dep:syslog"]
672-
sinks-prometheus = ["dep:prometheus-parser", "dep:snap", "sources-utils-tls", "dep:serde_with"]
665+
sinks-prometheus = ["dep:prometheus-parser", "dep:snap", "dep:serde_with"]
673666
sinks-pulsar = ["dep:avro-rs", "dep:pulsar"]
674667
sinks-redis = ["dep:redis"]
675668
sinks-sematext = ["sinks-elasticsearch", "sinks-influxdb"]

lib/vector-core/Cargo.toml

+11-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ metrics-util = { version = "0.14.0", default-features = false, features = ["regi
3030
mlua = { version = "0.8.3", default-features = false, features = ["lua54", "send", "vendored"], optional = true }
3131
no-proxy = { version = "0.3.2", default-features = false, features = ["serialize"] }
3232
once_cell = { version = "1.13", default-features = false }
33+
openssl = { version = "0.10.41", default-features = false, features = ["vendored"] }
3334
ordered-float = { version = "3.0.0", default-features = false }
3435
pin-project = { version = "1.0.12", default-features = false }
3536
proptest = { version = "1.0", optional = true }
@@ -40,10 +41,13 @@ regex = { version = "1.6.0", default-features = false, features = ["std", "perf"
4041
serde = { version = "1.0.144", default-features = false, features = ["derive", "rc"] }
4142
serde_json = { version = "1.0.85", default-features = false }
4243
snafu = { version = "0.7.1", default-features = false }
43-
tokio = { version = "1.20.1", default-features = false }
44+
socket2 = { version = "0.4.4", default-features = false }
45+
tokio = { version = "1.20.1", default-features = false, features = ["net"] }
46+
tokio-openssl = { version = "0.6.3", default-features = false }
4447
tokio-stream = { version = "0.1", default-features = false, features = ["time"], optional = true }
4548
tokio-util = { version = "0.7.0", default-features = false, features = ["time"] }
4649
toml = { version = "0.5.9", default-features = false }
50+
tonic = { version = "0.7.2", default-features = false, features = ["transport"] }
4751
tower = { version = "0.4", default-features = false, features = ["util"] }
4852
tracing = { version = "0.1.34", default-features = false }
4953
tracing-core = { version = "0.1.26", default-features = false }
@@ -61,6 +65,12 @@ vector-config-macros = { path = "../vector-config-macros" }
6165
# https://doc.rust-lang.org/cargo/reference/unstable.html#namespaced-features
6266
vrl-lib = { package = "vrl", path = "../vrl/vrl", optional = true }
6367

68+
[target.'cfg(target_os = "macos")'.dependencies]
69+
security-framework = "2.7.0"
70+
71+
[target.'cfg(windows)'.dependencies]
72+
schannel = "0.1.20"
73+
6474
[build-dependencies]
6575
prost-build = "0.10.4"
6676

lib/vector-core/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@ pub mod serde;
3737
pub mod sink;
3838
pub mod source;
3939
pub mod stream;
40+
pub mod tcp;
4041
#[cfg(test)]
4142
mod test_util;
4243
pub mod time;
44+
pub mod tls;
4345
pub mod transform;
4446
#[cfg(feature = "vrl")]
4547
mod vrl;

src/tcp.rs lib/vector-core/src/tcp.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use vector_config::configurable_component;
88
#[serde(deny_unknown_fields)]
99
pub struct TcpKeepaliveConfig {
1010
/// The time to wait, in seconds, before starting to send TCP keepalive probes on an idle connection.
11-
pub(crate) time_secs: Option<u64>,
11+
pub time_secs: Option<u64>,
1212
}
1313

1414
// This function will be obsolete after tokio/mio internally use `socket2` and expose the methods to

0 commit comments

Comments
 (0)