mirror of
https://github.com/xxoommd/magic.git
synced 2025-07-04 09:42:43 +00:00
updat scripts; update x to v0.3
This commit is contained in:
parent
fb57013052
commit
f7a40906d2
@ -17,15 +17,12 @@ function print_info() {
|
|||||||
|
|
||||||
declare -A servers
|
declare -A servers
|
||||||
servers["yact"]="ssh root@172.50.10.83"
|
servers["yact"]="ssh root@172.50.10.83"
|
||||||
servers["tw1"]="ssh root@tw1.xxoommd.asia"
|
servers["tw"]="ssh root@tw.xmdgg.xyz"
|
||||||
servers["tw2"]="ssh root@tw2.xxoommd.asia"
|
servers["hk"]="ssh root@hk.xmdgg.xyz"
|
||||||
servers["tw3"]="ssh root@tw3.xxoommd.asia"
|
servers["us"]="ssh root@us.xmdgg.xyz"
|
||||||
servers["hk1"]="ssh root@hk1.xxoommd.asia"
|
|
||||||
servers["hk2"]="ssh root@hk2.xxoommd.asia"
|
|
||||||
servers["us1"]="ssh root@us1.xxoommd.asia"
|
|
||||||
servers["us2"]="ssh root@us2.xxoommd.asia"
|
|
||||||
servers["ya"]="ssh -p 7189 gaohengyi@jumpserver.yacloud.net"
|
servers["ya"]="ssh -p 7189 gaohengyi@jumpserver.yacloud.net"
|
||||||
servers["u1"]="ssh root@u1"
|
servers["u1"]="ssh root@u1"
|
||||||
|
servers["dev"]="ssh root@125.64.33.85"
|
||||||
|
|
||||||
function help() {
|
function help() {
|
||||||
echo
|
echo
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
# Verion 0.2
|
# Verion 0.3
|
||||||
|
|
||||||
## QUICK START
|
## QUICK START
|
||||||
|
|
||||||
1. Set variable: `DEPLOY_DOMAIN` and `TAG`
|
1. Set variable: `DOMAIN` and `TAG`
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
export DEPLOY_DOMAIN=xxx.xxx
|
export DOMAIN=xxx.xxx
|
||||||
export TAG=v0.2
|
export TAG=v0.3
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Start
|
2. Start
|
||||||
|
@ -15,9 +15,9 @@ function loginfo() {
|
|||||||
echo -e "[INFO] $1"
|
echo -e "[INFO] $1"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ -z $DEPLOY_DOMAIN ]]; then
|
if [[ -z $DOMAIN ]]; then
|
||||||
echo
|
echo
|
||||||
logerr "env:DEPLOY_DOMAIN is not set"
|
logerr "env:DOMAIN is not set"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -81,7 +81,7 @@ NAIVE_CONFIG="./naive-config.json"
|
|||||||
function gen_hysteria_config() {
|
function gen_hysteria_config() {
|
||||||
|
|
||||||
cat >$HYSTERIA_CONFIG <<EOF
|
cat >$HYSTERIA_CONFIG <<EOF
|
||||||
server: $DEPLOY_DOMAIN:8443
|
server: $DOMAIN:8443
|
||||||
auth: fuckyouall
|
auth: fuckyouall
|
||||||
bandwidth:
|
bandwidth:
|
||||||
up: 100 mbps
|
up: 100 mbps
|
||||||
@ -99,7 +99,7 @@ function gen_naive_config() {
|
|||||||
cat >${NAIVE_CONFIG} <<EOF
|
cat >${NAIVE_CONFIG} <<EOF
|
||||||
{
|
{
|
||||||
"listen": "http://127.0.0.1:28081",
|
"listen": "http://127.0.0.1:28081",
|
||||||
"proxy": "quic://xxoommd:fuckyouall@$DEPLOY_DOMAIN"
|
"proxy": "quic://xxoommd:fuckyouall@$DOMAIN"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
echo -e "[INFO] Generate Done\n"
|
echo -e "[INFO] Generate Done\n"
|
||||||
|
@ -27,19 +27,19 @@ function is_valid_domain() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
echo -e "\n[INFO] Validate DOMAN: ${BLUE}${DEPLOY_DOMAIN}${NC} ..."
|
echo -e "\n[INFO] Validate DOMAN: ${BLUE}${DOMAIN}${NC} ..."
|
||||||
|
|
||||||
if [[ -z $DEPLOY_DOMAIN ]]; then
|
if [[ -z $DOMAIN ]]; then
|
||||||
echo
|
echo
|
||||||
echo "[${RED}Err${NC}] DEPLOY_DOMAIN is not set"
|
echo "[${RED}Err${NC}] DOMAIN is not set"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if is_valid_domain "$DEPLOY_DOMAIN"; then
|
if is_valid_domain "$DOMAIN"; then
|
||||||
echo -e "[INFO] ${BLUE}${UNDERLINE}$DEPLOY_DOMAIN${NC} is a valid domain.\n"
|
echo -e "[INFO] ${BLUE}${UNDERLINE}$DOMAIN${NC} is a valid domain.\n"
|
||||||
else
|
else
|
||||||
echo -e "[${RED}ERR${NC}] ${BLUE}${UNDERLINE}$DEPLOY_DOMAIN${NC} is not a valid domain. Abort."
|
echo -e "[${RED}ERR${NC}] ${BLUE}${UNDERLINE}$DOMAIN${NC} is not a valid domain. Abort."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -67,9 +67,9 @@ if [ ! -d "${WORKING_DIR}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
CADDY_STORAGE="${WORKING_DIR}/caddy"
|
CADDY_STORAGE="${WORKING_DIR}/caddy"
|
||||||
CERT_DIR="$CADDY_STORAGE/certificates/acme-v02.api.letsencrypt.org-directory/$DEPLOY_DOMAIN"
|
CERT_DIR="$CADDY_STORAGE/certificates/acme-v02.api.letsencrypt.org-directory/$DOMAIN"
|
||||||
CRT_FILE="$CERT_DIR/$DEPLOY_DOMAIN.crt"
|
CRT_FILE="$CERT_DIR/$DOMAIN.crt"
|
||||||
KEY_FILE="$CERT_DIR/$DEPLOY_DOMAIN.key"
|
KEY_FILE="$CERT_DIR/$DOMAIN.key"
|
||||||
HY_CONFIG_FILE="${WORKING_DIR}/hy-config.yaml"
|
HY_CONFIG_FILE="${WORKING_DIR}/hy-config.yaml"
|
||||||
CADDY_CONFIG_FILE="${WORKING_DIR}/Caddyfile"
|
CADDY_CONFIG_FILE="${WORKING_DIR}/Caddyfile"
|
||||||
|
|
||||||
@ -86,8 +86,8 @@ cat >${CADDY_CONFIG_FILE} <<EOF
|
|||||||
storage file_system $CADDY_STORAGE
|
storage file_system $CADDY_STORAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
:443, ${DEPLOY_DOMAIN}
|
:443, ${DOMAIN}
|
||||||
tls xxoommd@${DEPLOY_DOMAIN}
|
tls xxoommd@${DOMAIN}
|
||||||
route {
|
route {
|
||||||
forward_proxy {
|
forward_proxy {
|
||||||
basic_auth xxoommd fuckyouall
|
basic_auth xxoommd fuckyouall
|
||||||
@ -96,7 +96,7 @@ tls xxoommd@${DEPLOY_DOMAIN}
|
|||||||
probe_resistance
|
probe_resistance
|
||||||
# upstream socks5://127.0.0.1:40000
|
# upstream socks5://127.0.0.1:40000
|
||||||
}
|
}
|
||||||
respond "hello ${DEPLOY_DOMAIN}@naive!"
|
respond "hello ${DOMAIN}@naive!"
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
echo -e "[INFO] Generate Done\n"
|
echo -e "[INFO] Generate Done\n"
|
||||||
@ -113,7 +113,7 @@ auth:
|
|||||||
masquerade:
|
masquerade:
|
||||||
type: string
|
type: string
|
||||||
string:
|
string:
|
||||||
content: 'hello ${DEPLOY_DOMAIN}@hysteria2'
|
content: 'hello ${DOMAIN}@hysteria2'
|
||||||
headers:
|
headers:
|
||||||
content-type: text/plain
|
content-type: text/plain
|
||||||
custom-stuff: ice cream so good
|
custom-stuff: ice cream so good
|
||||||
|
Loading…
x
Reference in New Issue
Block a user