Skip to content

Commit

Permalink
Add in ability to disable service types in an easier way then before
Browse files Browse the repository at this point in the history
  • Loading branch information
fredclausen committed Sep 16, 2024
1 parent 3a0f96e commit 68e39a3
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 200 deletions.
6 changes: 3 additions & 3 deletions 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
Expand Up @@ -9,7 +9,7 @@ resolver = "2"

[workspace.package]
edition = "2021"
version = "1.1.0"
version = "1.2.0"
authors = ["Fred Clausen", "Mike Nye", "Alex Austin"]
description = "ACARS Router: A Utility to ingest ACARS/VDLM2/HFDL from many sources, process, and feed out to many consumers."
documentation = "https://github.com/sdr-enthusiasts/acars_router"
Expand Down
83 changes: 43 additions & 40 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base

ENV AR_LISTEN_UDP_ACARS=5550 \
AR_LISTEN_TCP_ACARS=5550 \
AR_LISTEN_UDP_VDLM2=5555 \
AR_LISTEN_TCP_VDLM2=5555 \
AR_LISTEN_UDP_HFDL=5556 \
AR_LISTEN_TCP_HFDL=5556 \
AR_LISTEN_ZMQ_ACARS=35550 \
AR_LISTEN_ZMQ_VDLM2=35555 \
AR_LISTEN_ZMQ_HFDL=35556 \
AR_SERVE_TCP_ACARS=15550 \
AR_SERVE_TCP_VDLM2=15555 \
AR_SERVE_TCP_HFDL=15556 \
AR_SERVE_ZMQ_ACARS=45550 \
AR_SERVE_ZMQ_VDLM2=45555 \
AR_SERVE_ZMQ_HFDL=45556 \
AR_ADD_PROXY_ID=true
AR_LISTEN_TCP_ACARS=5550 \
AR_LISTEN_UDP_VDLM2=5555 \
AR_LISTEN_TCP_VDLM2=5555 \
AR_LISTEN_UDP_HFDL=5556 \
AR_LISTEN_TCP_HFDL=5556 \
AR_LISTEN_ZMQ_ACARS=35550 \
AR_LISTEN_ZMQ_VDLM2=35555 \
AR_LISTEN_ZMQ_HFDL=35556 \
AR_SERVE_TCP_ACARS=15550 \
AR_SERVE_TCP_VDLM2=15555 \
AR_SERVE_TCP_HFDL=15556 \
AR_SERVE_ZMQ_ACARS=45550 \
AR_SERVE_ZMQ_VDLM2=45555 \
AR_SERVE_ZMQ_HFDL=45556 \
AR_ADD_PROXY_ID=true \
AR_DISABLE_ACARS=false \
AR_DISABLE_VDLM2=false \
AR_DISABLE_HFDL=false

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY ./rootfs /
Expand All @@ -25,28 +28,28 @@ COPY ./bin/acars_router.amd64/acars_router /opt/acars_router.amd64

# hadolint ignore=DL3008,DL3003,SC1091
RUN set -x && \
KEPT_PACKAGES=() && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES+=(libzmq5) && \
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}"\
&& \
# ensure binaries are executable
chmod -v a+x \
/opt/acars_router.armv7 \
/opt/acars_router.arm64 \
/opt/acars_router.amd64 \
&& \
# remove foreign architecture binaries
/rename_current_arch_binary.sh && \
rm -fv \
/opt/acars_router.* \
&& \
# clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -y && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/* && \
# test
/opt/acars_router --version
KEPT_PACKAGES=() && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES+=(libzmq5) && \
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}"\
&& \
# ensure binaries are executable
chmod -v a+x \
/opt/acars_router.armv7 \
/opt/acars_router.arm64 \
/opt/acars_router.amd64 \
&& \
# remove foreign architecture binaries
/rename_current_arch_binary.sh && \
rm -fv \
/opt/acars_router.* \
&& \
# clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -y && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/* && \
# test
/opt/acars_router --version
5 changes: 4 additions & 1 deletion Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ ENV AR_LISTEN_UDP_ACARS=5550 \
AR_SERVE_ZMQ_ACARS=45550 \
AR_SERVE_ZMQ_VDLM2=45555 \
AR_SERVE_ZMQ_HFDL=45556 \
AR_ADD_PROXY_ID=true
AR_ADD_PROXY_ID=true \
AR_DISABLE_ACARS=false \
AR_DISABLE_VDLM2=false \
AR_DISABLE_HFDL=false

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
COPY rootfs /
Expand Down
31 changes: 17 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,20 +105,20 @@ The nomenclature for the environment variables is as follows:

