Merge pull request #133 from boypt/dev

显示IPv6; Redhat系服务器关闭selinux;
pull/145/head
233boy 6 years ago committed by GitHub
commit e73fe0d6eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 36
      install.sh
  2. 68
      src/init.sh
  3. 9
      src/ss-info.sh
  4. 5
      src/v2ray-info.sh
  5. 24
      v2ray.sh

@ -729,8 +729,8 @@ install_v2ray() {
echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none" echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none"
echo echo
echo echo
$cmd update -y
if [[ $cmd == "apt-get" ]]; then if [[ $cmd == "apt-get" ]]; then
$cmd update -y
$cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin $cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin
else else
# $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services # $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services
@ -835,15 +835,21 @@ backup_config() {
} }
get_ip() { get_ip() {
ip=$(curl -s https://ipinfo.io/ip) ip=$(curl -4 -s https://ipinfo.io/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) [[ -z $ip ]] && ip=$(curl -4 -s https://api.ip.sb/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) [[ -z $ip ]] && ip=$(curl -4 -s https://api.ipify.org)
[[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) [[ -z $ip ]] && ip=$(curl -4 -s https://ip.seeip.org)
[[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) [[ -z $ip ]] && ip=$(curl -4 -s https://ifconfig.co/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") [[ -z $ip ]] && ip=$(curl -4 -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ip ]] && ip=$(curl -s icanhazip.com) [[ -z $ip ]] && ip=$(curl -4 -s icanhazip.com)
[[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") [[ -z $ip ]] && ip=$(curl -4 -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit [[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit
v6ip=$(curl -6 -s https://ifconfig.co/ip)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://api.ip.sb/ip)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://ip.seeip.org)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s http://icanhazip.com)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://api.myip.com | cut -d\" -f4)
} }
error() { error() {
@ -889,6 +895,7 @@ _install() {
echo echo
exit 1 exit 1
fi fi
_disableselinux
v2ray_config v2ray_config
blocked_hosts blocked_hosts
shadowsocks_config shadowsocks_config
@ -941,6 +948,17 @@ _uninstall() {
} }
_disableselinux () {
# Configure SELinux
type selinuxenabled >/dev/null 2>&1 || return 0;
[[ ! -f /etc/selinux/config ]] && return 0;
if selinuxenabled; then
setenforce Permissive
# disable selinux needs reboot, set to Permissive
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
fi
}
args=$1 args=$1
_gitbranch=$2 _gitbranch=$2
[ -z $1 ] && args="online" [ -z $1 ] && args="online"

@ -1,3 +1,49 @@
_black() { echo -e "$(tput setaf 0)$*$(tput setaf 9)"; }
_red() { echo -e "$(tput setaf 1)$*$(tput setaf 9)"; }
_green() { echo -e "$(tput setaf 2)$*$(tput setaf 9)"; }
_yellow() { echo -e "$(tput setaf 3)$*$(tput setaf 9)"; }
_blue() { echo -e "$(tput setaf 4)$*$(tput setaf 9)"; }
_magenta() { echo -e "$(tput setaf 5)$*$(tput setaf 9)"; }
_cyan() { echo -e "$(tput setaf 6)$*$(tput setaf 9)"; }
_white() { echo -e "$(tput setaf 7)$*$(tput setaf 9)"; }
_addtocron () {
local PROG="$1"
local CRONLINE="$2"
# empty crontab
if ! crontab -l >/dev/null 2>&1; then
echo "$CRONLINE" | crontab
else
# add if $PROG not exists
if ! crontab -l | grep -q "$PROG"; then
(crontab -l; echo "$CRONLINE") | crontab
else
echo "> $PROG exists in cron, skipping."
fi
fi
}
_removefromcron () {
local PROG="$1"
if crontab -l | grep -q "$PROG"; then
crontab -l | grep -v "$PROG" | crontab
fi
}
_disablecronmail() {
if [[ ! -f /etc/sysconfig/crond ]]; then
return 0
fi
sed -i '/^CRONDARGS/d' /etc/sysconfig/crond
if crond -h 2>&1 | grep -- '-s'; then
sed -i '$aCRONDARGS="-s -m off"' /etc/sysconfig/crond
else
sed -i '$aCRONDARGS="-m off"' /etc/sysconfig/crond
fi
service crond restart
}
_rm() { _rm() {
rm -rf "$@" rm -rf "$@"
} }
@ -17,15 +63,21 @@ _load() {
} }
get_ip() { get_ip() {
ip=$(curl -s https://ipinfo.io/ip) ip=$(curl -4 -s https://ipinfo.io/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) [[ -z $ip ]] && ip=$(curl -4 -s https://api.ip.sb/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) [[ -z $ip ]] && ip=$(curl -4 -s https://api.ipify.org)
[[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) [[ -z $ip ]] && ip=$(curl -4 -s https://ip.seeip.org)
[[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) [[ -z $ip ]] && ip=$(curl -4 -s https://ifconfig.co/ip)
[[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") [[ -z $ip ]] && ip=$(curl -4 -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ip ]] && ip=$(curl -s icanhazip.com) [[ -z $ip ]] && ip=$(curl -4 -s icanhazip.com)
[[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") [[ -z $ip ]] && ip=$(curl -4 -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}")
[[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit [[ -z $ip ]] && echo -e "\n$red 这垃圾小鸡扔了吧!$none\n" && exit
v6ip=$(curl -6 -s https://ifconfig.co/ip)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://api.ip.sb/ip)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://ip.seeip.org)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s http://icanhazip.com)
[[ -z $v6ip ]] && v6ip=$(curl -6 -s https://api.myip.com | cut -d\" -f4)
} }
error() { error() {

@ -13,6 +13,11 @@ if [[ $shadowsocks ]]; then
echo echo
echo -e "$yellow 服务器地址 = $cyan${ip}$none" echo -e "$yellow 服务器地址 = $cyan${ip}$none"
echo echo
if [[ $v6ip ]]; then
local ssv6="ss://${cipherstr}@[${v6ip}]:${ssport}#v2ray6.com_ss_${ip}"
echo -e "$yellow 服务器IPv6地址 = $cyan${v6ip}$none"
echo
fi
echo -e "$yellow 服务器端口 = $cyan$ssport$none" echo -e "$yellow 服务器端口 = $cyan$ssport$none"
echo echo
echo -e "$yellow 密码 = $cyan$sspass$none" echo -e "$yellow 密码 = $cyan$sspass$none"
@ -21,6 +26,10 @@ if [[ $shadowsocks ]]; then
echo echo
echo -e "$yellow SS 链接 = ${cyan}$ss$none" echo -e "$yellow SS 链接 = ${cyan}$ss$none"
echo echo
if [[ $ssv6 ]]; then
echo -e "$yellow SS IPv6 链接 = ${cyan}$ssv6$none"
echo
fi
if [[ $ssray ]]; then if [[ $ssray ]]; then
echo -e "$yellow SS + V2ray - Plugin 地址 = ${cyan}${ssray_domain}$none" echo -e "$yellow SS + V2ray - Plugin 地址 = ${cyan}${ssray_domain}$none"
echo echo

@ -71,6 +71,7 @@ _v2_args() {
} }
_v2_info() { _v2_info() {
[[ -z $ip ]] && get_ip
echo echo
echo echo
echo "---------- V2Ray 配置信息 -------------" echo "---------- V2Ray 配置信息 -------------"
@ -106,6 +107,10 @@ _v2_info() {
echo echo
echo -e "$yellow 地址 (Address) = $cyan${ip}$none" echo -e "$yellow 地址 (Address) = $cyan${ip}$none"
echo echo
if [[ $v6ip ]]; then
echo -e "$yellow IPv6 地址 (Address) = $cyan${v6ip}$none"
echo
fi
echo -e "$yellow 端口 (Port) = $cyan$v2ray_port$none" echo -e "$yellow 端口 (Port) = $cyan$v2ray_port$none"
echo echo
echo -e "$yellow 用户ID (User ID / UUID) = $cyan${v2ray_id}$none" echo -e "$yellow 用户ID (User ID / UUID) = $cyan${v2ray_id}$none"

@ -150,6 +150,23 @@ create_vmess_URL_config() {
"tls": "" "tls": ""
} }
EOF EOF
if [[ $v6ip ]]; then
cat >/etc/v2ray/vmess_qrv6.json <<-EOF
{
"v": "2",
"ps": "v2ray6.com_${v6ip}",
"add": "${ip}",
"port": "${v2ray_port}",
"id": "${v2ray_id}",
"aid": "${alterId}",
"net": "${net}",
"type": "${header}",
"host": "${host}",
"path": "",
"tls": ""
}
EOF
fi
fi fi
} }
view_v2ray_traffic() { view_v2ray_traffic() {
@ -2575,7 +2592,12 @@ get_v2ray_vmess_URL_link() {
echo echo
echo -e ${cyan}$vmess${none} echo -e ${cyan}$vmess${none}
echo echo
rm -rf /etc/v2ray/vmess_qr.json if [[ -f /etc/v2ray/vmess_qrv6.json ]]; then
local vmessv6="vmess://$(cat /etc/v2ray/vmess_qrv6.json | base64 -w 0)"
echo "IPv6:地址直链:"
echo -e ${cyan}$vmessv6${none}
fi
rm -f /etc/v2ray/vmess_qr.json /etc/v2ray/vmess_qrv6.json
} }
other() { other() {
while :; do while :; do

Loading…
Cancel
Save