Skip to content

Commit

Permalink
add internal rtl_tcp
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatel3001 committed Apr 2, 2024
1 parent 5e2eb5d commit cba2827
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 12 deletions.
10 changes: 7 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:rtlsdr

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

Expand Down Expand Up @@ -28,8 +28,12 @@ RUN set -x && \

COPY rootfs/ /

ENV SRC_ADDR="" \
ENV SRC_ADDR="127.0.0.1" \
SRC_PORT="1234" \
SINK_ADDR="0.0.0.0" \
RW_SINK_PORT="7373" \
RO_SINK_PORT="7374"
RO_SINK_PORT="7374" \
GAIN="0" \
FREQ="1545600550" \
RATE="1536000" \
SERIAL="00001542"
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ This container is a thin wrapper around [rpatel3001/rtlmuxer](https://github.com

| Variable | Description | Default |
|----------|-------------|---------|
| `SRC_ADDR` | Address of the rtl_tcp source we are proxying. | Unset |
| `SRC_PORT` | Port of the rtl_tcp source we are proxying. | 1234 |
| `SINK_ADDR` | Address to bind for the proxied connections. | 0.0.0.0 |
| `RW_SINK_PORT` | Port to bind for the read/write proxy connection. | 7373 |
| `RO_SINK_PORT` | Port to bind for the read-only proxy connection. | 7374 |
| `SRC_ADDR` | Address of the rtl_tcp source we are proxying. | 127.0.0.1 |
| `SRC_PORT` | Port of the rtl_tcp source we are proxying. | 1234 |
| `SINK_ADDR` | Address to bind for the proxied connections. | 0.0.0.0 |
| `RW_SINK_PORT` | Port to bind for the read/write proxy connection. | 7373 |
| `RO_SINK_PORT` | Port to bind for the read-only proxy connection. | 7374 |
| `RTL_TCP` | Set to any value to run RTL_TCP inside the container. | Unset |
| `GAIN` | Initial gain when using RTL_TCP. | 0 |
| `FREQ` | Initial frequency when using RTL_TCP. | 1545600550 |
| `RATE` | Initial sample rate when using RTL_TCP. | 1536000 |
| `SERIAL` | Serial or device index for RTL_TCP. | 00001542 |
8 changes: 8 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/rtl_tcp/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/command/with-contenv bash
#shellcheck shell=bash

if [[ -n "${RTL_TCP}" ]]; then
exec rtl_tcp -a 0.0.0.0 -p $SRC_PORT -f $FREQ -g $GAIN -s $RATE -d $SERIAL 2>&1 | stdbuf -o0 awk '{print "[rtlmuxer] " strftime("%Y/%m/%d %H:%M:%S", systime()) " " $0}'
else
exec sleep 86400
fi
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/rtl_tcp/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
4 changes: 4 additions & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/rtlmuxer/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/command/with-contenv bash
#shellcheck shell=bash

exec rtlmuxer --src-address=$SRC_ADDR --src-port=$SRC_PORT --sink-bind-address=$SINK_ADDR --sink-bind-port-a=$RW_SINK_PORT --sink-bind-port-b=$RO_SINK_PORT 2>&1 | stdbuf -o0 awk '{print "[rtlmuxer] " strftime("%Y/%m/%d %H:%M:%S", systime()) " " $0}'
1 change: 1 addition & 0 deletions rootfs/etc/s6-overlay/s6-rc.d/rtlmuxer/type
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
longrun
Empty file.
Empty file.
4 changes: 0 additions & 4 deletions rootfs/etc/services.d/rtlmuxer/run

This file was deleted.

0 comments on commit cba2827

Please sign in to comment.