### Outbound data

| Env Variable | Command Line Switch | Default | Description |
| ------------------ | ------------------- | ------- | ---------------------------------------- |
| AR_SEND_UDP_ACARS | --send-udp-acars | `unset` | UDP host:port to send ACARS messages to |
| AR_SEND_UDP_VDLM2 | --send-udp-vdlm2 | `unset` | UDP host:port to send VDLM2 messages to |
| AR_SEND_UDP_HFDL | --send-udp-hfdl | `unset` | UDP host:port to send HFDL messages to |
| AR_SEND_TCP_ACARS | --send-tcp-acars | `unset` | TCP host:port to send ACARS messages to |
| AR_SEND_TCP_VDLM2 | --send-tcp-vdlm2 | `unset` | TCP host:port to send VDLM2 messages to |
| AR_SEND_TCP_HFDL | --send-tcp-hfdl | `unset` | TCP host:port to send HFDL messages to |
| AR_SERVE_TCP_ACARS | --serve-tcp-acars | `15550` | TCP port to serve ACARS messages to |
| AR_SERVE_TCP_VDLM2 | --serve-tcp-vdlm2 | `15555` | TCP port to serve VDLM2 messages to |
| AR_SERVE_TCP_HFDL | --serve-tcp-hfdl | `15556` | TCP port to serve HFDL messages to |
| AR_SERVE_ZMQ_ACARS | --serve-zmq-acars | `45550` | ZMQ port to serve ACARS messages to |
| AR_SERVE_ZMQ_VDLM2 | --serve-zmq-vdlm2 | `45555` | ZMQ port to serve VDLM2 messages to |
| AR_SERVE_ZMQ_HFDL | --serve-zmq-hfdl | `45556` | ZMQ port to serve HFDL messages to |
| Env Variable | Command Line Switch | Default | Description |
| ------------------ | ------------------- | ------- | --------------------------------------- |
| AR_SEND_UDP_ACARS | --send-udp-acars | `unset` | UDP host:port to send ACARS messages to |
| AR_SEND_UDP_VDLM2 | --send-udp-vdlm2 | `unset` | UDP host:port to send VDLM2 messages to |
| AR_SEND_UDP_HFDL | --send-udp-hfdl | `unset` | UDP host:port to send HFDL messages to |
| AR_SEND_TCP_ACARS | --send-tcp-acars | `unset` | TCP host:port to send ACARS messages to |
| AR_SEND_TCP_VDLM2 | --send-tcp-vdlm2 | `unset` | TCP host:port to send VDLM2 messages to |
| AR_SEND_TCP_HFDL | --send-tcp-hfdl | `unset` | TCP host:port to send HFDL messages to |
| AR_SERVE_TCP_ACARS | --serve-tcp-acars | `15550` | TCP port to serve ACARS messages to |
| AR_SERVE_TCP_VDLM2 | --serve-tcp-vdlm2 | `15555` | TCP port to serve VDLM2 messages to |
| AR_SERVE_TCP_HFDL | --serve-tcp-hfdl | `15556` | TCP port to serve HFDL messages to |
| AR_SERVE_ZMQ_ACARS | --serve-zmq-acars | `45550` | ZMQ port to serve ACARS messages to |
| AR_SERVE_ZMQ_VDLM2 | --serve-zmq-vdlm2 | `45555` | ZMQ port to serve VDLM2 messages to |
| AR_SERVE_ZMQ_HFDL | --serve-zmq-hfdl | `45556` | ZMQ port to serve HFDL messages to |

### Inbound data

