-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from synfinatic/startup
Add startup scripts for pfSense & UDM/UDMPro & Docker
- Loading branch information
Showing
11 changed files
with
150 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
FROM golang:1.15.5-alpine3.12 as builder | ||
|
||
ARG VERSION | ||
|
||
# base applications | ||
RUN apk add --update git build-base libpcap libpcap-dev && \ | ||
mkdir udp-proxy-2020 | ||
COPY . udp-proxy-2020/ | ||
|
||
RUN cd udp-proxy-2020 && \ | ||
DOCKER_VERSION=${VERSION} make .docker && \ | ||
mkdir -p /usr/local/bin && \ | ||
cp dist/udp-proxy-2020 /usr/local/bin/udp-proxy-2020 | ||
|
||
FROM alpine:3.12 | ||
RUN apk add --update libpcap && \ | ||
mkdir -p /usr/local/bin | ||
COPY --from=builder /usr/local/bin/udp-proxy-2020 /usr/local/bin/ | ||
|
||
ENV PORTS=9003 | ||
ENV INTERFACES="" | ||
ENV TIMEOUT=250 | ||
ENV CACHETTL=90 | ||
ENV EXTRA_ARGS="" | ||
CMD /usr/local/bin/udp-proxy-2020 --port ${PORTS} --interface ${INTERFACES} \ | ||
--timeout ${TIMEOUT} --cachettl ${CACHETTL} ${EXTRA_ARGS} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Docker | ||
|
||
Just edit `docker-compose.yaml` and modify the environment variables as necessary | ||
and then run `docker-compose up` to start! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: '3.3' | ||
services: | ||
udp-proxy-2020: | ||
image: synfinatic/udp-proxy-2020:latest | ||
environment: | ||
- PORTS=9003 | ||
- INTERFACES=eth0,eth1 | ||
- EXTRA_ARGS="--debug" | ||
- TIMEOUT=250 | ||
- CACHETTL=90 | ||
restart: always | ||
network_mode: host |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Startup Scripts | ||
|
||
Since UDP Proxy 2020 tends to run on non-standard hardware (firewalls mostly) | ||
I'm creating a collection of startup scripts for different platforms to | ||
make it easier to auto-start the program on boot. | ||
|
||
* [pfSense](pfSense) - Used for pfSense and probably many BSD-based operating systems | ||
* [Ubiquiti Dream Machine/Dream Machine Pro](https://github.com/boostchicken/udm-utilities) - Use UDM Utilities | ||
* [Docker](Docker) - Use [Docker Compose](https://docs.docker.com/compose/) to run udp-proxy-2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# pfSense/BSD startup scripts | ||
|
||
## Configuration | ||
|
||
1. Edit `etc/local/etc/udp-proxy-2020.conf` as necessary | ||
1. Copy files to the directories on your pfSense/BSD box | ||
1. Edit `/etc/rc.conf.local` and add the line `udp_proxy_2020_enable=YES` | ||
1. Copy udp-proxy-2020 binary to `/usr/local/etc/bin/udp-proxy-2020` | ||
|
||
## Run | ||
|
||
Execute `/usr/local/etc/rc.d/udp-proxy-2020 start` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
udp_proxy_2020_enable=YES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/sh | ||
# | ||
# $FreeBSD$ | ||
# | ||
# PROVIDE: udp-proxy-2020 | ||
# REQUIRE: DAEMON NETWORKING | ||
# | ||
# Add the following lines to /etc/rc.conf.local to enable UDP Proxy 2020 | ||
# | ||
# udp_proxy_2020_enable="YES" | ||
# | ||
|
||
. /etc/rc.subr | ||
. /usr/local/etc/udp-proxy-2020.conf | ||
|
||
name=udp-proxy-2020 | ||
rcvar=udp_proxy_2020_enable | ||
pidfile=/var/run/udp-proxy-2020.pid | ||
|
||
extra_commands="status cleanup" | ||
start_cmd="${name}_start" | ||
stop_cmd="${name}_stop" | ||
status_cmd="${name}_status" | ||
cleanup_cmd="${name}_cleanup" | ||
|
||
load_rc_config ${name} | ||
: ${udp_proxy_2020_enable:=no} | ||
|
||
|
||
udp-proxy-2020_start() { | ||
/usr/sbin/daemon -cf -p ${pidfile} /usr/local/bin/udp-proxy-2020 ${udp_vars} | ||
} | ||
|
||
udp-proxy-2020_stop() { | ||
[ -f ${pidfile} ] && kill `cat ${pidfile}` || echo "Unable to kill ${name}. Missing pid file?" | ||
} | ||
|
||
udp-proxy-2020_cleanup() { | ||
[ -f ${pidfile} ] && rm ${pidfile} | ||
} | ||
|
||
udp-proxy-2020_status() { | ||
[ ! -n "`pgrep -F $(pidfile)`" ] | ||
} | ||
|
||
run_rc_command "$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# change the port and add --dev {dev-name} as many times as needed. | ||
udp_vars="--port 9003 --interface lagg0,lagg0.200,lagg0.400,ovpns2" |