Advertisement
Guest User

Untitled

a guest
Mar 21st, 2022
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.87 KB | None | 0 0
  1. Файл конфирурации /etc/xray/xray-vless.json
  2.  
  3. {
  4. "log": {
  5. "loglevel": "none"
  6. },
  7. "inbounds": [
  8. {
  9. "port": 10800,
  10. "listen": "0.0.0.0", // локальный адресс sosks прокси
  11. "protocol": "socks",
  12. "settings": {
  13. "udp": true
  14. }
  15. }
  16. ],
  17. "outbounds": [
  18. {
  19. "protocol": "vless",
  20. "settings": {
  21. "vnext": [
  22. {
  23. "address": "myserver.herokuapp.com",
  24. "port": 443,
  25. "users": [
  26. {
  27. "id": "", // генерируется тут http://www.uuid.online/ и записывается на сервер и в этот конфиг
  28. "encryption": "none",
  29. "level": 0
  30. }
  31. ]
  32. }
  33. ]
  34. },
  35. "streamSettings": {
  36. "network": "ws",
  37. "security": "tls",
  38. "tlsSettings": {
  39. "serverName": "myserver.herokuapp.com"
  40. },
  41. "wsSettings": {
  42. "path": "/s233?ed=2048"
  43. }
  44. }
  45. }
  46. ]
  47. }
  48.  
  49. Файлы идентичны, за исключением
  50. vless - "protocol": "vless", "path": "/s233?ed=2048"
  51. vmess - "protocol": "vmess", "path": "/s244?ed=2048"
  52.  
  53.  
  54. Стартовый скрипт Для Gentoo /etc/init.d/xray
  55.  
  56. #!/sbin/openrc-run
  57. # Copyright 1999-2022 Gentoo Authors
  58. # Distributed under the terms of the GNU General Public License v2
  59.  
  60. SS_CONFIG_VLESS="/etc/xray/xray-vless.json"
  61. SS_CONFIG_VMESS="/etc/xray/xray-vmess.json"
  62. #SS_CONFIG="/etc/xray/xray-vless.json"
  63. SS_PIDFILE="/var/run/xray/xray.pid"
  64. #SS_LOG="/var/log/xray.log"
  65. SS_COMMAND="/usr/local/bin/xray"
  66.  
  67. [ -z "${piddir}" ] && piddir="/var/run/xray"
  68.  
  69. depend() {
  70. need net
  71. }
  72.  
  73. checkconfig() {
  74. if [ ! -f ${SS_CONFIG_VLESS} ]; then
  75. ewarn "${SS_CONFIG_VLESS} does not exist."
  76. fi
  77. if [ ! -f ${SS_CONFIG_VMESS} ]; then
  78. ewarn "${SS_CONFIG_VMESS} does not exist."
  79. fi
  80.  
  81.  
  82. SS_SVCNAME="${RC_SVCNAME#*.}"
  83. case ${SS_SVCNAME} in
  84. client.vless)
  85. SS_CONFIG="/etc/xray/xray-vless.json"
  86. return 0
  87. ;;
  88. client.vmess)
  89. SS_CONFIG="/etc/xray/xray-vmess.json"
  90. return 0
  91. ;;
  92. *)
  93. eerror "please choose to run as server or client vless or vmess mode"
  94. eerror "client.vless: rc-update add xray.client.vless default"
  95. eerror "client.vmess: rc-update add xray.client.vmess default"
  96. return 1
  97. ;;
  98. esac
  99. }
  100.  
  101. start() {
  102. # [ -d "${piddir}" ] || mkdir -p "${piddir}"
  103. # chown -R nobody:nobody "${piddir}"
  104.  
  105. checkconfig || return 1
  106. ebegin "Starting xray: ${SS_SVCNAME} mode"
  107. start-stop-daemon --start --exec ${SS_COMMAND} \
  108. --user nobody --group nobody \
  109. -- run -config ${SS_CONFIG} >/dev/null 2>&1 &
  110. eend $?
  111. }
  112.  
  113. stop() {
  114. ebegin "Stopping xray"
  115. start-stop-daemon --stop \
  116. --user nobody --group nobody \
  117. --pidfile ${SS_PIDFILE}
  118. eend $?
  119. }
  120.  
  121. Нужно сделать на файл /etc/init.d/xray два симлинка xray.client.vless и xray.client.vmess
  122.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement