summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Cai2016-07-05 14:17:39 +0800
committerPeter Cai2016-07-05 14:17:39 +0800
commit44d94ebe8c162ff08671b0d02a3c1f4054bea0a1 (patch)
tree814daa414ca5816dac2c210f7f52f3b59ec3fc13
downloadaur-44d94ebe8c162ff08671b0d02a3c1f4054bea0a1.tar.gz
Initial commit
Signed-off-by: Peter Cai <peter@typeblog.net>
-rw-r--r--.SRCINFO22
-rw-r--r--PKGBUILD47
-rw-r--r--config.json18
-rw-r--r--pofwjs.service14
4 files changed, 101 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..df4515b76f06
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,22 @@
+pkgbase = pofwjs
+ pkgdesc = A port forwarding tool implemented in Node.Js
+ pkgver = 1.0.0
+ pkgrel = 1
+ url = https://github.com/PeterCxy/pofw.js
+ arch = i686
+ arch = x86_64
+ license = WTFPL
+ makedepends = npm
+ makedepends = coffee-script
+ depends = nodejs
+ depends = bash
+ backup = etc/pofwjs/config.json
+ source = https://github.com/PeterCxy/pofw.js/archive/1.0.0.tar.gz
+ source = pofwjs.service
+ source = config.json
+ md5sums = df8f2265b71ab048b9ea801c7b907e3c
+ md5sums = 689439125b8cb4266d6a939933b7989d
+ md5sums = edf8fc78149b537cd3d01b22cdb52941
+
+pkgname = pofwjs
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4cef6df04092
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,47 @@
+# Maintainer: Peter Cai <peter at typeblog dot net>
+
+pkgname=pofwjs
+pkgver=1.0.0
+pkgrel=1
+pkgdesc="A port forwarding tool implemented in Node.Js"
+arch=('i686' 'x86_64')
+url="https://github.com/PeterCxy/pofw.js"
+license=('WTFPL')
+depends=(
+ 'nodejs'
+ 'bash'
+)
+makedepends=(
+ 'npm'
+ 'coffee-script'
+)
+backup=(
+ 'etc/pofwjs/config.json'
+)
+
+source=(
+ "https://github.com/PeterCxy/pofw.js/archive/${pkgver}.tar.gz"
+ "pofwjs.service"
+ "config.json"
+)
+md5sums=('df8f2265b71ab048b9ea801c7b907e3c'
+ '689439125b8cb4266d6a939933b7989d'
+ 'edf8fc78149b537cd3d01b22cdb52941')
+
+package() {
+ local _npmdir="$pkgdir/usr/lib/node_modules"
+ mkdir -p "$_npmdir"
+ cp -R "$srcdir/pofw.js-$pkgver" "$_npmdir/pofw.js"
+ local _systemddir="$pkgdir/usr/lib/systemd/system"
+ mkdir -p "$_systemddir"
+ cp pofwjs.service "$_systemddir"
+ local _confdir="$pkgdir/etc/pofwjs"
+ mkdir -p "$_confdir" && chmod 777 "$_confdir"
+ cp config.json "$_confdir"
+ cd "$_npmdir/pofw.js" && npm install --production && npm run prepublish && rm -rf node_modules/.bin
+ rm -rf example
+ local _bindir="$pkgdir/usr/bin"
+ mkdir -p "$_bindir"
+ ln -s /usr/lib/node_modules/pofw.js/bin/pofwjs "$_bindir/pofwjs"
+}
+
diff --git a/config.json b/config.json
new file mode 100644
index 000000000000..d0b57935fd5a
--- /dev/null
+++ b/config.json
@@ -0,0 +1,18 @@
+[
+ {
+ "from_protocol": "tcp",
+ "from_ip": "0.0.0.0",
+ "from_port": "3389",
+ "to_protocol": "tcp",
+ "to_ip": "10.0.0.1",
+ "to_port": "3389"
+ },
+ {
+ "from_protocol": "udp",
+ "from_ip": "0.0.0.0",
+ "from_port": "5353",
+ "to_protocol": "udp6",
+ "to_ip": "2001:4860:4860::8888",
+ "to_port": "53"
+ }
+]
diff --git a/pofwjs.service b/pofwjs.service
new file mode 100644
index 000000000000..2bba70e951be
--- /dev/null
+++ b/pofwjs.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=A port-forwarding program
+After=network.target
+
+[Service]
+User=nobody
+Type=simple
+WorkingDirectory=/etc/pofwjs
+ExecStart=/usr/bin/pofwjs -c /etc/pofwjs/config.json
+KillSignal=SIGINT
+SuccessExitStatus=2
+
+[Install]
+WantedBy=multi-user.target