├── README.md ├── config.json ├── config.properties ├── deploy_node-backup.sh ├── deploy_node.sh ├── install-release.sh ├── resource ├── Caddyfile ├── caddy │ ├── 0.11.5 │ │ ├── caddy_linux_386.tar.gz │ │ └── caddy_linux_amd64.tar.gz │ └── 1.0.4 │ │ ├── caddy_linux_386.tar.gz │ │ └── caddy_linux_amd64.tar.gz ├── v2ray-config.json └── www.zip ├── ssrpanel-v2ray-java.zip ├── ssrpanel-v2ray-old.jar ├── ssrpanel-v2ray.jar ├── v2-test.sh ├── v2.sh └── v4.31.0 ├── config.json ├── geoip-only-cn-private.dat ├── geoip.dat ├── geosite.dat ├── systemd └── system │ ├── v2ray.service │ └── v2ray@.service ├── v2ctl ├── v2ray ├── vpoint_socks_vmess.json └── vpoint_vmess_freedom.json /README.md: -------------------------------------------------------------------------------- 1 | # ssrpanel-v2ray-java 2 | ~~基本完事了,不会再更新了。~~ 3 | 好吧,我又更新了。把文件从上往下翻了个遍改了一下更新地址到[v2fly](https://github.com/v2fly/v2ray-core)的库了。 4 | > ~~本意是方便自己复制粘贴新建小鸡的项目,让胖虎大佬反向star受宠若惊,连滚带爬的修改了一下readme以示敬意。~~ 5 | > 此为ssrpanel面板(4.8.0)对应的V2ray后端。整理自[MoeGrid](https://github.com/MoeGrid/ssrpanel-v2ray)大佬和[ColetteContreras]( https://github.com/ColetteContreras/v2ray-ssrpanel-plugin)大佬+个人修改部分内容 6 | > 不建议内存低于512M超小鸡使用,java本身占用内存很高。 7 | > 默认模式为ws+tls,每天0点自动检查v2ray更新,因此基本不用管它。 8 | > 虽然被胖虎大佬说java后台简陋,但是他真的很少出问题并且能随时更新后端啊.jpg 9 | 10 | *** 11 | * [安装JDK](#安装JDK) 12 | * [安装和调试](#安装和调试) 13 | * [脚本使用方法](#脚本使用方法) 14 | * [修改时区](#修改时区) 15 | * [安装caddy对接](#安装caddy对接) 16 | * [配置宝塔面板对接](#配置宝塔面板对接) 17 | * [安装锐速](#安装锐速) 18 | *** 19 | #### 安装JDK 20 | ``` 21 | # ubuntu 22 | sudo apt-get install default-jdk 23 | # centos 24 | yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel 25 | ``` 26 | *** 27 | #### 安装和调试 28 | > 下载部署文件 29 | ``` 30 | git clone https://github.com/fei5seven/ssrpanel-v2ray-java.git /v2ray 31 | chmod -R a+x /v2ray 32 | cd /v2ray 33 | ``` 34 | 35 | > 修改 config.properties 文件 36 | 几个重点配置项说明 37 | ``` 38 | - v2ray.system (操作系统,可选值:linux、windows) 39 | - v2ray.arch (操作系统位数,可选值:32、64) 40 | - node.traffic-rate (与面板里设定的流量比例一致) 41 | - v2ray.tag (VMess协议的tag) 42 | - v2ray.alter-id (与面板里设定的额外ID一致) 43 | - v2ray.level (用户等级,暂无用) 44 | ``` 45 | ~~上面用默认参数就好,现在也没小鸡还32位了吧=,=~~ 46 | > 数据库配置(远程连接SSRPanel的数据库,必须严格填写) 47 | ``` 48 | - node.id (面板添加节点后得到的节点ID) 49 | - datasource.url (数据库的连接URL, 格式为 jdbc:mysql://地址:端口/数据库名称?serverTimezone=GMT%2B8) 50 | - datasource.username (用户名) 51 | - datasource.password (密码) 52 | ``` 53 | > 执行一次部署 54 | ``` 55 | java -jar ssrpanel-v2ray.jar 56 | ``` 57 | > 添加开机启动 58 | ``` 59 | vim /etc/rc.local 60 | bash /v2ray/v2.sh start 61 | ``` 62 | 如果能正确获取用户数就基本没问题了。报错的话基本就是数据库配置这里的填写错误了。 63 | *** 64 | #### 脚本使用方法 65 | 控制v2ray和java控制器的启动停止等。 66 | ```` 67 | bash /v2ray/v2.sh {start|stop|status|restart} 68 | ```` 69 | *** 70 | #### 修改时区 71 | 为的是对接面板的流量统计 72 | ```` 73 | cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 74 | ```` 75 | 或者 76 | (推荐) 77 | ```` 78 | dpkg-reconfigure tzdata 79 | 80 | ```` 81 | *** 82 | #### 安装caddy对接 83 | 选择3,端口默认10086(也可作为大佬的v2ray GO版一键懒人安装方式) 84 | ``` 85 | bash <(wget --no-check-certificate -qO- https://git.io/deploy_node.sh) 86 | ``` 87 | *** 88 | #### 配置宝塔面板对接 89 | 最后一个}前加入如下代码 90 | ``` 91 | location /ray { 92 | proxy_redirect off; 93 | proxy_pass http://127.0.0.1:10000;#假设WebSocket监听在环回地址的10000端口上 94 | proxy_http_version 1.1; 95 | proxy_set_header Upgrade $http_upgrade; 96 | proxy_set_header Connection "upgrade"; 97 | proxy_set_header Host $http_host; 98 | } 99 | ``` 100 | #### [安装锐速](https://github.com/fei5seven/lotServer) 101 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "access": "./access.log", 4 | "error": "./error.log", 5 | "loglevel": "error" 6 | }, 7 | "api": { 8 | "services": [ 9 | "HandlerService", 10 | "StatsService" 11 | ], 12 | "tag": "api" 13 | }, 14 | "stats": {}, 15 | "inbounds": [ 16 | { 17 | "listen": "127.0.0.1", 18 | "port": 10087, 19 | "protocol": "dokodemo-door", 20 | "settings": { 21 | "address": "127.0.0.1" 22 | }, 23 | "tag": "api" 24 | }, 25 | { 26 | "tag": "proxy", 27 | "listen": "127.0.0.1", 28 | "port": 10086, 29 | "protocol": "vmess", 30 | "settings": { 31 | "clients": [], 32 | "disableInsecureEncryption": false, 33 | "default": { 34 | "level": 0, 35 | "alterId": 16 36 | } 37 | }, 38 | "streamSettings": { 39 | "network": "ws", 40 | "wsSettings": { 41 | "path": "/game" 42 | } 43 | } 44 | } 45 | ], 46 | "outbounds": [ 47 | { 48 | "protocol": "freedom", 49 | "settings": {} 50 | } 51 | ], 52 | "routing": { 53 | "rules": [ 54 | { 55 | "inboundTag": [ 56 | "api" 57 | ], 58 | "outboundTag": "api", 59 | "type": "field" 60 | } 61 | ] 62 | }, 63 | "policy": { 64 | "levels": { 65 | "1": { 66 | "statsUserUplink": true, 67 | "statsUserDownlink": true 68 | } 69 | } 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /config.properties: -------------------------------------------------------------------------------- 1 | ### V2ray配置 ### 2 | 3 | # 操作系统(windows,linux) 4 | v2ray.system=linux 5 | # 系统位数(32,64) 6 | v2ray.arch=64 7 | # 协议标签 8 | v2ray.tag=proxy 9 | # 额外ID 10 | v2ray.alter-id=16 11 | # 用户等级 12 | v2ray.level=1 13 | 14 | ### 节点配置 ### 15 | 16 | # 节点ID 17 | node.id=5 18 | # 检查时间(秒) 19 | node.check-rate=60 20 | # 流量比例 21 | node.traffic-rate=1.0 22 | 23 | ### 数据库配置 ### 24 | 25 | datasource.url=jdbc:mysql://1.1.1.1:3306/ssrpanel?serverTimezone=GMT%2B8 26 | datasource.username=ssrpanel 27 | datasource.password=ssrpanel 28 | datasource.hikari.maximum-pool-size=10 29 | datasource.hikari.minimum-idle=3 30 | -------------------------------------------------------------------------------- /deploy_node-backup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS7, Ubuntu, Root Permission # 6 | # Description: panel node deploy script # 7 | # Version: 1.1.0 # 8 | # Author: 阿拉凹凸曼 # 9 | # Intro: https://sobaigu.com/ # 10 | #================================================================== 11 | 12 | [ $(id -u) != "0" ] && { echo "错误: 请用root执行"; exit 1; } 13 | sys_bit=$(uname -m) 14 | if [[ -f /usr/bin/apt ]] || [[ -f /usr/bin/yum && -f /bin/systemctl ]]; then 15 | if [[ -f /usr/bin/yum ]]; then 16 | cmd="yum" 17 | $cmd -y install epel-release 18 | fi 19 | if [[ -f /usr/bin/apt ]]; then 20 | cmd="apt" 21 | fi 22 | if [[ -f /bin/systemctl ]]; then 23 | systemd=true 24 | fi 25 | 26 | else 27 | echo -e " 哈哈……这个 ${red}辣鸡脚本${none} 只支持CentOS7+及Ubuntu14+ ${yellow}(-_-) ${none}" && exit 1 28 | fi 29 | 30 | service_Cmd() { 31 | if [[ $systemd ]]; then 32 | systemctl $1 $2 33 | else 34 | service $2 $1 35 | fi 36 | } 37 | 38 | $cmd update -y 39 | $cmd install -y wget curl unzip git gcc vim lrzsz screen ntp ntpdate cron net-tools telnet python-pip m2crypto 40 | # 设置时区为CST 41 | echo yes | cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 42 | ntpdate cn.pool.ntp.org 43 | hwclock -w 44 | sed -i '/^.*ntpdate*/d' /etc/crontab 45 | sed -i '$a\* * * * 1 ntpdate cn.pool.ntp.org >> /dev/null 2>&1' /etc/crontab 46 | service_Cmd restart crond 47 | 48 | error() { 49 | 50 | echo -e "\n$red 输入错误!$none\n" 51 | 52 | } 53 | pause() { 54 | 55 | read -rsp "$(echo -e "按$green Enter 回车键 $none继续....或按$red Ctrl + C $none取消.")" -d $'\n' 56 | echo 57 | } 58 | get_ip() { 59 | ip=$(curl -s https://ipinfo.io/ip) 60 | [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) 61 | [[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) 62 | [[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) 63 | [[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) 64 | [[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") 65 | [[ -z $ip ]] && ip=$(curl -s icanhazip.com) 66 | [[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") 67 | [[ -z $ip ]] && echo -e "\n$red 这小鸡鸡还是割了吧!$none\n" && exit 68 | } 69 | 70 | config_v2ray_caddy() { 71 | read -p "伪装域名,如 sobaigu.com :" fake_Domain 72 | [ -z "$fake_Domain" ] && fake_Domain=":80 :443" 73 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 74 | [ -z "$forward_Path" ] && forward_Path="game" 75 | read -p "$(echo -e "$yellow V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 76 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 77 | read -p "$(echo -e "$yellow V2Ray额外ID$none(默认:${cyan}16$none)"):" alter_Id 78 | [ -z "$alter_Id" ] && alter_Id="16" 79 | read -p "$(echo -e "$yellow配置同步端口$none(不可80/443,默认:${cyan}10087$none)"):" usersync_Port 80 | [ -z "$usersync_Port" ] && usersync_Port="10087" 81 | read -p "面板分配的节点ID,如 6 :" node_Id 82 | read -p "数据库地址,如 1.1.1.1 :" db_Host 83 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}3306$none)"):" db_Port 84 | [ -z "$db_Port" ] && db_Port="3306" 85 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 86 | [ -z "$db_Name" ] && db_Name="ssrpanel" 87 | read -p "$(echo -e "$yellow数据库用户$none(默认:${cyan}ssrpanel$none)"):" db_User 88 | [ -z "$db_User" ] && db_User="ssrpanel" 89 | read -p "数据库密码,如 ssrpanel :" db_Password 90 | install_caddy 91 | install_v2ray 92 | firewall_set 93 | service_Cmd status caddy 94 | service_Cmd status v2ray 95 | } 96 | 97 | config_v2ray() { 98 | read -p "面板分配的节点ID,如 6 :" node_Id 99 | read -p "$(echo -e "$yellow V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 100 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 101 | read -p "$(echo -e "$yellow配置同步端口$none(不可80/443,默认:${cyan}10087$none)"):" usersync_Port 102 | [ -z "$usersync_Port" ] && usersync_Port="10087" 103 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 104 | [ -z "$forward_Path" ] && forward_Path="game" 105 | read -p "$(echo -e "$yellow V2Ray额外ID$none(默认:${cyan}16$none)"):" alter_Id 106 | [ -z "$alter_Id" ] && alter_Id="16" 107 | read -p "数据库地址,如 1.1.1.1 :" db_Host 108 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}3306$none)"):" db_Port 109 | [ -z "$db_Port" ] && db_Port="3306" 110 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 111 | [ -z "$db_Name" ] && db_Name="ssrpanel" 112 | read -p "$(echo -e "$yellow数据库用户$none(默认:${cyan}ssrpanel$none)"):" db_User 113 | [ -z "$db_User" ] && db_User="ssrpanel" 114 | read -p "数据库密码,如 ssrpanel :" db_Password 115 | install_v2ray 116 | firewall_set 117 | service_Cmd status v2ray 118 | echo -e "默认日志输出级别为debug,搞定后建议修改为error" 119 | echo -e "完整配置示例可以参考这里:http://sobaigu.com/ssrpanel-v2ray-go.html#V2Ray" 120 | } 121 | 122 | config_caddy() { 123 | read -p "伪装域名,如 sobaigu.com :" fake_Domain 124 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 125 | [ -z "$forward_Path" ] && forward_Path="game" 126 | read -p "$(echo -e "$yellow转发到V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 127 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 128 | install_caddy 129 | firewall_set 130 | service_Cmd status caddy 131 | } 132 | 133 | install_v2ray(){ 134 | # 先卸载再装 135 | # original post https://github.com/v2ray/v2ray-core/issues/187 136 | systemctl stop v2ray 137 | rm -rf /usr/bin/v2ray /etc/init.d/v2ray /lib/systemd/system/v2ray.service 138 | echo "Logs and configurations are preserved, you can remove these manually" 139 | echo "logs directory: /var/log/v2ray" 140 | echo "configuration directory: /etc/v2ray" 141 | 142 | curl -L -s https://raw.githubusercontent.com/fei5seven/v2ray-ssrpanel-plugin/master/install-release.sh | bash 143 | wget --no-check-certificate -O config.json https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/v2ray-config.json 144 | sed -i -e "s/v2ray_Port/$v2ray_Port/g" config.json 145 | sed -i -e "s/alter_Id/$alter_Id/g" config.json 146 | sed -i -e "s/forward_Path/$forward_Path/g" config.json 147 | sed -i -e "s/usersync_Port/$usersync_Port/g" config.json 148 | sed -i -e "s/node_Id/$node_Id/g" config.json 149 | sed -i -e "s/db_Host/$db_Host/g" config.json 150 | sed -i -e "s/db_Port/$db_Port/g" config.json 151 | sed -i -e "s/db_Name/$db_Name/g" config.json 152 | sed -i -e "s/db_User/$db_User/g" config.json 153 | sed -i -e "s/db_Password/$db_Password/g" config.json 154 | mv -f config.json /etc/v2ray/ 155 | service_Cmd restart v2ray 156 | } 157 | 158 | install_caddy() { 159 | if [[ $cmd == "yum" ]]; then 160 | [[ $(pgrep "httpd") ]] && systemctl stop httpd 161 | [[ $(command -v httpd) ]] && yum remove httpd -y 162 | else 163 | [[ $(pgrep "apache2") ]] && service apache2 stop 164 | [[ $(command -v apache2) ]] && apt remove apache2* -y 165 | fi 166 | 167 | local caddy_tmp="/tmp/install_caddy/" 168 | local caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz" 169 | if [[ $sys_bit == "i386" || $sys_bit == "i686" ]]; then 170 | local caddy_download_link="https://caddyserver.com/download/linux/386?license=personal" 171 | elif [[ $sys_bit == "x86_64" ]]; then 172 | local caddy_download_link="https://caddyserver.com/download/linux/amd64?license=personal" 173 | else 174 | echo -e "$red 自动安装 Caddy 失败!不支持你的系统。$none" && exit 1 175 | fi 176 | 177 | mkdir -p $caddy_tmp 178 | 179 | if ! wget --no-check-certificate -O "$caddy_tmp_file" $caddy_download_link; then 180 | echo -e "$red 下载 Caddy 失败!$none" && exit 1 181 | fi 182 | 183 | tar zxf $caddy_tmp_file -C $caddy_tmp 184 | cp -f ${caddy_tmp}caddy /usr/local/bin/ 185 | 186 | if [[ ! -f /usr/local/bin/caddy ]]; then 187 | echo -e "$red 安装 Caddy 出错!" && exit 1 188 | fi 189 | 190 | setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/caddy 191 | 192 | if [[ $systemd ]]; then 193 | cp -f ${caddy_tmp}init/linux-systemd/caddy.service /lib/systemd/system/ 194 | # sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service 195 | sed -i "s/on-failure/always/" /lib/systemd/system/caddy.service 196 | systemctl enable caddy 197 | else 198 | cp -f ${caddy_tmp}init/linux-sysvinit/caddy /etc/init.d/caddy 199 | # sed -i "s/www-data/root/g" /etc/init.d/caddy 200 | chmod +x /etc/init.d/caddy 201 | update-rc.d -f caddy defaults 202 | fi 203 | 204 | mkdir -p /etc/ssl/caddy 205 | 206 | if [ -z "$(grep www-data /etc/passwd)" ]; then 207 | useradd -M -s /usr/sbin/nologin www-data 208 | fi 209 | chown -R www-data.www-data /etc/ssl/caddy 210 | rm -rf $caddy_tmp 211 | echo -e "Caddy安装完成!" 212 | 213 | # 放个本地游戏网站 214 | wget --no-check-certificate -O www.zip https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/www.zip 215 | unzip -n www.zip -d /srv/ && rm -f www.zip 216 | # 修改配置 217 | mkdir -p /etc/caddy/ 218 | wget --no-check-certificate -O Caddyfile https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/Caddyfile 219 | local user_Name=$(((RANDOM << 22))) 220 | sed -i -e "s/user_Name/$user_Name/g" Caddyfile 221 | sed -i -e "s/fake_Domain/$fake_Domain/g" Caddyfile 222 | sed -i -e "s/forward_Path/$forward_Path/g" Caddyfile 223 | sed -i -e "s/v2ray_Port/$v2ray_Port/g" Caddyfile 224 | mv -f Caddyfile /etc/caddy/ 225 | service_Cmd restart caddy 226 | } 227 | 228 | # Firewall 229 | firewall_set(){ 230 | echo -e "[${green}Info${plain}] firewall set start..." 231 | if command -v firewall-cmd >/dev/null 2>&1; then 232 | systemctl status firewalld > /dev/null 2>&1 233 | if [ $? -eq 0 ]; then 234 | firewall-cmd --permanent --zone=public --remove-port=443/tcp 235 | firewall-cmd --permanent --zone=public --remove-port=80/tcp 236 | firewall-cmd --permanent --zone=public --add-port=443/tcp 237 | firewall-cmd --permanent --zone=public --add-port=80/tcp 238 | if [[ $v2ray_Port ]]; then 239 | firewall-cmd --permanent --zone=public --remove-port=${v2ray_Port}/tcp 240 | firewall-cmd --permanent --zone=public --remove-port=${v2ray_Port}/udp 241 | firewall-cmd --permanent --zone=public --add-port=${v2ray_Port}/tcp 242 | firewall-cmd --permanent --zone=public --add-port=${v2ray_Port}/udp 243 | firewall-cmd --reload 244 | fi 245 | if [[ $single_Port_Num ]]; then 246 | firewall-cmd --permanent --zone=public --remove-port=${single_Port_Num}/tcp 247 | firewall-cmd --permanent --zone=public --remove-port=${single_Port_Num}/udp 248 | firewall-cmd --permanent --zone=public --add-port=${single_Port_Num}/tcp 249 | firewall-cmd --permanent --zone=public --add-port=${single_Port_Num}/udp 250 | firewall-cmd --reload 251 | fi 252 | else 253 | echo -e "[${yellow}Warning${plain}] firewalld looks like not running or not installed, please manually set it if necessary." 254 | fi 255 | elif command -v iptables >/dev/null 2>&1; then 256 | /etc/init.d/iptables status > /dev/null 2>&1 257 | if [ $? -eq 0 ]; then 258 | iptables -D INPUT -p tcp --dport 443 -j ACCEPT 259 | iptables -D INPUT -p tcp --dport 80 -j ACCEPT 260 | iptables -A INPUT -p tcp --dport 443 -j ACCEPT 261 | iptables -A INPUT -p tcp --dport 80 -j ACCEPT 262 | ip6tables -D INPUT -p tcp --dport 443 -j ACCEPT 263 | ip6tables -D INPUT -p tcp --dport 80 -j ACCEPT 264 | ip6tables -A INPUT -p tcp --dport 443 -j ACCEPT 265 | ip6tables -A INPUT -p tcp --dport 80 -j ACCEPT 266 | iptables -L -n | grep -i ${v2ray_Port} > /dev/null 2>&1 267 | if [ $? -ne 0 ]; then 268 | iptables -D INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 269 | iptables -A INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 270 | iptables -D INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 271 | iptables -A INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 272 | ip6tables -D INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 273 | ip6tables -A INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 274 | ip6tables -D INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 275 | ip6tables -A INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 276 | /etc/init.d/iptables save 277 | /etc/init.d/iptables restart 278 | /etc/init.d/ip6tables save 279 | /etc/init.d/ip6tables restart 280 | else 281 | echo -e "[${green}Info${plain}] port 80, 443, ${v2ray_Port} has been set up." 282 | fi 283 | iptables -L -n | grep -i ${single_Port_Num} > /dev/null 2>&1 284 | if [ $? -ne 0 ]; then 285 | iptables -D INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 286 | iptables -A INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 287 | iptables -D INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 288 | iptables -A INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 289 | ip6tables -D INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 290 | ip6tables -A INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 291 | ip6tables -D INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 292 | ip6tables -A INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 293 | /etc/init.d/iptables save 294 | /etc/init.d/iptables restart 295 | /etc/init.d/ip6tables save 296 | /etc/init.d/ip6tables restart 297 | else 298 | echo -e "[${green}Info${plain}] port 80, 443, ${single_Port_Num} has been set up." 299 | fi 300 | else 301 | echo -e "[${yellow}Warning${plain}] iptables looks like shutdown or not installed, please manually set it if necessary." 302 | fi 303 | fi 304 | echo -e "[${green}Info${plain}] firewall set completed..." 305 | } 306 | 307 | install_ssr(){ 308 | clear 309 | cd /usr/ 310 | rm -rf /usr/shadowsocksr 311 | echo 'SSR下载中...' 312 | git clone -b master https://github.com/fei5seven/shadowsocksr.git && cd shadowsocksr && bash initcfg.sh 313 | pip install --upgrade setuptools && pip install -r requestment.txt 314 | echo 'SSR安装完成' 315 | echo '开始配置节点连接信息...' 316 | read -p "数据库服务器地址:" db_Host 317 | read -p "$(echo -e "$yellow数据库连接端口$none(默认:${cyan}3306$none)"):" db_Port 318 | [ -z "$db_Port" ] && db_Port="3306" 319 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 320 | [ -z "$db_Name" ] && db_Name="ssrpanel" 321 | read -p "$(echo -e "$yellow数据库用户名$none(默认:${cyan}ssrpanel$none)"):" db_User 322 | [ -z "$db_User" ] && db_User="ssrpanel" 323 | read -p "$(echo -e "$yellow数据库密码$none(默认:${cyan}ssrpanel$none)"):" db_Password 324 | [ -z "$db_Password" ] && db_Password="ssrpanel" 325 | read -p "本节点ID:" node_Id 326 | read -p "$(echo -e "$yellow流量计算比例$none(默认:${cyan}1.5$none)"):" transfer_Ratio 327 | [ -z "$transfer_Ratio" ] && transfer_Ratio="1.5" 328 | sed -i -e "s/db_Host/$db_Host/g" usermysql.json 329 | sed -i -e "s/db_Port/$db_Port/g" usermysql.json 330 | sed -i -e "s/db_Name/$db_Name/g" usermysql.json 331 | sed -i -e "s/db_User/$db_User/g" usermysql.json 332 | sed -i -e "s/db_Password/$db_Password/g" usermysql.json 333 | sed -i -e "s/node_Id/$node_Id/g" usermysql.json 334 | sed -i -e "s/transfer_Ratio/$transfer_Ratio/g" usermysql.json 335 | echo -e "配置完成!\n如果无法连上数据库,请检查本机防火墙或者数据库防火墙!\n下一步配置user-config.json,配置节点加密方式、混淆、协议等" 336 | 337 | echo -e "是否强制单端口:"$yellow"true"" or "$yellow"false"$none 338 | read -p "$(echo -e "(默认:${cyan}true$none)"):" single_Port_Enable 339 | [ -z "$single_Port_Enable" ] && single_Port_Enable="true" 340 | read -p "$(echo -e "$yellow输入单端口号$none(默认:${cyan}8080$none)"):" single_Port_Num 341 | [ -z "$single_Port_Num" ] && single_Port_Num="8080" 342 | read -p "$(echo -e "$yellow设置认证密码$none(默认:${cyan}forvip$none)"):" ss_Password 343 | [ -z "$ss_Password" ] && ss_Password="forvip" 344 | 345 | echo -e "选择加密方式:$yellow \n1. none\n2. rc4-md5\n3. aes-256-cfb\n4. chacha20"$none 346 | read -p "$(echo -e "(默认:${cyan}2. rc4-md5$none)"):" ss_method 347 | [ -z "$ss_method" ] && ss_method="rc4-md5" 348 | if [[ $ss_method ]]; then 349 | case $ss_method in 350 | 1) 351 | ss_method="none" 352 | ;; 353 | 2) 354 | ss_method="rc4-md5" 355 | ;; 356 | 3) 357 | ss_method="aes-256-cfb" 358 | ;; 359 | 4) 360 | ss_method="chacha20" 361 | ;; 362 | esac 363 | fi 364 | 365 | echo -e "选择传输协议:$yellow \n1. origin\n2. auth_sha1_v4\n3. auth_aes128_md5\n4. auth_chain_a"$none 366 | read -p "$(echo -e "(默认:${cyan}3. auth_aes128_md5$none)"):" ss_protocol 367 | [ -z "$ss_protocol" ] && ss_protocol="auth_aes128_md5" 368 | if [[ $ss_protocol ]]; then 369 | case $ss_protocol in 370 | 1) 371 | ss_protocol="origin" 372 | ;; 373 | 2) 374 | ss_protocol="auth_sha1_v4" 375 | ;; 376 | 3) 377 | ss_protocol="auth_aes128_md5" 378 | ;; 379 | 4) 380 | ss_protocol="auth_chain_a" 381 | ;; 382 | esac 383 | fi 384 | 385 | echo -e "选择混淆方式:$yellow \n1. plain\n2. http_simple\n3. http_post\n4. tls1.2_ticket_auth"$none 386 | read -p "$(echo -e "(默认:${cyan}2. http_simple$none)"):" ss_obfs 387 | [ -z "$ss_obfs" ] && ss_obfs="http_simple" 388 | if [[ $ss_obfs ]]; then 389 | case $ss_obfs in 390 | 1) 391 | ss_obfs="plain" 392 | ;; 393 | 2) 394 | ss_obfs="http_simple" 395 | ;; 396 | 3) 397 | ss_obfs="http_post" 398 | ;; 399 | 4) 400 | ss_obfs="tls1.2_ticket_auth" 401 | ;; 402 | esac 403 | fi 404 | 405 | read -p "$(echo -e "输入限制使用设备数:(默认:${cyan}不限制,直接回车即可$none)"):" ss_Online_Num 406 | [ -z "$ss_Online_Num" ] && ss_Online_Num="" 407 | 408 | read -p "$(echo -e "用户限速值(K):(默认:${cyan}不限制,直接回车即可$none)"):" ss_Ban_Limit 409 | [ -z "$ss_Ban_Limit" ] && ss_Ban_Limit="0" 410 | 411 | sed -i -e "s/single_Port_Enable/$single_Port_Enable/g" user-config.json 412 | sed -i -e "s/single_Port_Num/$single_Port_Num/g" user-config.json 413 | sed -i -e "s/ss_Password/$ss_Password/g" user-config.json 414 | sed -i -e "s/ss_method/$ss_method/g" user-config.json 415 | sed -i -e "s/ss_protocol/$ss_protocol/g" user-config.json 416 | sed -i -e "s/ss_obfs/$ss_obfs/g" user-config.json 417 | sed -i -e "s/ss_Online_Num/$ss_Online_Num/g" user-config.json 418 | sed -i -e "s/ss_Ban_Limit/$ss_Ban_Limit/g" user-config.json 419 | 420 | #启动并设置开机自动运行 421 | chmod +x run.sh && ./run.sh 422 | sed -i "/shadowsocksr\/run.sh$/d" /etc/rc.d/rc.local 423 | echo "/usr/shadowsocksr/run.sh" >> /etc/rc.d/rc.local 424 | firewall_set 425 | } 426 | 427 | open_bbr(){ 428 | cd 429 | wget -N --no-check-certificate "https://raw.githubusercontent.com/fei5seven/Shell-1/master/bbr_tcp_mod.sh" 430 | bash bbr_tcp_mod.sh 431 | } 432 | 433 | echo -e "1.Install V2Ray+Caddy" 434 | echo -e "2.Install V2Ray" 435 | echo -e "3.Install Caddy" 436 | echo -e "4.Install SSR" 437 | echo -e "5.Open BBR" 438 | read -p "请输入数字进行安装[1-5]:" menu_Num 439 | case "$menu_Num" in 440 | 1) 441 | config_v2ray_caddy 442 | ;; 443 | 2) 444 | config_v2ray 445 | ;; 446 | 3) 447 | config_caddy 448 | ;; 449 | 4) 450 | install_ssr 451 | ;; 452 | 5) 453 | open_bbr 454 | ;; 455 | *) 456 | echo "请输入正确数字[1-5]:" 457 | ;; 458 | esac -------------------------------------------------------------------------------- /deploy_node.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin 3 | export PATH 4 | #=================================================================# 5 | # System Required: CentOS7, Ubuntu, Root Permission # 6 | # Description: panel node deploy script # 7 | # Version: 1.1.0 # 8 | # Author: fei5seven # 9 | # Intro: # 10 | #================================================================== 11 | 12 | [ $(id -u) != "0" ] && { echo "错误: 请用root执行"; exit 1; } 13 | sys_bit=$(uname -m) 14 | if [[ -f /usr/bin/apt ]] || [[ -f /usr/bin/yum && -f /bin/systemctl ]]; then 15 | if [[ -f /usr/bin/yum ]]; then 16 | cmd="yum" 17 | $cmd -y install epel-release 18 | fi 19 | if [[ -f /usr/bin/apt ]]; then 20 | cmd="apt" 21 | fi 22 | if [[ -f /bin/systemctl ]]; then 23 | systemd=true 24 | fi 25 | 26 | else 27 | echo -e " 哈哈……这个 ${red}辣鸡脚本${none} 只支持CentOS7+及Ubuntu14+ ${yellow}(-_-) ${none}" && exit 1 28 | fi 29 | 30 | service_Cmd() { 31 | if [[ $systemd ]]; then 32 | systemctl $1 $2 33 | else 34 | service $2 $1 35 | fi 36 | } 37 | 38 | $cmd –exclude=kernel* update -y 39 | $cmd install -y wget curl unzip git gcc vim lrzsz screen ntp ntpdate cron net-tools telnet python-pip m2crypto 40 | # 设置时区为CST 41 | echo yes | cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime 42 | ntpdate cn.pool.ntp.org 43 | hwclock -w 44 | sed -i '/^.*ntpdate*/d' /etc/crontab 45 | sed -i '$a\* * * * 1 ntpdate cn.pool.ntp.org >> /dev/null 2>&1' /etc/crontab 46 | service_Cmd restart crond 47 | 48 | error() { 49 | 50 | echo -e "\n$red 输入错误!$none\n" 51 | 52 | } 53 | pause() { 54 | 55 | read -rsp "$(echo -e "按$green Enter 回车键 $none继续....或按$red Ctrl + C $none取消.")" -d $'\n' 56 | echo 57 | } 58 | get_ip() { 59 | ip=$(curl -s https://ipinfo.io/ip) 60 | [[ -z $ip ]] && ip=$(curl -s https://api.ip.sb/ip) 61 | [[ -z $ip ]] && ip=$(curl -s https://api.ipify.org) 62 | [[ -z $ip ]] && ip=$(curl -s https://ip.seeip.org) 63 | [[ -z $ip ]] && ip=$(curl -s https://ifconfig.co/ip) 64 | [[ -z $ip ]] && ip=$(curl -s https://api.myip.com | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") 65 | [[ -z $ip ]] && ip=$(curl -s icanhazip.com) 66 | [[ -z $ip ]] && ip=$(curl -s myip.ipip.net | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}") 67 | [[ -z $ip ]] && echo -e "\n$red 这小鸡鸡还是割了吧!$none\n" && exit 68 | } 69 | 70 | config_v2ray_caddy() { 71 | read -p "伪装域名,如 sobaigu.com :" fake_Domain 72 | [ -z "$fake_Domain" ] && fake_Domain=":80 :443" 73 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 74 | [ -z "$forward_Path" ] && forward_Path="game" 75 | read -p "$(echo -e "$yellow V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 76 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 77 | read -p "$(echo -e "$yellow V2Ray额外ID$none(默认:${cyan}16$none)"):" alter_Id 78 | [ -z "$alter_Id" ] && alter_Id="16" 79 | read -p "$(echo -e "$yellow配置同步端口$none(不可80/443,默认:${cyan}10087$none)"):" usersync_Port 80 | [ -z "$usersync_Port" ] && usersync_Port="10087" 81 | read -p "面板分配的节点ID,如 6 :" node_Id 82 | read -p "数据库地址,如 1.1.1.1 :" db_Host 83 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}3306$none)"):" db_Port 84 | [ -z "$db_Port" ] && db_Port="3306" 85 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 86 | [ -z "$db_Name" ] && db_Name="ssrpanel" 87 | read -p "$(echo -e "$yellow数据库用户$none(默认:${cyan}ssrpanel$none)"):" db_User 88 | [ -z "$db_User" ] && db_User="ssrpanel" 89 | read -p "数据库密码,如 ssrpanel :" db_Password 90 | install_caddy 91 | install_v2ray 92 | firewall_set 93 | service_Cmd status caddy 94 | service_Cmd status v2ray 95 | } 96 | 97 | config_v2ray() { 98 | read -p "面板分配的节点ID,如 6 :" node_Id 99 | read -p "$(echo -e "$yellow V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 100 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 101 | read -p "$(echo -e "$yellow配置同步端口$none(不可80/443,默认:${cyan}10087$none)"):" usersync_Port 102 | [ -z "$usersync_Port" ] && usersync_Port="10087" 103 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 104 | [ -z "$forward_Path" ] && forward_Path="game" 105 | read -p "$(echo -e "$yellow V2Ray额外ID$none(默认:${cyan}16$none)"):" alter_Id 106 | [ -z "$alter_Id" ] && alter_Id="16" 107 | read -p "数据库地址,如 1.1.1.1 :" db_Host 108 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}3306$none)"):" db_Port 109 | [ -z "$db_Port" ] && db_Port="3306" 110 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 111 | [ -z "$db_Name" ] && db_Name="ssrpanel" 112 | read -p "$(echo -e "$yellow数据库用户$none(默认:${cyan}ssrpanel$none)"):" db_User 113 | [ -z "$db_User" ] && db_User="ssrpanel" 114 | read -p "数据库密码,如 ssrpanel :" db_Password 115 | install_v2ray 116 | firewall_set 117 | service_Cmd status v2ray 118 | echo -e "默认日志输出级别为debug,搞定后建议修改为error" 119 | echo -e "完整配置示例可以参考这里:http://sobaigu.com/ssrpanel-v2ray-go.html#V2Ray" 120 | } 121 | 122 | config_caddy() { 123 | read -p "伪装域名,如 sobaigu.com :" fake_Domain 124 | read -p "$(echo -e "$yellow转发路径$none(不要带/,默认:${cyan}game$none)"):" forward_Path 125 | [ -z "$forward_Path" ] && forward_Path="game" 126 | read -p "$(echo -e "$yellow转发到V2Ray端口$none(不可80/443,默认:${cyan}10086$none)"):" v2ray_Port 127 | [ -z "$v2ray_Port" ] && v2ray_Port="10086" 128 | install_caddy 129 | firewall_set 130 | service_Cmd status caddy 131 | } 132 | 133 | install_v2ray(){ 134 | # 先卸载再装 135 | # original post https://github.com/v2ray/v2ray-core/issues/187 136 | systemctl stop v2ray 137 | rm -rf /usr/bin/v2ray /etc/init.d/v2ray /lib/systemd/system/v2ray.service 138 | echo "Logs and configurations are preserved, you can remove these manually" 139 | echo "logs directory: /var/log/v2ray" 140 | echo "configuration directory: /etc/v2ray" 141 | 142 | curl -L -s https://raw.githubusercontent.com/fei5seven/v2ray-ssrpanel-plugin/master/install-release.sh | bash 143 | wget --no-check-certificate -O config.json https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/v2ray-config.json 144 | sed -i -e "s/v2ray_Port/$v2ray_Port/g" config.json 145 | sed -i -e "s/alter_Id/$alter_Id/g" config.json 146 | sed -i -e "s/forward_Path/$forward_Path/g" config.json 147 | sed -i -e "s/usersync_Port/$usersync_Port/g" config.json 148 | sed -i -e "s/node_Id/$node_Id/g" config.json 149 | sed -i -e "s/db_Host/$db_Host/g" config.json 150 | sed -i -e "s/db_Port/$db_Port/g" config.json 151 | sed -i -e "s/db_Name/$db_Name/g" config.json 152 | sed -i -e "s/db_User/$db_User/g" config.json 153 | sed -i -e "s/db_Password/$db_Password/g" config.json 154 | mv -f config.json /etc/v2ray/ 155 | service_Cmd restart v2ray 156 | } 157 | 158 | install_caddy() { 159 | if [[ $cmd == "yum" ]]; then 160 | [[ $(pgrep "httpd") ]] && systemctl stop httpd 161 | [[ $(command -v httpd) ]] && yum remove httpd -y 162 | else 163 | [[ $(pgrep "apache2") ]] && service apache2 stop 164 | [[ $(command -v apache2) ]] && apt remove apache2* -y 165 | fi 166 | 167 | local caddy_tmp="/tmp/install_caddy/" 168 | local caddy_tmp_file="/tmp/install_caddy/caddy.tar.gz" 169 | if [[ $sys_bit == "i386" || $sys_bit == "i686" ]]; then 170 | local caddy_download_link="https://github.com/fei5seven/ssrpanel-v2ray-java/raw/master/resource/caddy/0.11.5/caddy_linux_386.tar.gz" 171 | elif [[ $sys_bit == "x86_64" ]]; then 172 | local caddy_download_link="https://github.com/fei5seven/ssrpanel-v2ray-java/raw/master/resource/caddy/0.11.5/caddy_linux_amd64.tar.gz" 173 | else 174 | echo -e "$red 自动安装 Caddy 失败!不支持你的系统。$none" && exit 1 175 | fi 176 | 177 | mkdir -p $caddy_tmp 178 | 179 | if ! wget --no-check-certificate -O "$caddy_tmp_file" $caddy_download_link; then 180 | echo -e "$red 下载 Caddy 失败!$none" && exit 1 181 | fi 182 | 183 | tar zxf $caddy_tmp_file -C $caddy_tmp 184 | cp -f ${caddy_tmp}caddy /usr/local/bin/ 185 | 186 | if [[ ! -f /usr/local/bin/caddy ]]; then 187 | echo -e "$red 安装 Caddy 出错!" && exit 1 188 | fi 189 | 190 | setcap CAP_NET_BIND_SERVICE=+eip /usr/local/bin/caddy 191 | 192 | if [[ $systemd ]]; then 193 | cp -f ${caddy_tmp}init/linux-systemd/caddy.service /lib/systemd/system/ 194 | # sed -i "s/www-data/root/g" /lib/systemd/system/caddy.service 195 | sed -i "s/on-failure/always/" /lib/systemd/system/caddy.service 196 | systemctl enable caddy 197 | else 198 | cp -f ${caddy_tmp}init/linux-sysvinit/caddy /etc/init.d/caddy 199 | # sed -i "s/www-data/root/g" /etc/init.d/caddy 200 | chmod +x /etc/init.d/caddy 201 | update-rc.d -f caddy defaults 202 | fi 203 | 204 | mkdir -p /etc/ssl/caddy 205 | 206 | if [ -z "$(grep www-data /etc/passwd)" ]; then 207 | useradd -M -s /usr/sbin/nologin www-data 208 | fi 209 | chown -R www-data.www-data /etc/ssl/caddy 210 | rm -rf $caddy_tmp 211 | echo -e "Caddy安装完成!" 212 | 213 | # 放个本地游戏网站 214 | wget --no-check-certificate -O www.zip https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/www.zip 215 | unzip -n www.zip -d /srv/ && rm -f www.zip 216 | # 修改配置 217 | mkdir -p /etc/caddy/ 218 | wget --no-check-certificate -O Caddyfile https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/master/resource/Caddyfile 219 | local user_Name=$(((RANDOM << 22))) 220 | sed -i -e "s/user_Name/$user_Name/g" Caddyfile 221 | sed -i -e "s/fake_Domain/$fake_Domain/g" Caddyfile 222 | sed -i -e "s/forward_Path/$forward_Path/g" Caddyfile 223 | sed -i -e "s/v2ray_Port/$v2ray_Port/g" Caddyfile 224 | mv -f Caddyfile /etc/caddy/ 225 | service_Cmd restart caddy 226 | } 227 | 228 | # Firewall 229 | firewall_set(){ 230 | echo -e "[${green}Info${plain}] firewall set start..." 231 | if command -v firewall-cmd >/dev/null 2>&1; then 232 | systemctl status firewalld > /dev/null 2>&1 233 | if [ $? -eq 0 ]; then 234 | firewall-cmd --permanent --zone=public --remove-port=443/tcp 235 | firewall-cmd --permanent --zone=public --remove-port=80/tcp 236 | firewall-cmd --permanent --zone=public --remove-port=443/udp 237 | firewall-cmd --permanent --zone=public --remove-port=80/udp 238 | firewall-cmd --permanent --zone=public --add-port=443/tcp 239 | firewall-cmd --permanent --zone=public --add-port=80/tcp 240 | firewall-cmd --permanent --zone=public --add-port=443/udp 241 | firewall-cmd --permanent --zone=public --add-port=80/udp 242 | firewall-cmd --reload 243 | if [[ $v2ray_Port ]]; then 244 | firewall-cmd --permanent --zone=public --remove-port=${v2ray_Port}/tcp 245 | firewall-cmd --permanent --zone=public --remove-port=${v2ray_Port}/udp 246 | firewall-cmd --permanent --zone=public --add-port=${v2ray_Port}/tcp 247 | firewall-cmd --permanent --zone=public --add-port=${v2ray_Port}/udp 248 | firewall-cmd --reload 249 | fi 250 | if [[ $single_Port_Num ]]; then 251 | firewall-cmd --permanent --zone=public --remove-port=${single_Port_Num}/tcp 252 | firewall-cmd --permanent --zone=public --remove-port=${single_Port_Num}/udp 253 | firewall-cmd --permanent --zone=public --add-port=${single_Port_Num}/tcp 254 | firewall-cmd --permanent --zone=public --add-port=${single_Port_Num}/udp 255 | firewall-cmd --reload 256 | fi 257 | else 258 | echo -e "[${yellow}Warning${plain}] firewalld looks like not running or not installed, please manually set it if necessary." 259 | fi 260 | elif command -v iptables >/dev/null 2>&1; then 261 | /etc/init.d/iptables status > /dev/null 2>&1 262 | if [ $? -eq 0 ]; then 263 | iptables -D INPUT -p tcp --dport 443 -j ACCEPT 264 | iptables -D INPUT -p tcp --dport 80 -j ACCEPT 265 | iptables -A INPUT -p udp --dport 443 -j ACCEPT 266 | iptables -A INPUT -pudcp --dport 80 -j ACCEPT 267 | ip6tables -D INPUT -p tcp --dport 443 -j ACCEPT 268 | ip6tables -D INPUT -p tcp --dport 80 -j ACCEPT 269 | ip6tables -A INPUT -p udp --dport 443 -j ACCEPT 270 | ip6tables -A INPUT -p udp --dport 80 -j ACCEPT 271 | iptables -L -n | grep -i ${v2ray_Port} > /dev/null 2>&1 272 | if [ $? -ne 0 ]; then 273 | iptables -D INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 274 | iptables -A INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 275 | iptables -D INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 276 | iptables -A INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 277 | ip6tables -D INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 278 | ip6tables -A INPUT -p tcp --dport ${v2ray_Port} -j ACCEPT 279 | ip6tables -D INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 280 | ip6tables -A INPUT -p udp --dport ${v2ray_Port} -j ACCEPT 281 | /etc/init.d/iptables save 282 | /etc/init.d/iptables restart 283 | /etc/init.d/ip6tables save 284 | /etc/init.d/ip6tables restart 285 | else 286 | echo -e "[${green}Info${plain}] port 80, 443, ${v2ray_Port} has been set up." 287 | fi 288 | iptables -L -n | grep -i ${single_Port_Num} > /dev/null 2>&1 289 | if [ $? -ne 0 ]; then 290 | iptables -D INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 291 | iptables -A INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 292 | iptables -D INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 293 | iptables -A INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 294 | ip6tables -D INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 295 | ip6tables -A INPUT -p tcp --dport ${single_Port_Num} -j ACCEPT 296 | ip6tables -D INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 297 | ip6tables -A INPUT -p udp --dport ${single_Port_Num} -j ACCEPT 298 | /etc/init.d/iptables save 299 | /etc/init.d/iptables restart 300 | /etc/init.d/ip6tables save 301 | /etc/init.d/ip6tables restart 302 | else 303 | echo -e "[${green}Info${plain}] port 80, 443, ${single_Port_Num} has been set up." 304 | fi 305 | else 306 | echo -e "[${yellow}Warning${plain}] iptables looks like shutdown or not installed, please manually set it if necessary." 307 | fi 308 | fi 309 | echo -e "[${green}Info${plain}] firewall set completed..." 310 | } 311 | 312 | install_ssr(){ 313 | clear 314 | cd /usr/ 315 | rm -rf /usr/shadowsocksr 316 | echo 'SSR下载中...' 317 | git clone -b master https://github.com/fei5seven/shadowsocksr.git && cd shadowsocksr && bash initcfg.sh 318 | pip install --upgrade setuptools && pip install -r requestment.txt 319 | echo 'SSR安装完成' 320 | echo '开始配置节点连接信息...' 321 | read -p "数据库服务器地址:" db_Host 322 | read -p "$(echo -e "$yellow数据库连接端口$none(默认:${cyan}3306$none)"):" db_Port 323 | [ -z "$db_Port" ] && db_Port="3306" 324 | read -p "$(echo -e "$yellow数据库名称$none(默认:${cyan}ssrpanel$none)"):" db_Name 325 | [ -z "$db_Name" ] && db_Name="ssrpanel" 326 | read -p "$(echo -e "$yellow数据库用户名$none(默认:${cyan}ssrpanel$none)"):" db_User 327 | [ -z "$db_User" ] && db_User="ssrpanel" 328 | read -p "$(echo -e "$yellow数据库密码$none(默认:${cyan}ssrpanel$none)"):" db_Password 329 | [ -z "$db_Password" ] && db_Password="ssrpanel" 330 | read -p "本节点ID:" node_Id 331 | read -p "$(echo -e "$yellow流量计算比例$none(默认:${cyan}1.5$none)"):" transfer_Ratio 332 | [ -z "$transfer_Ratio" ] && transfer_Ratio="1.5" 333 | sed -i -e "s/db_Host/$db_Host/g" usermysql.json 334 | sed -i -e "s/db_Port/$db_Port/g" usermysql.json 335 | sed -i -e "s/db_Name/$db_Name/g" usermysql.json 336 | sed -i -e "s/db_User/$db_User/g" usermysql.json 337 | sed -i -e "s/db_Password/$db_Password/g" usermysql.json 338 | sed -i -e "s/node_Id/$node_Id/g" usermysql.json 339 | sed -i -e "s/transfer_Ratio/$transfer_Ratio/g" usermysql.json 340 | echo -e "配置完成!\n如果无法连上数据库,请检查本机防火墙或者数据库防火墙!\n下一步配置user-config.json,配置节点加密方式、混淆、协议等" 341 | 342 | echo -e "是否强制单端口:"$yellow"true"" or "$yellow"false"$none 343 | read -p "$(echo -e "(默认:${cyan}true$none)"):" single_Port_Enable 344 | [ -z "$single_Port_Enable" ] && single_Port_Enable="true" 345 | read -p "$(echo -e "$yellow输入单端口号$none(默认:${cyan}8080$none)"):" single_Port_Num 346 | [ -z "$single_Port_Num" ] && single_Port_Num="8080" 347 | read -p "$(echo -e "$yellow设置认证密码$none(默认:${cyan}forvip$none)"):" ss_Password 348 | [ -z "$ss_Password" ] && ss_Password="forvip" 349 | 350 | echo -e "选择加密方式:$yellow \n1. none\n2. rc4-md5\n3. aes-256-cfb\n4. chacha20"$none 351 | read -p "$(echo -e "(默认:${cyan}2. rc4-md5$none)"):" ss_method 352 | [ -z "$ss_method" ] && ss_method="rc4-md5" 353 | if [[ $ss_method ]]; then 354 | case $ss_method in 355 | 1) 356 | ss_method="none" 357 | ;; 358 | 2) 359 | ss_method="rc4-md5" 360 | ;; 361 | 3) 362 | ss_method="aes-256-cfb" 363 | ;; 364 | 4) 365 | ss_method="chacha20" 366 | ;; 367 | esac 368 | fi 369 | 370 | echo -e "选择传输协议:$yellow \n1. origin\n2. auth_sha1_v4\n3. auth_aes128_md5\n4. auth_chain_a"$none 371 | read -p "$(echo -e "(默认:${cyan}3. auth_aes128_md5$none)"):" ss_protocol 372 | [ -z "$ss_protocol" ] && ss_protocol="auth_aes128_md5" 373 | if [[ $ss_protocol ]]; then 374 | case $ss_protocol in 375 | 1) 376 | ss_protocol="origin" 377 | ;; 378 | 2) 379 | ss_protocol="auth_sha1_v4" 380 | ;; 381 | 3) 382 | ss_protocol="auth_aes128_md5" 383 | ;; 384 | 4) 385 | ss_protocol="auth_chain_a" 386 | ;; 387 | esac 388 | fi 389 | 390 | echo -e "选择混淆方式:$yellow \n1. plain\n2. http_simple\n3. http_post\n4. tls1.2_ticket_auth"$none 391 | read -p "$(echo -e "(默认:${cyan}2. http_simple$none)"):" ss_obfs 392 | [ -z "$ss_obfs" ] && ss_obfs="http_simple" 393 | if [[ $ss_obfs ]]; then 394 | case $ss_obfs in 395 | 1) 396 | ss_obfs="plain" 397 | ;; 398 | 2) 399 | ss_obfs="http_simple" 400 | ;; 401 | 3) 402 | ss_obfs="http_post" 403 | ;; 404 | 4) 405 | ss_obfs="tls1.2_ticket_auth" 406 | ;; 407 | esac 408 | fi 409 | 410 | read -p "$(echo -e "输入限制使用设备数:(默认:${cyan}不限制,直接回车即可$none)"):" ss_Online_Num 411 | [ -z "$ss_Online_Num" ] && ss_Online_Num="" 412 | 413 | read -p "$(echo -e "用户限速值(K):(默认:${cyan}不限制,直接回车即可$none)"):" ss_Ban_Limit 414 | [ -z "$ss_Ban_Limit" ] && ss_Ban_Limit="0" 415 | 416 | sed -i -e "s/single_Port_Enable/$single_Port_Enable/g" user-config.json 417 | sed -i -e "s/single_Port_Num/$single_Port_Num/g" user-config.json 418 | sed -i -e "s/ss_Password/$ss_Password/g" user-config.json 419 | sed -i -e "s/ss_method/$ss_method/g" user-config.json 420 | sed -i -e "s/ss_protocol/$ss_protocol/g" user-config.json 421 | sed -i -e "s/ss_obfs/$ss_obfs/g" user-config.json 422 | sed -i -e "s/ss_Online_Num/$ss_Online_Num/g" user-config.json 423 | sed -i -e "s/ss_Ban_Limit/$ss_Ban_Limit/g" user-config.json 424 | 425 | #启动并设置开机自动运行 426 | chmod +x run.sh && ./run.sh 427 | sed -i "/shadowsocksr\/run.sh$/d" /etc/rc.d/rc.local 428 | echo "/usr/shadowsocksr/run.sh" >> /etc/rc.d/rc.local 429 | firewall_set 430 | } 431 | 432 | open_bbr(){ 433 | cd 434 | wget -N --no-check-certificate "https://raw.githubusercontent.com/fei5seven/Shell-1/master/bbr_tcp_mod.sh" 435 | bash bbr_tcp_mod.sh 436 | } 437 | 438 | echo -e "1.Install V2Ray+Caddy" 439 | echo -e "2.Install V2Ray" 440 | echo -e "3.Install Caddy" 441 | echo -e "4.Install SSR" 442 | echo -e "5.Open BBR" 443 | read -p "请输入数字进行安装[1-5]:" menu_Num 444 | case "$menu_Num" in 445 | 1) 446 | config_v2ray_caddy 447 | ;; 448 | 2) 449 | config_v2ray 450 | ;; 451 | 3) 452 | config_caddy 453 | ;; 454 | 4) 455 | install_ssr 456 | ;; 457 | 5) 458 | open_bbr 459 | ;; 460 | *) 461 | echo "请输入正确数字[1-5]:" 462 | ;; 463 | esac 464 | -------------------------------------------------------------------------------- /install-release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # A copy of official file: github.com/v2ray/v2ray-core/blob/master/release/install-release.sh 4 | # Original source is located at github.com/ColetteContreras/v2ray-ssrpanel-plugin/blob/master/install-release.sh 5 | 6 | # If not specify, default meaning of return value: 7 | # 0: Success 8 | # 1: System error 9 | # 2: Application error 10 | # 3: Network error 11 | 12 | CUR_VER="" 13 | NEW_VER="" 14 | ARCH="" 15 | VDIS="64" 16 | ZIPFILE="/tmp/v2ray/v2ray.zip" 17 | V2RAY_RUNNING=0 18 | VSRC_ROOT="/tmp/v2ray" 19 | EXTRACT_ONLY=0 20 | ERROR_IF_UPTODATE=0 21 | 22 | CMD_INSTALL="" 23 | CMD_UPDATE="" 24 | SOFTWARE_UPDATED=0 25 | 26 | SYSTEMCTL_CMD=$(command -v systemctl 2>/dev/null) 27 | SERVICE_CMD=$(command -v service 2>/dev/null) 28 | 29 | CHECK="" 30 | FORCE="" 31 | HELP="" 32 | 33 | #######color code######## 34 | RED="31m" # Error message 35 | GREEN="32m" # Success message 36 | YELLOW="33m" # Warning message 37 | BLUE="36m" # Info message 38 | 39 | 40 | ######################### 41 | while [[ $# > 0 ]];do 42 | key="$1" 43 | case $key in 44 | -p|--proxy) 45 | PROXY="-x ${2}" 46 | shift # past argument 47 | ;; 48 | -h|--help) 49 | HELP="1" 50 | ;; 51 | -f|--force) 52 | FORCE="1" 53 | ;; 54 | -c|--check) 55 | CHECK="1" 56 | ;; 57 | --remove) 58 | REMOVE="1" 59 | ;; 60 | --version) 61 | VERSION="$2" 62 | shift 63 | ;; 64 | --extract) 65 | VSRC_ROOT="$2" 66 | shift 67 | ;; 68 | --extractonly) 69 | EXTRACT_ONLY="1" 70 | ;; 71 | -l|--local) 72 | LOCAL="$2" 73 | LOCAL_INSTALL="1" 74 | shift 75 | ;; 76 | --errifuptodate) 77 | ERROR_IF_UPTODATE="1" 78 | ;; 79 | *) 80 | # unknown option 81 | ;; 82 | esac 83 | shift # past argument or value 84 | done 85 | 86 | ############################### 87 | colorEcho(){ 88 | COLOR=$1 89 | echo -e "\033[${COLOR}${@:2}\033[0m" 90 | } 91 | 92 | sysArch(){ 93 | ARCH=$(uname -m) 94 | if [[ "$ARCH" == "i686" ]] || [[ "$ARCH" == "i386" ]]; then 95 | VDIS="32" 96 | elif [[ "$ARCH" == *"armv7"* ]] || [[ "$ARCH" == "armv6l" ]]; then 97 | VDIS="arm" 98 | elif [[ "$ARCH" == *"armv8"* ]] || [[ "$ARCH" == "aarch64" ]]; then 99 | VDIS="arm64" 100 | elif [[ "$ARCH" == *"mips64le"* ]]; then 101 | VDIS="mips64le" 102 | elif [[ "$ARCH" == *"mips64"* ]]; then 103 | VDIS="mips64" 104 | elif [[ "$ARCH" == *"mipsle"* ]]; then 105 | VDIS="mipsle" 106 | elif [[ "$ARCH" == *"mips"* ]]; then 107 | VDIS="mips" 108 | elif [[ "$ARCH" == *"s390x"* ]]; then 109 | VDIS="s390x" 110 | elif [[ "$ARCH" == "ppc64le" ]]; then 111 | VDIS="ppc64le" 112 | elif [[ "$ARCH" == "ppc64" ]]; then 113 | VDIS="ppc64" 114 | fi 115 | return 0 116 | } 117 | 118 | downloadV2Ray(){ 119 | rm -rf /tmp/v2ray 120 | mkdir -p /tmp/v2ray 121 | colorEcho ${BLUE} "Downloading V2Ray." 122 | DOWNLOAD_LINK="https://github.com/fei5seven/ssrpanel-v2ray-java/releases/download/${NEW_VER}/v2ray-linux-${VDIS}.zip" 123 | curl ${PROXY} -L -H "Cache-Control: no-cache" -o ${ZIPFILE} ${DOWNLOAD_LINK} 124 | if [ $? != 0 ];then 125 | colorEcho ${RED} "Failed to download! Please check your network or try again." 126 | return 3 127 | fi 128 | return 0 129 | } 130 | 131 | installSoftware(){ 132 | COMPONENT=$1 133 | if [[ -n `command -v $COMPONENT` ]]; then 134 | return 0 135 | fi 136 | 137 | getPMT 138 | if [[ $? -eq 1 ]]; then 139 | colorEcho ${RED} "The system package manager tool isn't APT or YUM, please install ${COMPONENT} manually." 140 | return 1 141 | fi 142 | if [[ $SOFTWARE_UPDATED -eq 0 ]]; then 143 | colorEcho ${BLUE} "Updating software repo" 144 | $CMD_UPDATE 145 | SOFTWARE_UPDATED=1 146 | fi 147 | 148 | colorEcho ${BLUE} "Installing ${COMPONENT}" 149 | $CMD_INSTALL $COMPONENT 150 | if [[ $? -ne 0 ]]; then 151 | colorEcho ${RED} "Failed to install ${COMPONENT}. Please install it manually." 152 | return 1 153 | fi 154 | return 0 155 | } 156 | 157 | # return 1: not apt, yum, or zypper 158 | getPMT(){ 159 | if [[ -n `command -v apt-get` ]];then 160 | CMD_INSTALL="apt-get -y -qq install" 161 | CMD_UPDATE="apt-get -qq update" 162 | elif [[ -n `command -v yum` ]]; then 163 | CMD_INSTALL="yum -y -q install" 164 | CMD_UPDATE="yum -q makecache" 165 | elif [[ -n `command -v zypper` ]]; then 166 | CMD_INSTALL="zypper -y install" 167 | CMD_UPDATE="zypper ref" 168 | else 169 | return 1 170 | fi 171 | return 0 172 | } 173 | 174 | extract(){ 175 | colorEcho ${BLUE}"Extracting V2Ray package to /tmp/v2ray." 176 | mkdir -p /tmp/v2ray 177 | unzip $1 -d ${VSRC_ROOT} 178 | if [[ $? -ne 0 ]]; then 179 | colorEcho ${RED} "Failed to extract V2Ray." 180 | return 2 181 | fi 182 | if [[ -d "/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}" ]]; then 183 | VSRC_ROOT="/tmp/v2ray/v2ray-${NEW_VER}-linux-${VDIS}" 184 | fi 185 | return 0 186 | } 187 | 188 | 189 | # 1: new V2Ray. 0: no. 2: not installed. 3: check failed. 4: don't check. 190 | getVersion(){ 191 | if [[ -n "$VERSION" ]]; then 192 | NEW_VER="$VERSION" 193 | if [[ ${NEW_VER} != v* ]]; then 194 | NEW_VER=v${NEW_VER} 195 | fi 196 | return 4 197 | else 198 | VER=`/usr/bin/v2ray/v2ray -version 2>/dev/null` 199 | RETVAL="$?" 200 | CUR_VER=`echo $VER | head -n 1 | cut -d " " -f2` 201 | if [[ ${CUR_VER} != v* ]]; then 202 | CUR_VER=v${CUR_VER} 203 | fi 204 | TAG_URL="https://api.github.com/repos/fei5seven/ssrpanel-v2ray-java/releases/latest" 205 | NEW_VER=`curl ${PROXY} -s ${TAG_URL} --connect-timeout 10| grep 'tag_name' | head -1 | cut -d\" -f4` 206 | if [[ ${NEW_VER} != v* ]]; then 207 | NEW_VER=v${NEW_VER} 208 | fi 209 | if [[ $? -ne 0 ]] || [[ $NEW_VER == "" ]]; then 210 | colorEcho ${RED} "Failed to fetch release information. Please check your network or try again." 211 | return 3 212 | elif [[ $RETVAL -ne 0 ]];then 213 | return 2 214 | elif [[ `echo $NEW_VER | cut -d. -f-2` != `echo $CUR_VER | cut -d. -f-2` ]];then 215 | return 1 216 | fi 217 | return 0 218 | fi 219 | } 220 | 221 | stopV2ray(){ 222 | colorEcho ${BLUE} "Shutting down V2Ray service." 223 | if [[ -n "${SYSTEMCTL_CMD}" ]] || [[ -f "/lib/systemd/system/v2ray.service" ]] || [[ -f "/etc/systemd/system/v2ray.service" ]]; then 224 | ${SYSTEMCTL_CMD} stop v2ray 225 | elif [[ -n "${SERVICE_CMD}" ]] || [[ -f "/etc/init.d/v2ray" ]]; then 226 | ${SERVICE_CMD} v2ray stop 227 | fi 228 | if [[ $? -ne 0 ]]; then 229 | colorEcho ${YELLOW} "Failed to shutdown V2Ray service." 230 | return 2 231 | fi 232 | return 0 233 | } 234 | 235 | startV2ray(){ 236 | if [ -n "${SYSTEMCTL_CMD}" ] && [ -f "/lib/systemd/system/v2ray.service" ]; then 237 | ${SYSTEMCTL_CMD} start v2ray 238 | elif [ -n "${SYSTEMCTL_CMD}" ] && [ -f "/etc/systemd/system/v2ray.service" ]; then 239 | ${SYSTEMCTL_CMD} start v2ray 240 | elif [ -n "${SERVICE_CMD}" ] && [ -f "/etc/init.d/v2ray" ]; then 241 | ${SERVICE_CMD} v2ray start 242 | fi 243 | if [[ $? -ne 0 ]]; then 244 | colorEcho ${YELLOW} "Failed to start V2Ray service." 245 | return 2 246 | fi 247 | return 0 248 | } 249 | 250 | copyFile() { 251 | NAME=$1 252 | ERROR=`cp "${VSRC_ROOT}/${NAME}" "/usr/bin/v2ray/${NAME}" 2>&1` 253 | if [[ $? -ne 0 ]]; then 254 | colorEcho ${YELLOW} "${ERROR}" 255 | return 1 256 | fi 257 | return 0 258 | } 259 | 260 | makeExecutable() { 261 | chmod +x "/usr/bin/v2ray/$1" 262 | } 263 | 264 | installV2Ray(){ 265 | # Install V2Ray binary to /usr/bin/v2ray 266 | mkdir -p /usr/bin/v2ray 267 | copyFile v2ray 268 | if [[ $? -ne 0 ]]; then 269 | colorEcho ${RED} "Failed to copy V2Ray binary and resources." 270 | return 1 271 | fi 272 | makeExecutable v2ray 273 | copyFile v2ctl && makeExecutable v2ctl 274 | copyFile geoip.dat 275 | copyFile geosite.dat 276 | 277 | # Install V2Ray server config to /etc/v2ray 278 | if [[ ! -f "/etc/v2ray/config.json" ]]; then 279 | mkdir -p /etc/v2ray 280 | mkdir -p /var/log/v2ray 281 | cp "${VSRC_ROOT}/vpoint_vmess_freedom.json" "/etc/v2ray/config.json" 282 | if [[ $? -ne 0 ]]; then 283 | colorEcho ${YELLOW} "Failed to create V2Ray configuration file. Please create it manually." 284 | return 1 285 | fi 286 | let PORT=$RANDOM+10000 287 | UUID=$(cat /proc/sys/kernel/random/uuid) 288 | 289 | sed -i "s/10086/${PORT}/g" "/etc/v2ray/config.json" 290 | sed -i "s/23ad6b10-8d1a-40f7-8ad0-e3e35cd38297/${UUID}/g" "/etc/v2ray/config.json" 291 | 292 | colorEcho ${BLUE} "PORT:${PORT}" 293 | colorEcho ${BLUE} "UUID:${UUID}" 294 | fi 295 | return 0 296 | } 297 | 298 | 299 | installInitScript(){ 300 | if [[ -n "${SYSTEMCTL_CMD}" ]];then 301 | if [[ ! -f "/etc/systemd/system/v2ray.service" ]]; then 302 | if [[ ! -f "/lib/systemd/system/v2ray.service" ]]; then 303 | cp "${VSRC_ROOT}/systemd/v2ray.service" "/etc/systemd/system/" 304 | systemctl enable v2ray.service 305 | fi 306 | fi 307 | return 308 | elif [[ -n "${SERVICE_CMD}" ]] && [[ ! -f "/etc/init.d/v2ray" ]]; then 309 | installSoftware "daemon" || return $? 310 | cp "${VSRC_ROOT}/systemv/v2ray" "/etc/init.d/v2ray" 311 | chmod +x "/etc/init.d/v2ray" 312 | update-rc.d v2ray defaults 313 | fi 314 | return 315 | } 316 | 317 | Help(){ 318 | echo "./install-release.sh [-h] [-c] [--remove] [-p proxy] [-f] [--version vx.y.z] [-l file]" 319 | echo " -h, --help Show help" 320 | echo " -p, --proxy To download through a proxy server, use -p socks5://127.0.0.1:1080 or -p http://127.0.0.1:3128 etc" 321 | echo " -f, --force Force install" 322 | echo " --version Install a particular version, use --version v3.15" 323 | echo " -l, --local Install from a local file" 324 | echo " --remove Remove installed V2Ray" 325 | echo " -c, --check Check for update" 326 | return 0 327 | } 328 | 329 | remove(){ 330 | if [[ -n "${SYSTEMCTL_CMD}" ]] && [[ -f "/etc/systemd/system/v2ray.service" ]];then 331 | if pgrep "v2ray" > /dev/null ; then 332 | stopV2ray 333 | fi 334 | systemctl disable v2ray.service 335 | rm -rf "/usr/bin/v2ray" "/etc/systemd/system/v2ray.service" 336 | if [[ $? -ne 0 ]]; then 337 | colorEcho ${RED} "Failed to remove V2Ray." 338 | return 0 339 | else 340 | colorEcho ${GREEN} "Removed V2Ray successfully." 341 | colorEcho ${BLUE} "If necessary, please remove configuration file and log file manually." 342 | return 0 343 | fi 344 | elif [[ -n "${SYSTEMCTL_CMD}" ]] && [[ -f "/lib/systemd/system/v2ray.service" ]];then 345 | if pgrep "v2ray" > /dev/null ; then 346 | stopV2ray 347 | fi 348 | systemctl disable v2ray.service 349 | rm -rf "/usr/bin/v2ray" "/lib/systemd/system/v2ray.service" 350 | if [[ $? -ne 0 ]]; then 351 | colorEcho ${RED} "Failed to remove V2Ray." 352 | return 0 353 | else 354 | colorEcho ${GREEN} "Removed V2Ray successfully." 355 | colorEcho ${BLUE} "If necessary, please remove configuration file and log file manually." 356 | return 0 357 | fi 358 | elif [[ -n "${SERVICE_CMD}" ]] && [[ -f "/etc/init.d/v2ray" ]]; then 359 | if pgrep "v2ray" > /dev/null ; then 360 | stopV2ray 361 | fi 362 | rm -rf "/usr/bin/v2ray" "/etc/init.d/v2ray" 363 | if [[ $? -ne 0 ]]; then 364 | colorEcho ${RED} "Failed to remove V2Ray." 365 | return 0 366 | else 367 | colorEcho ${GREEN} "Removed V2Ray successfully." 368 | colorEcho ${BLUE} "If necessary, please remove configuration file and log file manually." 369 | return 0 370 | fi 371 | else 372 | colorEcho ${YELLOW} "V2Ray not found." 373 | return 0 374 | fi 375 | } 376 | 377 | checkUpdate(){ 378 | echo "Checking for update." 379 | VERSION="" 380 | getVersion 381 | RETVAL="$?" 382 | if [[ $RETVAL -eq 1 ]]; then 383 | colorEcho ${BLUE} "Found new version ${NEW_VER} for V2Ray.(Current version:$CUR_VER)" 384 | elif [[ $RETVAL -eq 0 ]]; then 385 | colorEcho ${BLUE} "No new version. Current version is ${NEW_VER}." 386 | elif [[ $RETVAL -eq 2 ]]; then 387 | colorEcho ${YELLOW} "No V2Ray installed." 388 | colorEcho ${BLUE} "The newest version for V2Ray is ${NEW_VER}." 389 | fi 390 | return 0 391 | } 392 | 393 | main(){ 394 | #helping information 395 | [[ "$HELP" == "1" ]] && Help && return 396 | [[ "$CHECK" == "1" ]] && checkUpdate && return 397 | [[ "$REMOVE" == "1" ]] && remove && return 398 | 399 | sysArch 400 | # extract local file 401 | if [[ $LOCAL_INSTALL -eq 1 ]]; then 402 | colorEcho ${YELLOW} "Installing V2Ray via local file. Please make sure the file is a valid V2Ray package, as we are not able to determine that." 403 | NEW_VER=local 404 | installSoftware unzip || return $? 405 | rm -rf /tmp/v2ray 406 | extract $LOCAL || return $? 407 | #FILEVDIS=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f4` 408 | #SYSTEM=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f3` 409 | #if [[ ${SYSTEM} != "linux" ]]; then 410 | # colorEcho ${RED} "The local V2Ray can not be installed in linux." 411 | # return 1 412 | #elif [[ ${FILEVDIS} != ${VDIS} ]]; then 413 | # colorEcho ${RED} "The local V2Ray can not be installed in ${ARCH} system." 414 | # return 1 415 | #else 416 | # NEW_VER=`ls /tmp/v2ray |grep v2ray-v |cut -d "-" -f2` 417 | #fi 418 | else 419 | # download via network and extract 420 | installSoftware "curl" || return $? 421 | getVersion 422 | RETVAL="$?" 423 | if [[ $RETVAL == 0 ]] && [[ "$FORCE" != "1" ]]; then 424 | colorEcho ${BLUE} "Latest version ${NEW_VER} is already installed." 425 | if [[ "${ERROR_IF_UPTODATE}" == "1" ]]; then 426 | return 10 427 | fi 428 | return 429 | elif [[ $RETVAL == 3 ]]; then 430 | return 3 431 | else 432 | colorEcho ${BLUE} "Installing V2Ray ${NEW_VER} on ${ARCH}" 433 | downloadV2Ray || return $? 434 | installSoftware unzip || return $? 435 | extract ${ZIPFILE} || return $? 436 | fi 437 | fi 438 | 439 | if [[ "${EXTRACT_ONLY}" == "1" ]]; then 440 | colorEcho ${GREEN} "V2Ray extracted to ${VSRC_ROOT}, and exiting..." 441 | return 0 442 | fi 443 | 444 | if pgrep "v2ray" > /dev/null ; then 445 | V2RAY_RUNNING=1 446 | stopV2ray 447 | fi 448 | installV2Ray || return $? 449 | installInitScript || return $? 450 | if [[ ${V2RAY_RUNNING} -eq 1 ]];then 451 | colorEcho ${BLUE} "Restarting V2Ray service." 452 | startV2ray 453 | fi 454 | colorEcho ${GREEN} "V2Ray ${NEW_VER} is installed." 455 | rm -rf /tmp/v2ray 456 | return 0 457 | } 458 | 459 | main 460 | -------------------------------------------------------------------------------- /resource/Caddyfile: -------------------------------------------------------------------------------- 1 | fake_Domain { 2 | root /srv/www 3 | tls user_Name@gmail.com 4 | gzip 5 | timeouts none 6 | proxy /forward_Path 127.0.0.1:v2ray_Port { 7 | websocket 8 | header_upstream -Origin 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /resource/caddy/0.11.5/caddy_linux_386.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/resource/caddy/0.11.5/caddy_linux_386.tar.gz -------------------------------------------------------------------------------- /resource/caddy/0.11.5/caddy_linux_amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/resource/caddy/0.11.5/caddy_linux_amd64.tar.gz -------------------------------------------------------------------------------- /resource/caddy/1.0.4/caddy_linux_386.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/resource/caddy/1.0.4/caddy_linux_386.tar.gz -------------------------------------------------------------------------------- /resource/caddy/1.0.4/caddy_linux_amd64.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/resource/caddy/1.0.4/caddy_linux_amd64.tar.gz -------------------------------------------------------------------------------- /resource/v2ray-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "loglevel": "debug" 4 | }, 5 | "api": { 6 | "tag": "api", 7 | "services": [ 8 | "HandlerService", 9 | "LoggerService", 10 | "StatsService" 11 | ] 12 | }, 13 | "stats": {}, 14 | "inbounds": [ 15 | { 16 | "listen": "127.0.0.1", 17 | "port": usersync_Port, 18 | "protocol": "dokodemo-door", 19 | "settings": { 20 | "address": "127.0.0.1" 21 | }, 22 | "tag": "api" 23 | }, 24 | { 25 | "tag": "proxy", 26 | "port": v2ray_Port, 27 | "protocol": "vmess", 28 | "settings": { 29 | "clients": [], 30 | "disableInsecureEncryption": false, 31 | "default": { 32 | "level": 0, 33 | "alterId": alter_Id 34 | } 35 | }, 36 | "streamSettings": { 37 | "network": "ws", 38 | "wsSettings": { 39 | "path": "/forward_Path" 40 | } 41 | } 42 | } 43 | ], 44 | "outbounds": [{ 45 | "protocol": "freedom" 46 | }], 47 | "routing": { 48 | "rules": [{ 49 | "type": "field", 50 | "inboundTag": [ "api" ], 51 | "outboundTag": "api" 52 | }], 53 | "strategy": "rules" 54 | }, 55 | "policy": { 56 | "levels": { 57 | "0": { 58 | "statsUserUplink": true, 59 | "statsUserDownlink": true 60 | } 61 | }, 62 | "system": { 63 | "statsInboundUplink": true, 64 | "statsInboundDownlink": true 65 | } 66 | }, 67 | 68 | "ssrpanel": { 69 | // Node id on your SSR Panel 70 | "nodeId": node_Id, 71 | // every N seconds 72 | "checkRate": 300, 73 | // user config 74 | "user": { 75 | // inbound tag, which inbound you would like add user to 76 | "inboundTag": "proxy", 77 | "level": 0, 78 | "alterId": alter_Id, 79 | "security": "none" 80 | }, 81 | // db connection 82 | "mysql": { 83 | "host": "db_Host", 84 | "port": db_Port, 85 | "user": "db_User", 86 | "password": "db_Password", 87 | "dbname": "db_Name" 88 | } 89 | } 90 | } -------------------------------------------------------------------------------- /resource/www.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/resource/www.zip -------------------------------------------------------------------------------- /ssrpanel-v2ray-java.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/ssrpanel-v2ray-java.zip -------------------------------------------------------------------------------- /ssrpanel-v2ray-old.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/ssrpanel-v2ray-old.jar -------------------------------------------------------------------------------- /ssrpanel-v2ray.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/ssrpanel-v2ray.jar -------------------------------------------------------------------------------- /v2-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #chkconfig: 5 80 90 4 | #description:check 5 | # 6 | 7 | # source function library 8 | #. /etc/rc.d/init.d/functions 9 | 10 | JAVA_HOME=/usr/bin 11 | export JAVA_HOME=$JAVA_HOME 12 | export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin 13 | 14 | DIALUP_PID=/v2ray/dialup.pid 15 | start() 16 | { 17 | echo -n $"Starting $prog: " 18 | echo "v2ray-java启动中" 19 | cd /v2ray 20 | nohup java -jar ssrpanel-v2ray-test.jar > log.file 2>&1 & new_agent_pid=$! 21 | echo "$new_agent_pid" > $DIALUP_PID 22 | sleep 1 23 | echo "启动成功" 24 | } 25 | 26 | stop() 27 | { 28 | 29 | if [ -f /v2ray/dialup.pid ];then 30 | SPID=`cat /v2ray/dialup.pid` 31 | if [ "$SPID" != "" ];then 32 | kill -9 $SPID 33 | echo > $DIALUP_PID 34 | ps -ef | grep v2ray | grep -v grep | awk '{print $2}' | xargs kill -9 35 | sleep 1 36 | echo "停止成功" 37 | fi 38 | 39 | fi 40 | } 41 | 42 | CheckProcessStata() 43 | { 44 | CPS_PID=$1 45 | if [ "$CPS_PID" != "" ] ;then 46 | CPS_PIDLIST=`ps -ef|grep $CPS_PID|grep -v grep|awk -F" " '{print $2}'` 47 | else 48 | CPS_PIDLIST=`ps -ef|grep "$CPS_PNAME"|grep -v grep|awk -F" " '{print $2}'` 49 | fi 50 | 51 | for CPS_i in `echo $CPS_PIDLIST` 52 | do 53 | if [ "$CPS_PID" = "" ] ;then 54 | CPS_i1="$CPS_PID" 55 | else 56 | CPS_i1="$CPS_i" 57 | fi 58 | 59 | if [ "$CPS_i1" = "$CPS_PID" ] ;then 60 | #kill -s 0 $CPS_i 61 | kill -0 $CPS_i >/dev/null 2>&1 62 | if [ $? != 0 ] ;then 63 | echo "[`date`] MC-10500: Process $i have Dead" 64 | kill -9 $CPS_i >/dev/null 2>&1 65 | 66 | return 1 67 | else 68 | #echo "[`date`] MC-10501: Process is alive" 69 | return 0 70 | fi 71 | fi 72 | done 73 | echo "[`date`] MC-10502: Process $CPS_i is not exists" 74 | return 1 75 | } 76 | 77 | status() 78 | { 79 | SPID=`cat /v2ray/dialup.pid` 80 | CheckProcessStata $SPID >/dev/null 81 | if [ $? != 0 ];then 82 | echo "v2ray-java:{$SPID} 尚未运行" 83 | else 84 | echo "v2ray-java:{$SPID} 运行中" 85 | fi 86 | 87 | } 88 | 89 | restart() 90 | { 91 | echo "停止中" 92 | stop 93 | echo "启动中" 94 | start 95 | } 96 | 97 | case "$1" in 98 | start) 99 | start 100 | ;; 101 | stop) 102 | stop 103 | ;; 104 | status) 105 | status 106 | ;; 107 | restart) 108 | restart 109 | ;; 110 | *) 111 | echo $"Usage: $0 {start|stop|restart}" 112 | RETVAL=1 113 | esac 114 | exit $RETVAL 115 | -------------------------------------------------------------------------------- /v2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | #chkconfig: 5 80 90 4 | #description:check 5 | # 6 | 7 | # source function library 8 | #. /etc/rc.d/init.d/functions 9 | 10 | JAVA_HOME=/usr/bin 11 | export JAVA_HOME=$JAVA_HOME 12 | export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin 13 | 14 | DIALUP_PID=/v2ray/dialup.pid 15 | start() 16 | { 17 | echo -n $"Starting $prog: " 18 | echo "v2ray-java启动中" 19 | cd /v2ray 20 | nohup java -jar ssrpanel-v2ray.jar > log.file 2>&1 & new_agent_pid=$! 21 | echo "$new_agent_pid" > $DIALUP_PID 22 | sleep 1 23 | echo "启动成功" 24 | } 25 | 26 | stop() 27 | { 28 | 29 | if [ -f /v2ray/dialup.pid ];then 30 | SPID=`cat /v2ray/dialup.pid` 31 | if [ "$SPID" != "" ];then 32 | kill -9 $SPID 33 | echo > $DIALUP_PID 34 | ps -ef | grep v2ray | grep -v grep | awk '{print $2}' | xargs kill -9 35 | sleep 1 36 | echo "停止成功" 37 | fi 38 | 39 | fi 40 | } 41 | 42 | CheckProcessStata() 43 | { 44 | CPS_PID=$1 45 | if [ "$CPS_PID" != "" ] ;then 46 | CPS_PIDLIST=`ps -ef|grep $CPS_PID|grep -v grep|awk -F" " '{print $2}'` 47 | else 48 | CPS_PIDLIST=`ps -ef|grep "$CPS_PNAME"|grep -v grep|awk -F" " '{print $2}'` 49 | fi 50 | 51 | for CPS_i in `echo $CPS_PIDLIST` 52 | do 53 | if [ "$CPS_PID" = "" ] ;then 54 | CPS_i1="$CPS_PID" 55 | else 56 | CPS_i1="$CPS_i" 57 | fi 58 | 59 | if [ "$CPS_i1" = "$CPS_PID" ] ;then 60 | #kill -s 0 $CPS_i 61 | kill -0 $CPS_i >/dev/null 2>&1 62 | if [ $? != 0 ] ;then 63 | echo "[`date`] MC-10500: Process $i have Dead" 64 | kill -9 $CPS_i >/dev/null 2>&1 65 | 66 | return 1 67 | else 68 | #echo "[`date`] MC-10501: Process is alive" 69 | return 0 70 | fi 71 | fi 72 | done 73 | echo "[`date`] MC-10502: Process $CPS_i is not exists" 74 | return 1 75 | } 76 | 77 | status() 78 | { 79 | SPID=`cat /v2ray/dialup.pid` 80 | CheckProcessStata $SPID >/dev/null 81 | if [ $? != 0 ];then 82 | echo "v2ray-java:{$SPID} 尚未运行" 83 | else 84 | echo "v2ray-java:{$SPID} 运行中" 85 | fi 86 | 87 | } 88 | 89 | restart() 90 | { 91 | echo "停止中" 92 | stop 93 | echo "启动中" 94 | start 95 | } 96 | 97 | case "$1" in 98 | start) 99 | start 100 | ;; 101 | stop) 102 | stop 103 | ;; 104 | status) 105 | status 106 | ;; 107 | restart) 108 | restart 109 | ;; 110 | *) 111 | echo $"Usage: $0 {start|stop|restart}" 112 | RETVAL=1 113 | esac 114 | exit $RETVAL 115 | -------------------------------------------------------------------------------- /v4.31.0/config.json: -------------------------------------------------------------------------------- 1 | // Config file of V2Ray. This file follows standard JSON format, with comments support. 2 | // Uncomment entries below to satisfy your needs. Also read our manual for more detail at 3 | // https://www.v2fly.org/ 4 | { 5 | "log": { 6 | // By default, V2Ray writes access log to stdout. 7 | // "access": "/path/to/access/log/file", 8 | 9 | // By default, V2Ray write error log to stdout. 10 | // "error": "/path/to/error/log/file", 11 | 12 | // Log level, one of "debug", "info", "warning", "error", "none" 13 | "loglevel": "warning" 14 | }, 15 | // List of inbound proxy configurations. 16 | "inbounds": [{ 17 | // Port to listen on. You may need root access if the value is less than 1024. 18 | "port": 1080, 19 | 20 | // IP address to listen on. Change to "0.0.0.0" to listen on all network interfaces. 21 | "listen": "127.0.0.1", 22 | 23 | // Tag of the inbound proxy. May be used for routing. 24 | "tag": "socks-inbound", 25 | 26 | // Protocol name of inbound proxy. 27 | "protocol": "socks", 28 | 29 | // Settings of the protocol. Varies based on protocol. 30 | "settings": { 31 | "auth": "noauth", 32 | "udp": false, 33 | "ip": "127.0.0.1" 34 | }, 35 | 36 | // Enable sniffing on TCP connection. 37 | "sniffing": { 38 | "enabled": true, 39 | // Target domain will be overriden to the one carried by the connection, if the connection is HTTP or HTTPS. 40 | "destOverride": ["http", "tls"] 41 | } 42 | }], 43 | // List of outbound proxy configurations. 44 | "outbounds": [{ 45 | // Protocol name of the outbound proxy. 46 | "protocol": "freedom", 47 | 48 | // Settings of the protocol. Varies based on protocol. 49 | "settings": {}, 50 | 51 | // Tag of the outbound. May be used for routing. 52 | "tag": "direct" 53 | },{ 54 | "protocol": "blackhole", 55 | "settings": {}, 56 | "tag": "blocked" 57 | }], 58 | 59 | // Transport is for global transport settings. If you have multiple transports with same settings 60 | // (say mKCP), you may put it here, instead of in each individual inbound/outbounds. 61 | //"transport": {}, 62 | 63 | // Routing controls how traffic from inbounds are sent to outbounds. 64 | "routing": { 65 | "domainStrategy": "IPOnDemand", 66 | "rules":[ 67 | { 68 | // Blocks access to private IPs. Remove this if you want to access your router. 69 | "type": "field", 70 | "ip": ["geoip:private"], 71 | "outboundTag": "blocked" 72 | }, 73 | { 74 | // Blocks major ads. 75 | "type": "field", 76 | "domain": ["geosite:category-ads"], 77 | "outboundTag": "blocked" 78 | } 79 | ] 80 | }, 81 | 82 | // Dns settings for domain resolution. 83 | "dns": { 84 | // Static hosts, similar to hosts file. 85 | "hosts": { 86 | // Match v2fly.org to another domain on CloudFlare. This domain will be used when querying IPs for v2fly.org. 87 | "domain:v2fly.org": "www.vicemc.net", 88 | 89 | // The following settings help to eliminate DNS poisoning in mainland China. 90 | // It is safe to comment these out if this is not the case for you. 91 | "domain:github.io": "pages.github.com", 92 | "domain:wikipedia.org": "www.wikimedia.org", 93 | "domain:shadowsocks.org": "electronicsrealm.com" 94 | }, 95 | "servers": [ 96 | "1.1.1.1", 97 | { 98 | "address": "114.114.114.114", 99 | "port": 53, 100 | // List of domains that use this DNS first. 101 | "domains": [ 102 | "geosite:cn" 103 | ] 104 | }, 105 | "8.8.8.8", 106 | "localhost" 107 | ] 108 | }, 109 | 110 | // Policy controls some internal behavior of how V2Ray handles connections. 111 | // It may be on connection level by user levels in 'levels', or global settings in 'system.' 112 | "policy": { 113 | // Connection policys by user levels 114 | "levels": { 115 | "0": { 116 | "uplinkOnly": 0, 117 | "downlinkOnly": 0 118 | } 119 | }, 120 | "system": { 121 | "statsInboundUplink": false, 122 | "statsInboundDownlink": false, 123 | "statsOutboundUplink": false, 124 | "statsOutboundDownlink": false 125 | } 126 | }, 127 | 128 | // Stats enables internal stats counter. 129 | // This setting can be used together with Policy and Api. 130 | //"stats":{}, 131 | 132 | // Api enables gRPC APIs for external programs to communicate with V2Ray instance. 133 | //"api": { 134 | //"tag": "api", 135 | //"services": [ 136 | // "HandlerService", 137 | // "LoggerService", 138 | // "StatsService" 139 | //] 140 | //}, 141 | 142 | // You may add other entries to the configuration, but they will not be recognized by V2Ray. 143 | "other": {} 144 | } 145 | -------------------------------------------------------------------------------- /v4.31.0/geoip-only-cn-private.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/v4.31.0/geoip-only-cn-private.dat -------------------------------------------------------------------------------- /v4.31.0/geoip.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/v4.31.0/geoip.dat -------------------------------------------------------------------------------- /v4.31.0/geosite.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/v4.31.0/geosite.dat -------------------------------------------------------------------------------- /v4.31.0/systemd/system/v2ray.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=V2Ray Service 3 | Documentation=https://www.v2fly.org/ 4 | After=network.target nss-lookup.target 5 | 6 | [Service] 7 | User=nobody 8 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 9 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 10 | NoNewPrivileges=true 11 | ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/config.json 12 | Restart=on-failure 13 | RestartPreventExitStatus=23 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /v4.31.0/systemd/system/v2ray@.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=V2Ray Service 3 | Documentation=https://www.v2fly.org/ 4 | After=network.target nss-lookup.target 5 | 6 | [Service] 7 | User=nobody 8 | CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 9 | AmbientCapabilities=CAP_NET_ADMIN CAP_NET_BIND_SERVICE 10 | NoNewPrivileges=true 11 | ExecStart=/usr/local/bin/v2ray -config /usr/local/etc/v2ray/%i.json 12 | Restart=on-failure 13 | RestartPreventExitStatus=23 14 | 15 | [Install] 16 | WantedBy=multi-user.target 17 | -------------------------------------------------------------------------------- /v4.31.0/v2ctl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/v4.31.0/v2ctl -------------------------------------------------------------------------------- /v4.31.0/v2ray: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fei5seven/ssrpanel-v2ray-java/de42d4f6ecfd61a8ee3239d3da152f5799e58402/v4.31.0/v2ray -------------------------------------------------------------------------------- /v4.31.0/vpoint_socks_vmess.json: -------------------------------------------------------------------------------- 1 | { 2 | "log": { 3 | "loglevel": "warning" 4 | }, 5 | "inbounds": [{ 6 | "port": 1080, 7 | "listen": "127.0.0.1", 8 | "protocol": "socks", 9 | "settings": { 10 | "auth": "noauth", 11 | "udp": false, 12 | "ip": "127.0.0.1" 13 | } 14 | }], 15 | "outbounds": [{ 16 | "protocol": "freedom", 17 | "settings": {}, 18 | "tag": "direct" 19 | }], 20 | "policy": { 21 | "levels": { 22 | "0": {"uplinkOnly": 0} 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /v4.31.0/vpoint_vmess_freedom.json: -------------------------------------------------------------------------------- 1 | { 2 | "inbounds": [{ 3 | "port": 10086, 4 | "protocol": "vmess", 5 | "settings": { 6 | "clients": [ 7 | { 8 | "id": "23ad6b10-8d1a-40f7-8ad0-e3e35cd38297", 9 | "level": 1, 10 | "alterId": 64 11 | } 12 | ] 13 | } 14 | }], 15 | "outbounds": [{ 16 | "protocol": "freedom", 17 | "settings": {} 18 | },{ 19 | "protocol": "blackhole", 20 | "settings": {}, 21 | "tag": "blocked" 22 | }], 23 | "routing": { 24 | "rules": [ 25 | { 26 | "type": "field", 27 | "ip": ["geoip:private"], 28 | "outboundTag": "blocked" 29 | } 30 | ] 31 | } 32 | } 33 | --------------------------------------------------------------------------------