summaryrefslogtreecommitdiff
path: root/select.sh
blob: 1cc08c439c7737986652f0cc4f77f15ef0052378 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

cd "$(dirname "$0")"

V2RAY_CONFIG_DIR=${V2RAY_CONFIG_DIR:-$(pwd)}
V2RAY_SUB="$V2RAY_CONFIG_DIR/subscription"

if [[ "$#" -ne 0 && -f "$1" ]]
then
    cp -f "$1" "$V2RAY_CONFIG_DIR/config.json"
else
    if [[ "$#" -eq 0 ]]
    then
        [[ -f "$V2RAY_SUB" ]] || "$V2RAY_HOME/update.sh" || exit 1
        "$V2RAY_HOME/vmess2json/vmess2json.py" \
            < "$V2RAY_SUB" \
            --inbounds "http:10809,socks:10808" \
            --output "$V2RAY_CONFIG_DIR/config.json"
    else
        echo "$1 does not exist." >&2
        exit 1
    fi
fi