server.jsonc 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. {
  2. "log": {
  3. "loglevel": "info"
  4. },
  5. "api": {
  6. "services": [
  7. "HandlerService",
  8. "LoggerService",
  9. "StatsService"
  10. ],
  11. "tag": "api"
  12. },
  13. "stats": {},
  14. "policy": {
  15. "levels": {
  16. "0": {
  17. "statsUserUplink": true,
  18. "statsUserDownlink": true
  19. }
  20. },
  21. "system": {
  22. "statsInboundUplink": true,
  23. "statsInboundDownlink": true,
  24. "statsOutboundUplink": true,
  25. "statsOutboundDownlink": true
  26. }
  27. },
  28. "inbounds": [
  29. {
  30. "listen": "::1",
  31. "port": 62789,
  32. "protocol": "dokodemo-door",
  33. "settings": {
  34. "address": "::1"
  35. },
  36. "tag": "api",
  37. "sniffing": null
  38. },
  39. {
  40. "tag": "Vless-TCP-XTLS",
  41. "port": 443, // This is TLS entrypoint. This entrypoint does the SSL Termination then routes the request based on the Path or ALPN type.
  42. "protocol": "vless",
  43. "settings": {
  44. "clients": [
  45. { "email": "general@vless-tcp-xtls", //Change to your own email
  46. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797", //Change to your own email
  47. "flow": "xtls-rprx-vision",
  48. "level": 0
  49. // "flow": "xtls-rprx-direct"
  50. }
  51. ],
  52. "decryption": "none",
  53. "fallbacks": [
  54. // H2
  55. {
  56. // if the SNI was `trh2o.EXAMPLE.COM` and `alpn=h2`, pass it to trojan-h2 listener
  57. "name": "trh2o.example.com",
  58. "alpn": "h2",
  59. "dest": "@trojan-h2"
  60. },
  61. {
  62. // if the SNI was `vlh2o.EXAMPLE.COM` and `alpn=h2`, pass it to vless-h2 listener
  63. "name": "vlh2o.example.com",
  64. "alpn": "h2",
  65. "dest": "@vless-h2"
  66. },
  67. {
  68. // if the SNI was `vmh2o.EXAMPLE.COM` and `alpn=h2`, pass it to vmess-h2 listener
  69. "name": "vmh2o.example.com",
  70. "alpn": "h2",
  71. "dest": "@vmess-h2"
  72. },
  73. {
  74. // if the SNI was `ssh2o.EXAMPLE.COM` and `alpn=h2`, pass it to shadowsocks-h2 listener
  75. "name": "ssh2o.example.com",
  76. "alpn": "h2",
  77. "dest": 4003
  78. },
  79. // Websocket
  80. {
  81. // if the path was `/vlws`, pass it to vless-ws listener
  82. "path": "/vlws",
  83. "dest": "@vless-ws",
  84. "xver": 2 //Enable the sending of the PROXY protocol, and send the real source IP and port to the following vmess+ws application. 1 or 2 indicates the PROXY protocol version. Consistent with the following, it is recommended to configure 2.
  85. },
  86. {
  87. // if the path was `/vmws`, pass it to vmess-ws listener
  88. "path": "/vmws",
  89. "dest": "@vmess-ws",
  90. "xver": 2
  91. },
  92. {
  93. // if the path was `/trojanws`, pass it to trojan-ws listener
  94. "path": "/trojanws",
  95. "dest": "@trojan-ws",
  96. "xver": 2
  97. },
  98. {
  99. // if the path was `/ssws`, pass it to port 4001 (shadowsocks-ws listener)
  100. "path": "/ssws",
  101. "dest": 4001
  102. },
  103. // TCP + http obfs
  104. {
  105. // if the path was `/vltc`, pass it to vless-tcp listener
  106. "path": "/vltc",
  107. "dest": "@vless-tcp",
  108. "xver": 2
  109. },
  110. {
  111. // if the path was `/vmtc`, pass it to vmess-tcp listener
  112. "path": "/vmtc",
  113. "dest": "@vmess-tcp",
  114. "xver": 2
  115. },
  116. {
  117. // if the path was `/sstc`, pass it to port 4002 (shadowsocks-tcp listener)
  118. "path": "/sstc",
  119. "dest": 4002
  120. },
  121. {
  122. // if the request's ALPN was HTTP2, pass it to trojan-tcp. (Also from trojan-tcp fallback to Nginx HTTP2)
  123. "alpn": "h2",
  124. "dest": "@trojan-tcp",
  125. "xver": 2
  126. },
  127. {
  128. // if not any other condition, pass it to Nginx HTTP1.1 listener
  129. "dest": "/dev/shm/h1.sock",
  130. "xver": 2
  131. }
  132. ]
  133. },
  134. "streamSettings": {
  135. "network": "tcp",
  136. // If XTLS Vision is enabled, "security" must be "tls"
  137. // If XTLS Direct is enabled, "security" must be "xtls"
  138. "security": "tls",
  139. // If XTLS Direct is enabled, "tlsSettings" should also be changed to "xtlsSettings"
  140. "tlsSettings": {
  141. "certificates": [
  142. {
  143. "ocspStapling": 3600, //The Xray version is not less than v1.3.0 to support configuring the time interval between OCSP stapling update and certificate hot reload. Currently V2Ray does not support it. If you use V2Ray as the server, you must delete this configuration.
  144. "certificateFile": "/etc/ssl/example.com/domain.pem", // this is te fullchain (domain + any bundle). Make sure the permissions are correct (absolute path)
  145. "keyFile": "/etc/ssl/example.com/domain-key.pem" // this is the private key of the cert. Make sure the permissions are correct (absolute path)
  146. },
  147. {
  148. // more domains and therefore more certificates can be added to this `certificates` list
  149. "ocspStapling": 3600,
  150. "certificateFile": "/etc/ssl/behindcdn.com/domain.pem",
  151. "keyFile": "/etc/ssl/behindcdn.com/domain-key.pem"
  152. }
  153. ],
  154. "minVersion": "1.2", //Xray version is not less than v1.1.4 to support configuring the minimum TLS version. Currently V2Ray does not support it. If you use V2Ray as the server, you must delete this configuration.
  155. "cipherSuites": "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256:TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384:TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256:TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256", //Xray版本不小于v1.1.4才支持配置密码套件(若无RSA证书,可删除所有RSA算法的密码套件;无ECC证书, to remove cipher suites for all ECDSA algorithms.). Currently V2Ray does not support it. If you use V2Ray as the server, you must delete this configuration.
  156. "alpn": [
  157. "h2", //Enabling h2 connection needs to configure h2 fallback, otherwise inconsistency (streaking) is easily detected by the wall and blocked.
  158. "http/1.1" //Enabling http/1.1 connection needs to configure http/1.1 fallback, otherwise inconsistency (streaking) is easily detected by the wall and blocked.
  159. ]
  160. }
  161. },
  162. "sniffing": {
  163. "enabled": true,
  164. "destOverride": [
  165. "http",
  166. "tls"
  167. ]
  168. }
  169. },
  170. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  171. // WebSocket (VLESS - VMESS - TROJAN - ShadowSocks) //
  172. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  173. {
  174. "listen": "@vless-ws",
  175. "protocol": "vless",
  176. "settings": {
  177. "clients": [
  178. { "email":"general@vless-ws", //Change to your own email
  179. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797", //Change to your own UUID
  180. "level": 0
  181. }
  182. ],
  183. "decryption": "none"
  184. },
  185. "streamSettings": {
  186. "network": "ws",
  187. "security": "none",
  188. "wsSettings": {
  189. "acceptProxyProtocol": true,
  190. "path": "/vlws"
  191. }
  192. },
  193. "sniffing": {
  194. "enabled": true,
  195. "destOverride": [
  196. "http",
  197. "tls"
  198. ]
  199. }
  200. },
  201. {
  202. "listen": "@vmess-ws",
  203. "protocol": "vmess",
  204. "settings": {
  205. "clients": [
  206. {
  207. "email": "general@vmess-ws",
  208. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797",
  209. "level": 0
  210. }
  211. ]
  212. },
  213. "streamSettings": {
  214. "network": "ws",
  215. "security": "none",
  216. "wsSettings": {
  217. "acceptProxyProtocol": true,
  218. "path": "/vmws"
  219. }
  220. },
  221. "sniffing": {
  222. "enabled": true,
  223. "destOverride": [
  224. "http",
  225. "tls"
  226. ]
  227. }
  228. },
  229. {
  230. "listen": "@trojan-ws", //trojan+ws listener process
  231. "protocol": "trojan",
  232. "settings": {
  233. "clients": [
  234. {
  235. "email":"general@trojan-ws",
  236. "password": "desdemona99",
  237. "level": 0
  238. }
  239. ]
  240. },
  241. "streamSettings": {
  242. "network": "ws",
  243. "security": "none",
  244. "wsSettings": {
  245. "acceptProxyProtocol": true, //Enable PROXY protocol reception, receive the real source IP and port
  246. "path": "/trojanws" //Change to your own path
  247. }
  248. },
  249. "sniffing": {
  250. "enabled": true,
  251. "destOverride": [
  252. "http",
  253. "tls"
  254. ]
  255. }
  256. },
  257. {
  258. "tag": "shadowsocks-ws",
  259. "listen": "::1",
  260. "port": 4001,
  261. "protocol": "shadowsocks",
  262. "settings": {
  263. "email":"general@shadowsocks-ws",
  264. "method": "chacha20-ietf-poly1305",
  265. "password": "desdemona99",
  266. "level": 0
  267. },
  268. "streamSettings": {
  269. "network": "ws",
  270. "security": "none",
  271. "wsSettings": {
  272. "path": "/ssws"
  273. }
  274. },
  275. "sniffing": {
  276. "enabled": true,
  277. "destOverride": [
  278. "http",
  279. "tls"
  280. ]
  281. }
  282. },
  283. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  284. // TCP + http obfs (VLESS - VMESS - TROJAN - ShadowSocks) //
  285. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  286. {
  287. "listen": "@trojan-tcp", //trojan+tcp listening process
  288. "protocol": "trojan",
  289. "settings": {
  290. "clients": [
  291. {
  292. "email":"general@trojan-tcp",
  293. "password": "desdemona99",
  294. "level": 0
  295. }
  296. ],
  297. "fallbacks": [
  298. {
  299. // if it was not a valid trojan reuqest, for example the trojan password was wrong, pass it to the NGINX HTTP2 cleartext UDS
  300. "dest": "/dev/shm/h2c.sock",
  301. "xver": 2 //Enable PROXY protocol sending, and send the real source IP and port to Nginx. 1 or 2 indicates the PROXY protocol version. Consistent with the above, configuration 2 is recommended.
  302. }
  303. ]
  304. },
  305. "streamSettings": {
  306. "network": "tcp",
  307. "security": "none",
  308. "tcpSettings": {
  309. "acceptProxyProtocol": true //Enable PROXY protocol reception, receive the real source IP and port before vless+tcp+tls fallback.
  310. }
  311. },
  312. "sniffing": {
  313. "enabled": true,
  314. "destOverride": [
  315. "http",
  316. "tls"
  317. ]
  318. }
  319. },
  320. {
  321. "listen": "@vless-tcp",
  322. "protocol": "vless",
  323. "settings": {
  324. "clients": [
  325. {
  326. "email":"general@vless-tcp",
  327. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797",
  328. "level": 0
  329. }
  330. ],
  331. "decryption": "none"
  332. },
  333. "streamSettings": {
  334. "network": "tcp",
  335. "security": "none",
  336. "tcpSettings": {
  337. "acceptProxyProtocol": true,
  338. "header": {
  339. "type": "http",
  340. "request": {
  341. "path": [
  342. "/vltc"
  343. ]
  344. }
  345. }
  346. }
  347. },
  348. "sniffing": {
  349. "enabled": true,
  350. "destOverride": [
  351. "http",
  352. "tls"
  353. ]
  354. }
  355. },
  356. {
  357. "listen": "@vmess-tcp",
  358. "protocol": "vmess",
  359. "settings": {
  360. "clients": [
  361. {
  362. "email":"general@vmess-tcp",
  363. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797",
  364. "level": 0
  365. }
  366. ]
  367. },
  368. "streamSettings": {
  369. "network": "tcp",
  370. "security": "none",
  371. "tcpSettings": {
  372. "acceptProxyProtocol": true,
  373. "header": {
  374. "type": "http",
  375. "request": {
  376. "path": [
  377. "/vmtc"
  378. ] //,
  379. // "headers": {
  380. // "Host": ["www.varzesh3.com"]
  381. // }
  382. }
  383. }
  384. }
  385. },
  386. "sniffing": {
  387. "enabled": true,
  388. "destOverride": [
  389. "http",
  390. "tls"
  391. ]
  392. }
  393. },
  394. {
  395. "tag": "shadowsocks-tcp",
  396. "listen": "::1",
  397. "port": 4002,
  398. "protocol": "shadowsocks",
  399. "settings": {
  400. "method": "chacha20-ietf-poly1305",
  401. "password": "desdemona99",
  402. "email": "general@shadowsocks-tcp",
  403. "level":0
  404. },
  405. "streamSettings": {
  406. "network": "tcp",
  407. "security": "none",
  408. "tcpSettings": {
  409. "header": {
  410. "type": "http",
  411. "request": {
  412. "path": [
  413. "/sstc"
  414. ]
  415. }
  416. }
  417. }
  418. },
  419. "sniffing": {
  420. "enabled": true,
  421. "destOverride": [
  422. "http",
  423. "tls"
  424. ]
  425. }
  426. },
  427. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  428. // GRPC (VLESS - VMESS - TROJAN - SHADOWSOCKS) (Nginx routes to them based on `serviceName`(HTTP2 Path) ) //
  429. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  430. {
  431. "tag": "trojan-grpc",
  432. "listen": "::1", // listen on localhost
  433. "port": 3001,
  434. "protocol": "trojan",
  435. "settings": {
  436. "clients": [
  437. {
  438. "email": "general@trojan-grpc",
  439. "password": "desdemona99",
  440. "level":0
  441. }
  442. ]
  443. },
  444. "streamSettings": {
  445. "network": "grpc",
  446. "security": "none",
  447. "grpcSettings": {
  448. "serviceName": "trgrpc"
  449. }
  450. }
  451. },
  452. {
  453. "tag": "vless-grpc",
  454. "listen": "::1", // listen on localhost
  455. "port": 3002,
  456. "protocol": "vless",
  457. "settings": {
  458. "clients": [
  459. {
  460. "email":"general@vless-grpc",
  461. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797",
  462. "level": 0
  463. }
  464. ],
  465. "decryption": "none"
  466. },
  467. "streamSettings": {
  468. "network": "grpc",
  469. "security": "none",
  470. "grpcSettings": {
  471. "serviceName": "vlgrpc"
  472. }
  473. }
  474. },
  475. {
  476. "tag": "vmess-grpc",
  477. "listen": "::1", // listen on localhost
  478. "port": 3003,
  479. "protocol": "vmess",
  480. "settings": {
  481. "clients": [
  482. {
  483. "email":"general@vmess-grpc",
  484. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797", //Change to your own UUID
  485. "level": 0
  486. }
  487. ]
  488. },
  489. "streamSettings": {
  490. "network": "grpc",
  491. "security": "none",
  492. "grpcSettings": {
  493. "serviceName": "vmgrpc"
  494. }
  495. }
  496. },
  497. {
  498. "listen": "::1", //Only listen on localhost
  499. "port": 3004,
  500. "protocol": "shadowsocks",
  501. "settings": {
  502. "method": "chacha20-ietf-poly1305",
  503. "password": "desdemona99", //Change to your own password
  504. "email": "[email protected]"
  505. },
  506. "streamSettings": {
  507. "network": "grpc",
  508. "security": "none",
  509. "grpcSettings": {
  510. "serviceName": "ssgrpc" //Change to your own gRPC service name, similar to Path in HTTP/2.
  511. }
  512. },
  513. "sniffing": {
  514. "enabled": true,
  515. "destOverride": [
  516. "http",
  517. "tls"
  518. ]
  519. }
  520. },
  521. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  522. // H2 (VLESS - VMESS - TROJAN - SHADOWSOCKS) //
  523. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  524. {
  525. "listen": "@trojan-h2",
  526. "protocol": "trojan",
  527. "settings": {
  528. "clients": [
  529. {
  530. "email":"general@trojan-h2",
  531. "password": "desdemona99",
  532. "level": 0
  533. }
  534. ]
  535. },
  536. "streamSettings": {
  537. "network": "h2",
  538. "security": "none",
  539. "httpSettings": {
  540. "path": "/trh2"
  541. }
  542. }
  543. },
  544. {
  545. "listen": "@vless-h2",
  546. "protocol": "vless",
  547. "settings": {
  548. "clients": [
  549. {
  550. "email":"general@vless-h2", //Change to your own email
  551. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797", //Change to your own UUID
  552. "level": 0
  553. }
  554. ],
  555. "decryption": "none"
  556. },
  557. "streamSettings": {
  558. "network": "h2",
  559. "security": "none",
  560. "httpSettings": {
  561. "path": "/vlh2"
  562. }
  563. },
  564. "sniffing": {
  565. "enabled": true,
  566. "destOverride": [
  567. "http",
  568. "tls"
  569. ]
  570. }
  571. },
  572. {
  573. "listen": "@vmess-h2",
  574. "protocol": "vmess",
  575. "settings": {
  576. "clients": [
  577. {
  578. "email":"general@vmess-h2",
  579. "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797",
  580. "level": 0
  581. }
  582. ]
  583. },
  584. "streamSettings": {
  585. "network": "h2",
  586. "security": "none",
  587. "httpSettings": {
  588. "path": "/vmh2"
  589. }
  590. },
  591. "sniffing": {
  592. "enabled": true,
  593. "destOverride": [
  594. "http",
  595. "tls"
  596. ]
  597. }
  598. },
  599. {
  600. "tag": "shadowsocks-h2",
  601. "listen": "::1",
  602. "port": 4003,
  603. "protocol": "shadowsocks",
  604. "settings": {
  605. "method": "chacha20-ietf-poly1305",
  606. "password": "desdemona99", //Change to your own password
  607. "email": "general@shadowsocks-h2",
  608. "level": 0
  609. },
  610. "streamSettings": {
  611. "network": "h2",
  612. "security": "none",
  613. "httpSettings": {
  614. "path": "/ssh2"
  615. }
  616. },
  617. "sniffing": {
  618. "enabled": true,
  619. "destOverride": [
  620. "http",
  621. "tls"
  622. ]
  623. }
  624. } //,
  625. // {
  626. // "port": 80, // this is http entrypoint, uncomment to enable vless-ws, vless-tcp, vmess-ws, v,ess-tcp, shadowwsocks-ws and shadowsocks-tcp on HTTP
  627. // "protocol": "vless",
  628. // "settings": {
  629. // "clients": [
  630. // {
  631. // "id": "90e4903e-66a4-45f7-abda-fd5d5ed7f797"
  632. // }
  633. // ],
  634. // "fallbacks": [
  635. // {
  636. // "path": "/vlws",
  637. // "dest": "@vless-ws",
  638. // "xver": 2
  639. // },
  640. // {
  641. // "path": "/vmws",
  642. // "dest": "@vmess-ws", // the same vmess-ws used in 443 TLS entrypint is used here as well
  643. // "xver": 2
  644. // },
  645. // {
  646. // "path": "/vltc",
  647. // "dest": "@vless-tcp",
  648. // "xver": 2
  649. // },
  650. // {
  651. // "path": "/vmtc",
  652. // "dest": "@vmess-tcp",
  653. // "xver": 2
  654. // },
  655. // {
  656. // "dest": "/dev/shm/h1.sock", // defaults to Nginx HTTP1.1 listener
  657. // "xver": 2
  658. // },
  659. // {
  660. // "path": "/ssws",
  661. // "dest": 4001
  662. // },
  663. // {
  664. // "path": "/sstc",
  665. // "dest": 4002
  666. // }
  667. // ],
  668. // "decryption": "none"
  669. // },
  670. // "streamSettings": {
  671. // "network": "tcp",
  672. // "security": "none"
  673. // },
  674. // "sniffing": {
  675. // "enabled": true,
  676. // "destOverride": ["http", "tls"]
  677. // }
  678. // }
  679. ],
  680. "outbounds": [
  681. {
  682. "protocol": "freedom",
  683. "settings": {}
  684. },
  685. {
  686. "protocol": "blackhole",
  687. "tag": "blocked"
  688. },
  689. {
  690. // A DNS Cache can be setup and added here to imporve performance (the corresponding rule should be uncommented)
  691. "tag": "DNS-Internal",
  692. "protocol": "dns",
  693. "settings": {
  694. "address": "::1",
  695. "port": 53
  696. }
  697. }
  698. ],
  699. "routing": {
  700. "domainStrategy": "AsIs",
  701. "rules": [
  702. {
  703. "inboundTag": [
  704. "api"
  705. ],
  706. "outboundTag": "api",
  707. "type": "field"
  708. },
  709. // {
  710. // // DNS Cache rule
  711. // "type": "field",
  712. // "port": 53,
  713. // "network": "tcp,udp",
  714. // "outboundTag": "DNS-Internal"
  715. // },
  716. {
  717. "type": "field",
  718. "outboundTag": "blocked",
  719. "ip": [
  720. "geoip:private"
  721. ]
  722. },
  723. {
  724. "type": "field", // Block BitTorrent protocol
  725. "outboundTag": "blocked",
  726. "protocol": [
  727. "bittorrent"
  728. ]
  729. }
  730. ]
  731. }
  732. }