<commit_before>kits_vpn() {
    local vpn_service=$([[ -z "$2" ]] && echo "VPN GFW" || echo $2)
    # scutil命令连接vpn时总是要secret key，不管是否已配置
    local vpn_secret=$([[ -z "$3" ]] && echo "$DO_USR$DO_PWD" || echo $2)
    case "$1" in
        "start" | "restart" )
            $FUNCNAME status && $FUNCNAME stop && sleep 1
            scutil --nc start "$vpn_service" --secret $vpn_secret
            ;;
        "stop" )
            scutil --nc stop "$vpn_service"
            ;;
        "alive" )
            local ip=$(scutil --nc status "VPN GFW" | grep "ServerAddress" | awk '{print $3}')
            local msg=$([[ -z "$ip" ]] && echo "VPN" || echo "VPN[$ip]")
            $FUNCNAME status; _kits_check "$msg"
            ;;
        "keep-alive" )
            $FUNCNAME status || $FUNCNAME start
            ;;
        "status" )
            local status=$(scutil --nc status "$vpn_service" | head -n 1)
            [[ "$status" == "Connected" ]] && return 0 || return 1
            ;;
        # "test" )
        #     # 勿用google
        #     ret=$(curl -s -m 5 http://ipv4.wtfismyip.com/text)
        #     _kits_check "VPN[$ret]"
        #     ;;
        * )
            echo "ERROR. Usage: <start|stop|restart|alive|test>"
            ;;
    esac
}<commit_msg>vpn控制优化<commit_after>kits_vpn() {
    # 默认vpn service为名称为首个名称以VPN开头的service
    local def_service="$(networksetup -listallnetworkservices | grep ^VPN | head -n 1)"
    local def_secret="$DO_VPN_SECRET" 
    local vpn_service=$([[ -z "$2" ]] && echo "$def_service" || echo $2)
    # scutil命令连接vpn时总是要secret key，不管是否已配置
    local vpn_secret=$([[ -z "$3" ]] && echo "$def_secret" || echo $2)

    [[ -z "$vpn_service" ]] && echo "vpn service missing." && return 1

    case "$1" in
        "start" | "restart" )
            $FUNCNAME status && $FUNCNAME stop && sleep 1
            scutil --nc start "$vpn_service" --secret $vpn_secret
            ;;
        "stop" )
            scutil --nc stop "$vpn_service"
            ;;
        "alive" )
            local ip=$(scutil --nc status "$vpn_service" | grep "ServerAddress" | awk '{print $3}')
            local msg=$([[ -z "$ip" ]] && echo "$vpn_service" || echo "$vpn_service[$ip]")
            $FUNCNAME status; _kits_check "$msg"
            ;;
        "keep-alive" )
            $FUNCNAME status || $FUNCNAME start
            ;;
        "status" )
            local status=$(scutil --nc status "$vpn_service" | head -n 1)
            [[ "$status" == "Connected" ]] && return 0 || return 1
            ;;
        # "test" )
        #     # 勿用google
        #     ret=$(curl -s -m 5 http://ipv4.wtfismyip.com/text)
        #     _kits_check "VPN[$ret]"
        #     ;;
        * )
            echo "ERROR. Usage: <start|stop|restart|alive|test>"
            ;;
    esac
}
{'fraction_non_alphanumeric': 0.16792249730893433, 'fraction_numerical': 0.009329027628274129, 'mean_word_length': 1.7467980295566503, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2186969', 'n_tokens_mistral': 1007, 'n_tokens_neox': 982, 'n_words': 218}