Readme and traffic-limit.sh improvements
This commit is contained in:
10
README.md
10
README.md
@@ -14,8 +14,8 @@ Simple open source self-hosted file sharing solution.
|
|||||||
* Resumable up- and downloads ([TUS](https://tus.io))
|
* Resumable up- and downloads ([TUS](https://tus.io))
|
||||||
* Set an expire-time for your upload bucket
|
* Set an expire-time for your upload bucket
|
||||||
* One-time downloads
|
* One-time downloads
|
||||||
* Password protected downloads ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard))
|
* Requires Node >=7.4 or use `--harmony-async-await` flag
|
||||||
* Requires Node >=7.4
|
* Password protected download list ([AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard))
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -84,6 +84,12 @@ Psitransfer uses [debug](https://github.com/visionmedia/debug):
|
|||||||
DEBUG=psitransfer:* npm start
|
DEBUG=psitransfer:* npm start
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Side notes
|
||||||
|
|
||||||
|
* There is no (end-to-end) payload encryption (yet).
|
||||||
|
|
||||||
|
:star2: Contribution is highly welcome :metal:
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
[BSD](LICENSE)
|
[BSD](LICENSE)
|
||||||
|
|||||||
43
scripts/traffic-limit.sh
Executable file
43
scripts/traffic-limit.sh
Executable file
@@ -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
|
||||||
@@ -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
|
|
||||||
Reference in New Issue
Block a user