<commit_before>add_my_routes_to_vpn () {
    ADDRS=$(<$SYNC_PATH/scripts/domains-to-route-to-vpn.txt)

    echo -e "Adding routes:\n${ADDRS[@]}\n\n"

    TUNNEL_ADDR=$(ip -o -4 addr list tun0 | awk '{print $4}')

    get_addrs() {
        echo $(nslookup $1 | grep Address | grep -v '#' | cut -d: -f2)
    }

    format_network() {
        echo $(echo $1 | cut -d. -f1-3).0/24
    }

    add_route() {
        SOURCE_NET=$(format_network $1)
        CMD="sudo ip route add $SOURCE_NET via $TUNNEL_ADDR"
        $CMD
    }

    do_work() {
        for i in $ADDRS; do
            echo "routing $i to tun0"
            IP_ADDRS=$(get_addrs $i)
            for j in $IP_ADDRS; do
                add_route $j
            done
        done
    }

    do_work
}
<commit_msg>Fixing vpn router<commit_after>add_my_routes_to_vpn () {
    echo -e "adding my routes do active VPN 🛡️"

    TUNNEL_ADDR=$(ip -o -4 addr list tun0 | awk '{print $4}')
    echo -e "VPN address is ${TUNNEL_ADDR}"

    get_addrs() {
        echo $(nslookup $1 | grep Address | grep -v '#' | cut -d: -f2)
    }

    format_network() {
        echo $(echo $1 | cut -d. -f1-3).0/24
    }

    add_route() {
        SOURCE_NET=$(format_network $1)
        CMD="sudo ip route add $SOURCE_NET via $TUNNEL_ADDR"
        $(CMD)
    }

    while read i; do
        IP_ADDRS=$(get_addrs $i)
        if [[ "$IP_ADDRS" == "" ]]; then
            echo -e "🔴 addr $i isn't active, exiting..."
            continue
        fi

        IP_ADDRS_ARR=($(echo $IP_ADDRS | tr " " "\n"))
        for j in "${IP_ADDRS_ARR[@]}"; do
            echo -e "🔵 routing $j from $i to $TUNNEL_ADDR"
            add_route $j
            if [[ "$?" == "1" ]]; then
                echo -e "🔴 fail to route"
                continue
            fi
            echo -e "🟢 route complete"
        done
        IP_ADDRS=/dev/nill
    done <$SYNC_PATH/scripts/domains-to-route-to-vpn.txt
}

{'fraction_non_alphanumeric': 0.1464304325169359, 'fraction_numerical': 0.01354872329338197, 'mean_word_length': 1.6853146853146854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2961910', 'n_tokens_mistral': 736, 'n_tokens_neox': 707, 'n_words': 182}