diff --git a/README.md b/README.md index 963cbe1..ba30535 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Simple open source self-hosted file sharing solution. * Resumable up- and downloads ([TUS](https://tus.io)) * Set an expire-time for your upload bucket * One-time downloads -* Password protected downloads ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) -* Requires Node >=7.4 +* Requires Node >=7.4 or use `--harmony-async-await` flag +* Password protected download list ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard)) ![Screenshot](https://raw.githubusercontent.com/psi-4ward/psitransfer/master/docs/psitransfer.gif) @@ -84,6 +84,12 @@ Psitransfer uses [debug](https://github.com/visionmedia/debug): DEBUG=psitransfer:* npm start ``` +## Side notes + +* There is no (end-to-end) payload encryption (yet). + +:star2: Contribution is highly welcome :metal: + ## License [BSD](LICENSE) diff --git a/scripts/traffic-limit.sh b/scripts/traffic-limit.sh new file mode 100755 index 0000000..630750c --- /dev/null +++ b/scripts/traffic-limit.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +# Helper script to limit traffic for iface:port +# http://www.codeoriented.com/how-to-limit-network-bandwidth-for-a-specific-tcp-port-on-ubuntu-linux/ +# https://wiki.archlinux.org/index.php/Advanced_traffic_control + +if ! which tc &>/dev/null ; then + 2>&1 echo Error: tc executable not found + 2>&1 echo Please install iproute2 package + exit 1 +fi + +IFACE=$1 +RATE=$3 +PORT=$2 + +if [ -z "$3" ] ; then + echo "Traffic limitter" + echo "Usage: $0 IFACE PORT RATE" + echo + echo "Available interfaces: $(ls -m /sys/class/net)" + echo + echo "Rate units: " + echo " kbps: Kilobytes per Second" + echo " mbps: Megabytes per Second" + echo " gbps: Gigabytes per Second" + echo " off: No rate limit" + echo + echo "Examples:" + echo " $0 wlan0 8080 10kbps" + echo " $0 wlan0 8080 off" + exit 1 +fi + +sudo tc qdisc del root dev $IFACE &>/dev/null || true + +[ "$RATE" = "off" ] && exit + +sudo tc qdisc add dev $IFACE root handle 1:0 htb default 10 +sudo tc class add dev $IFACE parent 1:0 classid 1:10 htb rate $RATE prio 0 +sudo tc filter add dev $IFACE parent 1:0 prio 0 protocol ip u32 match ip protocol 4 0xff match ip dport $PORT 0xffff flowid 1:10 +sudo tc qdisc show dev $IFACE diff --git a/tmp/scripts/traffic-limit.sh b/tmp/scripts/traffic-limit.sh deleted file mode 100755 index bad00b9..0000000 --- a/tmp/scripts/traffic-limit.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# http://www.codeoriented.com/how-to-limit-network-bandwidth-for-a-specific-tcp-port-on-ubuntu-linux/ - -IF=$2 -BAND=$1 -PORT=$3 - -if [ -z "$3" ] ; then - echo $0 10kbps wlan0 8080 - exit 1 -fi - -tc qdisc del root dev $IF -tc qdisc add dev $IF root handle 1:0 htb default 10 -tc class add dev $IF parent 1:0 classid 1:10 htb rate $BAND prio 0 -tc filter add dev $IF parent 1:0 prio 0 protocol ip u32 match ip protocol 4 0xff match ip dport $PORT 0xffff flowid 1:10 -tc qdisc show dev $IF