Compare commits

...

12 Commits
v0.3 ... main

Author SHA1 Message Date
xxoommd
dbd242cfb4 update 2025-05-27 16:35:42 +08:00
xxoommd
71cce2b79b fix bbr err 2025-05-19 13:08:50 +08:00
xxoommd
7c13cbb324 fix err 2025-05-08 13:14:54 +08:00
xxoommd
7ef7b7392c update win profile 2025-05-08 13:11:59 +08:00
xxoommd
734bb0fcb1 update 2025-05-06 11:53:57 +08:00
xxoommd
d7d36f793a update 2025-04-27 13:34:06 +08:00
xxoommd
395ee7a49e update 2025-04-27 09:32:15 +08:00
xxoommd
501cd1ff93 update 2025-04-27 09:28:01 +08:00
gaofei
8b2517b9b1 Add win profile 2025-04-25 10:06:58 +08:00
gaofei
9c140241da update x to v0.4 2025-04-07 16:37:54 +08:00
8f4507b639 update connect 2025-03-19 23:20:14 +08:00
gaofei
668ab70f74 Update scripts 2025-02-24 15:28:25 +08:00
8 changed files with 1027 additions and 723 deletions

298
profiles/win/profile Normal file
View File

@ -0,0 +1,298 @@
alias l='ls -lhF'
alias la='ls -AlhF'
alias ll=l
alias open=explorer
export LC_ALL=zh_CN.utf-8
export http_proxyserver="http://127.0.0.1:10809"
function set_proxy() {
if [[ $1 == "on" ]]; then
export HTTP_PROXY=$http_proxyserver
export HTTPS_PROXY=$http_proxyserver
elif [[ $1 == "off" ]]; then
unset HTTP_PROXY HTTPS_PROXY
fi
echo
echo "HTTP_PROXY=$HTTP_PROXY"
echo "HTTPS_PROXY=$HTTPS_PROXY"
echo
}
function _c3_tool_help() {
echo
echo "Usage:"
echo " - c3tool build|b [ARGS]"
echo " [-u | --update-all] Updating Augustus custom resources and libs: SDL2 SDL2_mixer"
echo " [-f | --force] Clean all and rebuild, including resources and libs"
echo " [-r | --release] Build release version, default is debug"
echo " - c3tool clean|c"
echo
}
function c3tool() {
__GREEN__='\033[0;32m'
__RED__='\033[0;31m'
__BLUE__='\033[0;34m'
__YELLOW__='\033[0;33m'
__UNDERLINE__='\033[4m' # 下划线
__RESET_COLOR__='\033[0m' # No Color
__NC__='\033[0m' # No Color
# check `cmake`
if command -v cmake &>/dev/null; then
echo "[CHECK] cmake 已安装"
else
echo "[${__RED__}Err${__NC__}] cmake 未安装,请先安装 cmake"
return 0
fi
if command -v mingw32-make &>/dev/null; then
echo "[CHECK] mingw32-make 已安装"
else
echo "[${__RED__}Err${__NC__}] mingw32-make 未安装,请先安装 mingw32-make"
return 0
fi
# check augustus or julius project folder
if [ $(basename $PWD) == "build" ]; then
PROJECT_DIR=$(cd .. && pwd)
BUILD_DIR=$PWD
else
PROJECT_DIR=$PWD
BUILD_DIR="$PWD/build"
fi
if [ ! -f $PROJECT_DIR/CMakeLists.txt ]; then
echo -e "[${__RED__}ERR${__NC__}] Enter '${__YELLOW__}augustus${__NC__}' or '${__YELLOW__}julius${__NC__}' project first."
return 1
fi
printf "[CHECK] %-20s${__GREEN__}$PROJECT_DIR${__NC__}\n" "Project location:"
if [ ! -d $BUILD_DIR ]; then
mkdir -p $BUILD_DIR
fi
printf "[CHECK] %-20s${__GREEN__}$BUILD_DIR${__NC__}\n" "Build location:"
TARGET_NAME=$(awk '/set\(SHORT_NAME/ {print $2}' $PROJECT_DIR/CMakeLists.txt | sed 's/)//g')
printf "[CHECK] %-20s${__GREEN__}$TARGET_NAME${__NC__}\n" "Target name:"
if [[ $1 == "" || "$1" == "-h" || "$1" == "--help" ]]; then
_c3_tool_help
return 0
fi
cmd=$1 && shift
force=false
update=false
# Parse args...
for arg in "$@"; do
case "$arg" in
-u | --update)
update=true
;;
-f | --force)
force=true
update=true
;;
-r | --release)
BUILD_TYPE=release
;;
esac
done
# Execute cmd...
case "$cmd" in
b | build)
if $force; then
printf "[CLEAN] ... " && rm -rf $BUILD_DIR/* $BUILD_DIR/.* && echo "Done"
fi
printf "[CHECK] %-20s${__GREEN__}$BUILD_TYPE${__NC__}\n" "CMAKE_BUILD_TYPE:"
# cmake
if [[ ! -f "Makefile" ]]; then
exec_str="cd $BUILD_DIR && cmake .. -G \"MinGW Makefiles\" > /dev/null"
eval $exec_str
if [ $? -ne 0 ]; then
echo -e "[${__RED__}ERR${__NC__}] Execute string: ${exec_str}"
return 1
fi
fi
# mingw32-make
echo "[BUILD] Start ..."
if command -v nproc &>/dev/null; then
makenum=$(nproc)
else
makenum=2
fi
export CMAKE_BUILD_TYPE=${BUILD_TYPE}
exec_str="cd $BUILD_DIR && mingw32-make -j$makenum --quiet > /dev/null"
eval $exec_str
if [ $? -ne 0 ]; then
unset CMAKE_BUILD_TYPE
echo -e "[${__RED__}ERR${__NC__}] FAIL. Execute string: ${exec_str}"
return 1
fi
unset CMAKE_BUILD_TYPE
if $update; then
if [[ $TARGET_NAME == "augustus" ]]; then
printf "[UPDATE] Cleaning res..." && rm -rf assets maps && echo "Done"
fi
printf "[UPDATE] Cleaning libs..." && rm -f SDL2.dll SDL2_mixer.dll && echo "Done"
fi
# Updating res:
if [[ $TARGET_NAME == "augustus" ]]; then
if [[ ! -d assets || ! -d maps ]]; then
printf "[UPDATE] Copying assets ..." && cp -r ../res/assets . && echo "Done"
printf "[UPDATE] Copying maps ..." && cp -r ../res/maps . && echo "Done"
fi
fi
# Updating libs:
if [[ ! -f SDL2.dll || ! -f SDL2_mixer.dll ]]; then
printf "[UPDATE] Copying libs ..." && cp ../ext/SDL2/SDL2-2.32.4/x86_64-w64-mingw32/bin/SDL2.dll . &&
cp ../ext/SDL2/SDL2_mixer-2.8.1/x86_64-w64-mingw32/bin/SDL2_mixer.dll . &&
echo "Done"
fi
echo -e "[BUILD] Build ${__GREEN__}${TARGET_NAME}${__NC__} success"
;;
c | clean)
printf "[CLEAN] ... " && rm -rf $BUILD_DIR/* $BUILD_DIR/.* && echo "Done"
;;
*)
echo "[Err] Invalid cmd: $cmd"
_c3_tool_help
return 1
;;
esac
}
function connect() {
GREEN='\033[0;32m'
RED='\033[0;31m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
UNDERLINE='\033[4m' # 下划线
RESET_COLOR='\033[0m' # No Color
NC='\033[0m' # No Color
STR_BASH="[${GREEN}Bash${RESET_COLOR}]"
STR_ZSH="[${GREEN}Zsh${RESET_COLOR}]"
STR_ERR_PREFIX="[${RED}Err${RESET_COLOR}]"
STR_INFO_PREFIX="[${GREEN}INFO${NC}]"
if [[ -n "$BASH_VERSION" ]]; then
printf "$STR_BASH Detected\n\n"
declare -A servers
elif [[ -n "$ZSH_VERSION" ]]; then
printf "$STR_ZSH Detected\n\n"
typeset -A servers
setopt KSH_ARRAYS
else
echo -e "[${RED}Err${RESET_COLOR}] Running another shell. Only ${STR_BASH} or ${STR_ZSH} supported."
return
fi
servers=(
# ["yact"]="ssh root@172.50.10.83"
["yacloud"]="ssh -p 7189 gaohengyi@jumpserver.yacloud.net"
["u1"]="ssh root@u1"
["dev"]="ssh root@125.64.33.85"
["tw"]="ssh root@tw.xmdgg.xyz"
["hk"]="ssh root@hk.xmdgg.xyz"
["us"]="ssh root@us.xmdgg.xyz"
# ["us1"]="ssh root@us.xmdgg.xyz"
# ["us2"]="ssh root@us.xmdgg.xyz"
# ["us3"]="ssh root@us.xmdgg.xyz"
# ["us4"]="ssh root@us.xmdgg.xyz"
# ["us5"]="ssh root@us.xmdgg.xyz"
# ["us6"]="ssh root@us.xmdgg.xyz"
# ["us7"]="ssh root@us.xmdgg.xyz"
# ["us8"]="ssh root@us.xmdgg.xyz"
# ["us9"]="ssh root@us.xmdgg.xyz"
# ["us10"]="ssh root@us.xmdgg.xyz"
)
servers_index=()
if [[ -n "$BASH_VERSION" ]]; then
for key in "${!servers[@]}"; do
servers_index+=("$key")
done
elif [[ -n "$ZSH_VERSION" ]]; then
for key in "${(k)servers[@]}"; do
servers_index+=("$key")
done
else
return
fi
show_help=false
server_name=""
if [ -z "$1" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
show_help=true
elif [[ $1 =~ ^[0-9]+$ ]]; then
server_index=$1
server_name=${servers_index[$server_index]}
if [ -z $server_name ]; then
printf "${STR_ERR_PREFIX} Invalid index: $server_index\n\n"
show_help=true
fi
else
server_name=$1
if [[ " ${servers_index[*]} " != *" $server_name "* ]]; then
printf "${STR_ERR_PREFIX} Invalid name: $server_name"
show_help=true
fi
fi
if $show_help; then
echo -e "Usage:\n"
echo -e " - connect [${BLUE}ID${NC}] | [${BLUE}NAME${NC}]"
echo -e "\nServers:\n"
if [[ -n "$BASH_VERSION" ]]; then
for i in ${!servers_index[@]}; do
name=${servers_index[$i]}
ssh_cmd=${servers[$name]}
printf "${YELLOW}%2d${RESET_COLOR}|" $i
printf "%-8s -> " $name
printf "%s\n" "$ssh_cmd"
done
elif [[ -n "$ZSH_VERSION" ]]; then
length=${#servers_index[@]}
max=$((length-1))
for i in {0..${max}}; do
name=${servers_index[$i]}
ssh_cmd=${servers[$name]}
printf "${YELLOW}%2d${RESET_COLOR}|" $i
printf "%-8s -> " $name
printf "%s\n" "$ssh_cmd"
done
echo
fi
return
fi
ssh_cmd=${servers[$server_name]}
echo -e "${STR_INFO_PREFIX} Connect to Server:"
echo -e "${STR_INFO_PREFIX} NAME: $server_name"
echo -e "${STR_INFO_PREFIX} CMD: ${YELLOW}$ssh_cmd${NC}"
echo -e "${STR_INFO_PREFIX} Connecting..."
err_msg=$(eval $ssh_cmd 2>&1 >/dev/tty)
if [[ $? != 0 ]]; then
echo -e "${STR_ERR_PREFIX} $err_msg"
fi
echo
}

View File

@ -1,4 +1,4 @@
#!/usr/bin/bash #!/bin/bash
GREEN='\033[0;32m' GREEN='\033[0;32m'
RED='\033[0;31m' RED='\033[0;31m'

View File

@ -6,7 +6,7 @@
```shell ```shell
export DOMAIN=xxx.xxx export DOMAIN=xxx.xxx
export TAG=v0.3 export TAG=v0.4
``` ```
2. Start 2. Start
@ -30,11 +30,11 @@ bash <(curl -fsSL https://gitee.com/xxoommd/magic/raw/main/x/quick_server.sh)
- Github: - Github:
```shell ```shell
TAG=latest bash <(curl -fsSL https://raw.githubusercontent.com/xxoommd/magic/main/x/quick_client.sh) bash <(curl -fsSL https://raw.githubusercontent.com/xxoommd/magic/main/x/quick_client.sh)
``` ```
- Gitea: - Gitea:
```shell ```shell
TAG=latest bash <(curl -fsSL https://gitee.com/xxoommd/magic/raw/main/x/quick_client.sh) bash <(curl -fsSL https://gitee.com/xxoommd/magic/raw/main/x/quick_client.sh)
``` ```

View File

@ -27,6 +27,11 @@ function is_valid_domain() {
fi fi
} }
echo "Enabling BBR..."
echo "net.core.default_qdisc=fq" | tee -a /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" |tee -a /etc/sysctl.conf
sysctl -p
echo -e "\n[INFO] Validate DOMAN: ${BLUE}${DOMAIN}${NC} ..." echo -e "\n[INFO] Validate DOMAN: ${BLUE}${DOMAIN}${NC} ..."
if [[ -z $DOMAIN ]]; then if [[ -z $DOMAIN ]]; then

View File

@ -88,7 +88,7 @@ function download_naive() {
function update_naive() { function update_naive() {
rm -rf /tmp/naive* rm -rf /tmp/naive*
NAIVE_VERSION="v128.0.6613.40-1" NAIVE_VERSION="v135.0.7049.38-2"
download_naive $NAIVE_VERSION "linux" "amd64" "linux" "x64" && download_naive $NAIVE_VERSION "linux" "amd64" "linux" "x64" &&
download_naive $NAIVE_VERSION "darwin" "amd64" "mac" "x64" && download_naive $NAIVE_VERSION "darwin" "amd64" "mac" "x64" &&
download_naive $NAIVE_VERSION "darwin" "arm64" "mac" "arm64" && download_naive $NAIVE_VERSION "darwin" "arm64" "mac" "arm64" &&
@ -98,7 +98,7 @@ function update_naive() {
} }
function download_hysteria() { function download_hysteria() {
echo "- Downloading hysteria-linxu-amd64-avx ..." && echo "- Downloading hysteria-linux-amd64-avx ..." &&
curl -s -L -o $BIN_PATH/hysteria-linux-amd64-avx https://download.hysteria.network/app/latest/hysteria-linux-amd64-avx && curl -s -L -o $BIN_PATH/hysteria-linux-amd64-avx https://download.hysteria.network/app/latest/hysteria-linux-amd64-avx &&
echo "- Downloading hysteria-darwin-amd64 ..." && echo "- Downloading hysteria-darwin-amd64 ..." &&
curl -s -L -o $BIN_PATH/hysteria-darwin-amd64 https://download.hysteria.network/app/latest/hysteria-darwin-amd64 && curl -s -L -o $BIN_PATH/hysteria-darwin-amd64 https://download.hysteria.network/app/latest/hysteria-darwin-amd64 &&
@ -135,6 +135,7 @@ function main() {
up_naive=true up_naive=true
;; ;;
all) all)
up_naive=true
up_caddy=true up_caddy=true
up_hy=true up_hy=true
;; ;;