Expand Down Expand Up @@ -154,3 +154,6 @@ The nomenclature for the environment variables is as follows:
| AR_STATS_EVERY | --stats-every | `5` | How often to print stats to the log in minutes |
| AR_STATS_VERBOSE | --stats-verbose | `false` | Print verbose stats to the log |
| AR_REASSEMBLY_WINDOW | --reassemble-window | `1.0` | If a message comes in, but part of the message is missing, this value will be used to keep the partial message fragment around while attempting to wait for the second (or subsequent) part(s) |
| AR_DISABLE_ACARS | --disable-acars | `false` | Disable ACARS processing. Valid values are `true` or `false` |
| AR_DISABLE_VDLM2 | --disable-vdlm | `false` | Disable VDLM processing. Valid values are `true` or `false` |
| AR_DISABLE_HFDL | --disable-hfdl | `false` | Disable HFDL processing. Valid values are `true` or `false` |
63 changes: 39 additions & 24 deletions rust/libraries/acars_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ pub struct Input {
default_value = "1.0"
)]
pub reassembly_window: f64,
/// Disable ACARS input
#[clap(long, env = "AR_DISABLE_ACARS", value_parser)]
pub disable_acars: bool,
/// Disable VDLM2 input
#[clap(long, env = "AR_DISABLE_VDLM2", value_parser)]
pub disable_vdlm2: bool,
/// Disable HFDL input
#[clap(long, env = "AR_DISABLE_HFDL", value_parser)]
pub disable_hfdl: bool,

// Input Options

Expand Down Expand Up @@ -215,38 +224,44 @@ impl Input {
debug!("AR_LISTEN_ZMQ_ACARS: {:?}", self.listen_zmq_acars);
debug!("AR_LISTEN_ZMQ_VDLM2: {:?}", self.listen_zmq_vdlm2);
debug!("AR_LISTEN_ZMQ_HFDL: {:?}", self.listen_zmq_hfdl);
debug!("AR_DISABLE_ACARS: {:?}", self.disable_acars);
debug!("AR_DISABLE_VDLM2: {:?}", self.disable_vdlm2);
debug!("AR_DISABLE_HFDL: {:?}", self.disable_hfdl);
}

pub fn acars_configured(&self) -> bool {
self.receive_tcp_acars.is_some()
|| self.listen_udp_acars.is_some()
|| self.listen_tcp_acars.is_some()
|| self.receive_zmq_acars.is_some()
|| self.send_udp_acars.is_some()
|| self.send_tcp_acars.is_some()
|| self.serve_tcp_acars.is_some()
|| self.serve_zmq_acars.is_some()
!self.disable_acars
&& (self.receive_tcp_acars.is_some()
|| self.listen_udp_acars.is_some()
|| self.listen_tcp_acars.is_some()
|| self.receive_zmq_acars.is_some()
|| self.send_udp_acars.is_some()
|| self.send_tcp_acars.is_some()
|| self.serve_tcp_acars.is_some()
|| self.serve_zmq_acars.is_some())
}

pub fn vdlm_configured(&self) -> bool {
self.receive_tcp_vdlm2.is_some()
|| self.listen_udp_vdlm2.is_some()
|| self.listen_tcp_vdlm2.is_some()
|| self.receive_zmq_vdlm2.is_some()
|| self.send_udp_vdlm2.is_some()
|| self.send_tcp_vdlm2.is_some()
|| self.serve_tcp_vdlm2.is_some()
|| self.serve_zmq_vdlm2.is_some()
!self.disable_vdlm2
&& (self.receive_tcp_vdlm2.is_some()
|| self.listen_udp_vdlm2.is_some()
|| self.listen_tcp_vdlm2.is_some()
|| self.receive_zmq_vdlm2.is_some()
|| self.send_udp_vdlm2.is_some()
|| self.send_tcp_vdlm2.is_some()
|| self.serve_tcp_vdlm2.is_some()
|| self.serve_zmq_vdlm2.is_some())
}

pub fn hfdl_configured(&self) -> bool {
self.receive_tcp_hfdl.is_some()
|| self.listen_udp_hfdl.is_some()
|| self.listen_tcp_hfdl.is_some()
|| self.receive_zmq_hfdl.is_some()
|| self.send_udp_hfdl.is_some()
|| self.send_tcp_hfdl.is_some()
|| self.serve_tcp_hfdl.is_some()
|| self.serve_zmq_hfdl.is_some()
!self.disable_hfdl
&& (self.receive_tcp_hfdl.is_some()
|| self.listen_udp_hfdl.is_some()
|| self.listen_tcp_hfdl.is_some()
|| self.receive_zmq_hfdl.is_some()
|| self.send_udp_hfdl.is_some()
|| self.send_tcp_hfdl.is_some()
|| self.serve_tcp_hfdl.is_some()
|| self.serve_zmq_hfdl.is_some())
}
}
Loading

0 comments on commit 68e39a3

Please sign in to comment.