Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Файл конфирурации /etc/xray/xray-vless.json
- {
- "log": {
- "loglevel": "none"
- },
- "inbounds": [
- {
- "port": 10800,
- "listen": "0.0.0.0", // локальный адресс sosks прокси
- "protocol": "socks",
- "settings": {
- "udp": true
- }
- }
- ],
- "outbounds": [
- {
- "protocol": "vless",
- "settings": {
- "vnext": [
- {
- "address": "myserver.herokuapp.com",
- "port": 443,
- "users": [
- {
- "id": "", // генерируется тут http://www.uuid.online/ и записывается на сервер и в этот конфиг
- "encryption": "none",
- "level": 0
- }
- ]
- }
- ]
- },
- "streamSettings": {
- "network": "ws",
- "security": "tls",
- "tlsSettings": {
- "serverName": "myserver.herokuapp.com"
- },
- "wsSettings": {
- "path": "/s233?ed=2048"
- }
- }
- }
- ]
- }
- Файлы идентичны, за исключением
- vless - "protocol": "vless", "path": "/s233?ed=2048"
- vmess - "protocol": "vmess", "path": "/s244?ed=2048"
- Стартовый скрипт Для Gentoo /etc/init.d/xray
- #!/sbin/openrc-run
- # Copyright 1999-2022 Gentoo Authors
- # Distributed under the terms of the GNU General Public License v2
- SS_CONFIG_VLESS="/etc/xray/xray-vless.json"
- SS_CONFIG_VMESS="/etc/xray/xray-vmess.json"
- #SS_CONFIG="/etc/xray/xray-vless.json"
- SS_PIDFILE="/var/run/xray/xray.pid"
- #SS_LOG="/var/log/xray.log"
- SS_COMMAND="/usr/local/bin/xray"
- [ -z "${piddir}" ] && piddir="/var/run/xray"
- depend() {
- need net
- }
- checkconfig() {
- if [ ! -f ${SS_CONFIG_VLESS} ]; then
- ewarn "${SS_CONFIG_VLESS} does not exist."
- fi
- if [ ! -f ${SS_CONFIG_VMESS} ]; then
- ewarn "${SS_CONFIG_VMESS} does not exist."
- fi
- SS_SVCNAME="${RC_SVCNAME#*.}"
- case ${SS_SVCNAME} in
- client.vless)
- SS_CONFIG="/etc/xray/xray-vless.json"
- return 0
- ;;
- client.vmess)
- SS_CONFIG="/etc/xray/xray-vmess.json"
- return 0
- ;;
- *)
- eerror "please choose to run as server or client vless or vmess mode"
- eerror "client.vless: rc-update add xray.client.vless default"
- eerror "client.vmess: rc-update add xray.client.vmess default"
- return 1
- ;;
- esac
- }
- start() {
- # [ -d "${piddir}" ] || mkdir -p "${piddir}"
- # chown -R nobody:nobody "${piddir}"
- checkconfig || return 1
- ebegin "Starting xray: ${SS_SVCNAME} mode"
- start-stop-daemon --start --exec ${SS_COMMAND} \
- --user nobody --group nobody \
- -- run -config ${SS_CONFIG} >/dev/null 2>&1 &
- eend $?
- }
- stop() {
- ebegin "Stopping xray"
- start-stop-daemon --stop \
- --user nobody --group nobody \
- --pidfile ${SS_PIDFILE}
- eend $?
- }
- Нужно сделать на файл /etc/init.d/xray два симлинка xray.client.vless и xray.client.vmess
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement