Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
rpatel3001 committed May 28, 2022
1 parent edd9e25 commit 5e2eb5d
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build and deploy to ghcr.io

on:
workflow_dispatch:
inputs:
reason:
required: true
description: 'Reason for running this workflow'
push:
branches:
- master
paths-ignore:
- '**.md'

jobs:
build:
name: 'Build'
runs-on: ubuntu-latest
steps:
- name: "Build:checkout"
uses: actions/checkout@v3

- name: "Build:qemu"
uses: docker/setup-qemu-action@v2

- name: "Build:buildx"
uses: docker/setup-buildx-action@v2

- name: "Build:login"
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 'Build:buildandpush'
uses: docker/build-push-action@v3.0.0
with:
push: true
platforms: linux/amd64,linux/arm/v7,linux/arm64
tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${{ github.run_number }}-${{ github.sha }}
35 changes: 35 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
FROM ghcr.io/sdr-enthusiasts/docker-baseimage:base

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

# hadolint ignore=DL3008,SC2086,DL4006,SC2039
RUN set -x && \
TEMP_PACKAGES=() && \
KEPT_PACKAGES=() && \
# packages needed to install
TEMP_PACKAGES+=(git) && \
# packages needed to build
TEMP_PACKAGES+=(build-essential) && \
# install packages
apt-get update && \
apt-get install -y --no-install-recommends \
"${KEPT_PACKAGES[@]}" \
"${TEMP_PACKAGES[@]}" && \
# Deploy rtlmuxer
git clone https://github.com/rpatel3001/rtlmuxer.git /src/rtlmuxer && \
pushd /src/rtlmuxer && \
make && \
cp rtlmuxer /usr/local/bin && \
popd && \
# Clean up
apt-get remove -y "${TEMP_PACKAGES[@]}" && \
apt-get autoremove -y && \
rm -rf /src/* /tmp/* /var/lib/apt/lists/*

COPY rootfs/ /

ENV SRC_ADDR="" \
SRC_PORT="1234" \
SINK_ADDR="0.0.0.0" \
RW_SINK_PORT="7373" \
RO_SINK_PORT="7374"
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# docker-rtlmuxer
Proxy rtl_tcp compatible streams to allow for multiple clients.

This container is a thin wrapper around [rpatel3001/rtlmuxer](https://github.com/rpatel3001/rtlmuxer), which is a slightly modified fork of [alexander-sholohov/rtlmuxer](https://github.com/alexander-sholohov/rtlmuxer).

## Docker Compose Snippet

```
rtlmuxer:
container_name: rtlmuxer
hostname: rtlmuxer
image: ghcr.io/rpatel3001/docker-rtlmuxer
restart: always
ports:
- 7373:7373
- 7374:7374
volumes:
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- SRC_ADDR=x.x.x.x
```

## Configuration options

| 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 |
4 changes: 4 additions & 0 deletions rootfs/etc/services.d/rtlmuxer/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/with-contenv bash
#shellcheck shell=bash

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}'

0 comments on commit 5e2eb5d

Please sign in to comment.