aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/autotunnel
blob: 230940db55e25cfb06e082c99fb9069c67a6b4c2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash

if [ -z "$SERVER_ALIVE_INTERVAL" ];then
  SERVER_ALIVE_INTERVAL=45
fi

if [ -z "$SERVER_ALIVE_COUNT_MAX" ];then
  SERVER_ALIVE_INTERVAL=2
fi

if [ -z "$MONITORING_PORT" ];then
  MONITORING_PORT=0
fi

/usr/bin/autossh -M "$MONITORING_PORT" \
  -NCTv \
  -o ServerAliveInterval="$SERVER_ALIVE_INTERVAL" \
  -o ServerAliveCountMax="$SERVER_ALIVE_COUNT_MAX" \
  -o TCPKeepAlive=yes \
  -w $TUN_DEVICE:$TUN_DEVICE \
  $HOST