l-n-s / wireguard-install

WireGuard VPN server installer
MIT License
657 stars 166 forks source link

Adding TCP #20

Closed ghost closed 5 years ago

ghost commented 5 years ago

https://tunsafe.com/user-guide/tcp

A little bit of code to add to the script..

    echo ""
    echo "What port do you want WireGuard to listen to?"
    echo "   1) Default: 51820"
    echo "   2) Custom"
    echo "   3) Random [1-65535]"
    until [[ "$PORT_CHOICE" =~ ^[1-3]$ ]]; do
        read -rp "Port choice [1-3]: " -e -i 1 PORT_CHOICE
    done
    case $PORT_CHOICE in
        1)
            PORT="51820"
        ;;
        2)
            until [[ "$PORT" =~ ^[0-9]+$ ]] && [ "$PORT" -ge 1 ] && [ "$PORT" -le 65535 ]; do
                read -rp "Custom port [1-65535]: " -e -i 51820 PORT
            done
        ;;
        3)
            # Generate random number within private ports range
            PORT=$(shuf -i0-65535 -n1)
            echo "Random Port: $PORT"
        ;;
    esac
    echo ""
    echo "What protocol do you want WireGuard to use?"
    echo "UDP is faster. Unless it is not available, you shouldn't use TCP."
    echo "   1) UDP"
    echo "   2) TCP"
    until [[ "$PROTOCOL_CHOICE" =~ ^[1-2]$ ]]; do
        read -rp "Protocol [1-2]: " -e -i 1 PROTOCOL_CHOICE
    done
    case $PROTOCOL_CHOICE in
        1)
            PROTOCOL="udp"
        ;;
        2)
            PROTOCOL="tcp"
        ;;
    esac
DeniDoman commented 5 years ago

Is this a Wireguard functionality or Tunsafe adjustments?

ghost commented 5 years ago

really not sure, lets try it with normal wireguard if it doesn't work its a tunsafe feature only.