mirror of
https://github.com/xxoommd/magic.git
synced 2025-07-12 10:08:53 +00:00
Merge branch 'main' of github.com:xxoommd/magic
This commit is contained in:
2
scripts/_set_proxy
Normal file
2
scripts/_set_proxy
Normal file
@ -0,0 +1,2 @@
|
||||
export HTTP_PROXY="http://localhost:28080"
|
||||
export HTTPS_PROXY="http://localhost:28080"
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GREEN='\033[0;32m'
|
||||
RED='\033[0;31m'
|
||||
@ -28,6 +28,7 @@ servers["jp"]="ssh ubuntu@jp.xxoommd.asia"
|
||||
servers["sg"]="ssh ubuntu@sg.xxoommd.asia"
|
||||
|
||||
function help() {
|
||||
echo
|
||||
echo "Usage:"
|
||||
echo -e " 1.SSH to server: con (${GREEN}-C${NC}|${GREEN}--connect-host${NC} can be omitted) [NAME]"
|
||||
echo -e " Options:"
|
||||
@ -48,6 +49,7 @@ function help() {
|
||||
printf "${NC}%-24s${NC}" "$user@$host"
|
||||
printf "${YELLOW}%-16s${NC}\n" " ssh_port:$port"
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
# parse_ssh_string: Parse ssh command to port, user, port
|
||||
|
22
scripts/set-proxy
Executable file
22
scripts/set-proxy
Executable file
@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function show() {
|
||||
echo
|
||||
echo "HTTP_PROXY=$HTTP_PROXY"
|
||||
echo "HTTPS_PROXY=$HTTPS_PROXY"
|
||||
echo
|
||||
}
|
||||
|
||||
function main() {
|
||||
if [[ $1 == "on" ]]; then
|
||||
DIR="$(dirname "${BASH_SOURCE[0]}")"
|
||||
source $DIR/_set_proxy
|
||||
elif [[ $1 == "off" ]]; then
|
||||
unset HTTP_PROXY
|
||||
unset HTTPS_PROXY
|
||||
fi
|
||||
|
||||
show
|
||||
}
|
||||
|
||||
main $@
|
Reference in New Issue
Block a user