Chore: lint

This commit is contained in:
JimhHan 2021-04-06 19:05:35 +08:00
parent f44afc3110
commit effaa0e7ed
No known key found for this signature in database
GPG Key ID: 48D5D7CF95157AC5
19 changed files with 132 additions and 134 deletions

4
.prettierignore Normal file
View File

@ -0,0 +1,4 @@
node_modules/
.vuepress/dist
.temp/
dist/

View File

@ -5,8 +5,8 @@ module.exports = {
"/": { "/": {
lang: "zh-CN", lang: "zh-CN",
title: "Project X", title: "Project X",
description: "Xray 官方文档" description: "Xray 官方文档",
} },
}, },
themeConfig: { themeConfig: {
smoothScroll: true, smoothScroll: true,
@ -30,9 +30,9 @@ module.exports = {
ariaLabel: "Language Menu", ariaLabel: "Language Menu",
items: [ items: [
{ text: "简体中文", link: "/" }, { text: "简体中文", link: "/" },
{ text: "English", link: "/en" } { text: "English", link: "/en" },
] ],
} },
], ],
sidebar: { sidebar: {
"/config/": [ "/config/": [
@ -43,8 +43,8 @@ module.exports = {
"features/xtls", "features/xtls",
"features/fallback", "features/fallback",
"features/env", "features/env",
"features/multiple" "features/multiple",
] ],
}, },
{ {
title: "基础配置", title: "基础配置",
@ -60,8 +60,8 @@ module.exports = {
"reverse", "reverse",
"routing", "routing",
"stats", "stats",
"transport" "transport",
] ],
}, },
{ {
title: "入站代理", title: "入站代理",
@ -74,8 +74,8 @@ module.exports = {
"inbounds/socks", "inbounds/socks",
"inbounds/trojan", "inbounds/trojan",
"inbounds/vless", "inbounds/vless",
"inbounds/vmess" "inbounds/vmess",
] ],
}, },
{ {
title: "出站代理", title: "出站代理",
@ -90,8 +90,8 @@ module.exports = {
"outbounds/socks", "outbounds/socks",
"outbounds/trojan", "outbounds/trojan",
"outbounds/vless", "outbounds/vless",
"outbounds/vmess" "outbounds/vmess",
] ],
}, },
{ {
title: "底层传输", title: "底层传输",
@ -103,9 +103,9 @@ module.exports = {
"transports/mkcp", "transports/mkcp",
"transports/quic", "transports/quic",
"transports/tcp", "transports/tcp",
"transports/websocket" "transports/websocket",
] ],
} },
], ],
"/document/level-0/": [ "/document/level-0/": [
"ch01-preface", "ch01-preface",
@ -116,41 +116,41 @@ module.exports = {
"ch06-certificates", "ch06-certificates",
"ch07-xray-server", "ch07-xray-server",
"ch08-xray-clients", "ch08-xray-clients",
"ch09-appendix" "ch09-appendix",
], ],
"/document/level-1/": [ "/document/level-1/": [
"fallbacks-lv1", "fallbacks-lv1",
"routing-lv1-part1", "routing-lv1-part1",
"routing-lv1-part2", "routing-lv1-part2",
"work", "work",
"fallbacks-with-sni" "fallbacks-with-sni",
], ],
"/document/level-2/": [ "/document/level-2/": [
"transparent_proxy/transparent_proxy", "transparent_proxy/transparent_proxy",
"tproxy", "tproxy",
"iptables_gid", "iptables_gid",
"redirect" "redirect",
], ],
"/": "auto" "/": "auto",
} },
}, },
markdown: { markdown: {
toc: { toc: {
includeLevel: [2] includeLevel: [2],
}, },
extendMarkdown: md => { extendMarkdown: (md) => {
md.use(require("markdown-it-footnote")); md.use(require("markdown-it-footnote"));
}
}, },
chainWebpack: config => { },
chainWebpack: (config) => {
config.module config.module
.rule("webp") .rule("webp")
.test(/\.(webp)(\?.*)?$/) .test(/\.(webp)(\?.*)?$/)
.use("file-loader") .use("file-loader")
.loader("file-loader") .loader("file-loader")
.options({ .options({
name: `assets/img/[name].[hash:8].[ext]` name: `assets/img/[name].[hash:8].[ext]`,
}); });
}, },
postcss: { plugins: [require("autoprefixer")] } postcss: { plugins: [require("autoprefixer")] },
}; };

View File

@ -21,7 +21,7 @@ export default Vue.extend({
data() { data() {
return { return {
enable: false, enable: false,
text: "" text: "",
}; };
}, },
mounted() { mounted() {
@ -40,7 +40,7 @@ export default Vue.extend({
} else { } else {
html.setAttribute("theme", "light"); html.setAttribute("theme", "light");
} }
} },
} },
}); });
</script> </script>

View File

@ -1,3 +1,3 @@
module.exports = { module.exports = {
extend: "@vuepress/theme-default" extend: "@vuepress/theme-default",
}; };

View File

@ -7,8 +7,8 @@ import ParentLayout from "@parent-theme/layouts/Layout.vue";
import Vue from "vue"; import Vue from "vue";
export default Vue.extend({ export default Vue.extend({
components: { components: {
ParentLayout ParentLayout,
} },
}); });
</script> </script>

View File

@ -21,6 +21,7 @@ sidebar: auto
## 2021.3.25 ## 2021.3.25
<!-- prettier-ignore -->
没错还在变。 -_- 没错还在变。 -_-
## 2021.3.15 ## 2021.3.15

View File

@ -75,9 +75,8 @@ Trojan 被设计工作在正确配置的加密 TLS 隧道
此外,目前 XTLS 仅支持 TCP、mKCP、DomainSocket 这三种传输方式。 此外,目前 XTLS 仅支持 TCP、mKCP、DomainSocket 这三种传输方式。
<!-- prettier-ignore-start --> <!-- prettier-ignore -->
::: tip 关于 xtls-rprx-\*-udp443 流控模式 ::: tip 关于 xtls-rprx-\*-udp443 流控模式
<!-- prettier-ignore-end -->
启用了 Xray-core 的 XTLS 时,通往 UDP 443 端口的流量默认会被拦截(一般情况下为 QUIC这样应用就不会使用 QUIC 而会使用 TLSXTLS 才会真正生效。实际上QUIC 本身也不适合被代理,因为 QUIC 自带了 TCP 的功能, 它作为 UDP 流量在通过 Trojan 协议传输时,底层协议为 TCP就相当于两层 TCP 了。 启用了 Xray-core 的 XTLS 时,通往 UDP 443 端口的流量默认会被拦截(一般情况下为 QUIC这样应用就不会使用 QUIC 而会使用 TLSXTLS 才会真正生效。实际上QUIC 本身也不适合被代理,因为 QUIC 自带了 TCP 的功能, 它作为 UDP 流量在通过 Trojan 协议传输时,底层协议为 TCP就相当于两层 TCP 了。

View File

@ -113,9 +113,8 @@ VLESS 的用户 ID可以是任意小于 30 字节的字符串, 也可以是
此外,目前 XTLS 仅支持 TCP、mKCP、DomainSocket 这三种传输方式。 此外,目前 XTLS 仅支持 TCP、mKCP、DomainSocket 这三种传输方式。
::: :::
<!-- prettier-ignore-start --> <!-- prettier-ignore -->
::: tip 关于 xtls-rprx-*-udp443 流控模式 ::: tip 关于 xtls-rprx-*-udp443 流控模式
<!-- prettier-ignore-end -->
启用了 Xray-core 的 XTLS 时,通往 UDP 443 端口的流量默认会被拦截(一般情况下为 QUIC这样应用就不会使用 QUIC 而会使用 TLSXTLS 才会真正生效。实际上QUIC 本身也不适合被代理,因为 QUIC 自带了 TCP 的功能,它作为 UDP 流量在通过 VLESS 协议传输时,底层协议为 TCP就相当于两层 TCP 了。 启用了 Xray-core 的 XTLS 时,通往 UDP 443 端口的流量默认会被拦截(一般情况下为 QUIC这样应用就不会使用 QUIC 而会使用 TLSXTLS 才会真正生效。实际上QUIC 本身也不适合被代理,因为 QUIC 自带了 TCP 的功能,它作为 UDP 流量在通过 VLESS 协议传输时,底层协议为 TCP就相当于两层 TCP 了。

View File

@ -114,13 +114,16 @@
outbound: outbound:
```json ```json
({ {
"tag": "out", "tag": "out",
"protocol": "freedom", "protocol": "freedom",
"settings": { "settings": {
"redirect": "127.0.0.1:80" // 将所有流量转发到网页服务器 "redirect": "127.0.0.1:80" // 将所有流量转发到网页服务器
} }
}, }
```
```json
{ {
"protocol": "vmess", "protocol": "vmess",
"settings": { "settings": {
@ -137,29 +140,23 @@ outbound:
] ]
}, },
"tag": "interconn" "tag": "interconn"
}) }
``` ```
路由配置: 路由配置:
```json ```json
"routing": { {
"rules": [ "rules": [
{ {
"type": "field", "type": "field",
"inboundTag": [ "inboundTag": ["bridge"],
"bridge" "domain": ["full:test.xray.com"],
],
"domain": [
"full:test.xray.com"
],
"outboundTag": "interconn" "outboundTag": "interconn"
}, },
{ {
"type": "field", "type": "field",
"inboundTag": [ "inboundTag": ["bridge"],
"bridge"
],
"outboundTag": "out" "outboundTag": "out"
} }
] ]
@ -186,18 +183,21 @@ outbound:
inbound: inbound:
```json ```json
({ {
"tag": "external", "tag": "external",
"port": 80, // 开放 80 端口,用于接收外部的 HTTP 访问 "port": 80,
"protocol": "dokodemo-door", "protocol": "dokodemo-door",
"settings": { "settings": {
"address": "127.0.0.1", "address": "127.0.0.1",
"port": 80, "port": 80,
"network": "tcp" "network": "tcp"
} }
}, }
```
```json
{ {
"port": 1024, // 用于接收 bridge 的连接 "port": 1024,
"tag": "interconn", "tag": "interconn",
"protocol": "vmess", "protocol": "vmess",
"settings": { "settings": {
@ -207,26 +207,22 @@ inbound:
} }
] ]
} }
}) }
``` ```
路由配置: 路由配置:
```json ```json
"routing": { {
"rules": [ "rules": [
{ {
"type": "field", "type": "field",
"inboundTag": [ "inboundTag": ["external"],
"external"
],
"outboundTag": "portal" "outboundTag": "portal"
}, },
{ {
"type": "field", "type": "field",
"inboundTag": [ "inboundTag": ["interconn"],
"interconn"
],
"outboundTag": "portal" "outboundTag": "portal"
} }
] ]

View File

@ -83,5 +83,3 @@ WebSocket 所使用的 HTTP 协议路径,默认值为 `"/"`。
- 设置环境变量指定要监听的地址端口,比如 `XRAY_BROWSER_DIALER = 127.0.0.1:8080` - 设置环境变量指定要监听的地址端口,比如 `XRAY_BROWSER_DIALER = 127.0.0.1:8080`
- 先运行 Xray-core再用任一浏览器访问上面指定的地址端口还可以 `F12``Console``Network` - 先运行 Xray-core再用任一浏览器访问上面指定的地址端口还可以 `F12``Console``Network`
- 浏览器会限制 WebSocket 连接数,所以建议开启 `Mux.Cool` - 浏览器会限制 WebSocket 连接数,所以建议开启 `Mux.Cool`

View File

@ -77,9 +77,8 @@ Linux 服务器的安全防护是一个纷繁复杂的巨大课题。无数的
- 删除 `22` 并改成 `9753` - 删除 `22` 并改成 `9753`
- 说明:如果这一行开头有个`#`,证明这一行【不生效】(被注释掉了),你可像我一样在文件最后写一个不带`#`的,或者把`#`删掉就好。 - 说明:如果这一行开头有个`#`,证明这一行【不生效】(被注释掉了),你可像我一样在文件最后写一个不带`#`的,或者把`#`删掉就好。
::: warning
::: warning 注意 注意 本文以`9753`为例,就意味着随着本文的发布,这个端口会变成一个不大不小的特征,也许会被攻击者优先尝试、也许被 GFW 干扰、阻断。所以我强烈建议你用一个自己想到的其他端口,毕竟,你有 6 万多个端口可以自由选择。
本文以`9753`为例就意味着随着本文的发布这个端口会变成一个不大不小的特征也许会被攻击者优先尝试、也许被GFW干扰、阻断。所以我强烈建议你用一个自己想到的其他端口毕竟你有6万多个端口可以自由选择。
::: :::
6. 我们要做的第三件事,是【保存文件并退出】 6. 我们要做的第三件事,是【保存文件并退出】
@ -139,7 +138,8 @@ Linux 服务器的安全防护是一个纷繁复杂的巨大课题。无数的
# apt update && apt install sudo # apt update && apt install sudo
``` ```
聪明的你大概已经发现,这一行命令其实是两个命令。前一半 `apt update` 你之前已经见过并且用过了,是去服务器刷新软件版本信息。后面的 `apt install` 就是这一次要用到的【安装命令】。两条连接在一起,就是让系统去【刷新可用的最新软件,然后安装最新版的`sudo`程序】。 `&&` 则是把两个命令连起来执行的意思。 聪明的你大概已经发现,这一行命令其实是两个命令。前一半 `apt update` 你之前已经见过并且用过了,是去服务器刷新软件版本信息。后面的 `apt install`
就是这一次要用到的【安装命令】。两条连接在一起,就是让系统去【刷新可用的最新软件,然后安装最新版的`sudo`程序】。 `&&` 则是把两个命令连起来执行的意思。
6. 我们要做的第三件事,是【把`vpsadmin`用户加入`sudo`名单里,让他有资格借用`root`的神力】 6. 我们要做的第三件事,是【把`vpsadmin`用户加入`sudo`名单里,让他有资格借用`root`的神力】
@ -149,9 +149,9 @@ Linux 服务器的安全防护是一个纷繁复杂的巨大课题。无数的
`User Privilege Specification` 下加入一行 `vpsadmin ALL=(ALL) NOPASSWD: ALL` 即可。 `User Privilege Specification` 下加入一行 `vpsadmin ALL=(ALL) NOPASSWD: ALL` 即可。
::: warning 注意 我要特别说明的是`NOPASSWD`这个设置,它的意思是`vpsadmin`用户临时使用`root`权限时,不用额外输入密码。**这与一般的安全建议相反**
::: warning 注意 。我之所以如此推荐,是因为很多新人不顾危险坚持使用`root`账号就是因为用`root`时不用重复输入密码、觉得轻松。“两害相权取其轻”,我认为【直接用`root`用户的风险】大于【使用`sudo`
我要特别说明的是`NOPASSWD`这个设置,它的意思是`vpsadmin`用户临时使用`root`权限时,不用额外输入密码。**这与一般的安全建议相反**。我之所以如此推荐,是因为很多新人不顾危险坚持使用`root`账号就是因为用`root`时不用重复输入密码、觉得轻松。“两害相权取其轻”,我认为【直接用`root`用户的风险】大于【使用`sudo`时不用输密码的风险】,所以做了以上的建议。 时不用输密码的风险】,所以做了以上的建议。
如果你希望遵守传统习惯、每次使用`sudo`时需要输入密码,那么这一行改成 `vpsadmin ALL=(ALL:ALL) ALL` 即可。 如果你希望遵守传统习惯、每次使用`sudo`时需要输入密码,那么这一行改成 `vpsadmin ALL=(ALL:ALL) ALL` 即可。
::: :::
@ -306,7 +306,6 @@ Linux 服务器的安全防护是一个纷繁复杂的巨大课题。无数的
![PuTTY指定私钥位置](./ch04-img18-putty-privatekey-location.png) ![PuTTY指定私钥位置](./ch04-img18-putty-privatekey-location.png)
5. 至此,【密钥登录】已成功开启、【密码验证】已成功关闭、并且还给 PuTTY 保存了默认的登录用户名和私钥。未来使用 PuTTY 登录时,载入`VPS-SERVER`配置后,点击`Open`就可以一键登录了。 5. 至此,【密钥登录】已成功开启、【密码验证】已成功关闭、并且还给 PuTTY 保存了默认的登录用户名和私钥。未来使用 PuTTY 登录时,载入`VPS-SERVER`配置后,点击`Open`就可以一键登录了。
如果你给私钥设置了密码保护,登录时当然还需要输入这个密码才能使用密钥,如下图: 如果你给私钥设置了密码保护,登录时当然还需要输入这个密码才能使用密钥,如下图:

View File

@ -9,6 +9,7 @@
"@types/bootstrap": "^5.0.11", "@types/bootstrap": "^5.0.11",
"@types/jquery": "^3.5.5", "@types/jquery": "^3.5.5",
"@vuepress/plugin-back-to-top": "^1.8.2", "@vuepress/plugin-back-to-top": "^1.8.2",
"prettier": "^2.2.1",
"sass": "^1.32.8", "sass": "^1.32.8",
"sass-loader": "^8.0.2", "sass-loader": "^8.0.2",
"vue-property-decorator": "^9.1.2", "vue-property-decorator": "^9.1.2",
@ -16,7 +17,8 @@
}, },
"scripts": { "scripts": {
"docs:dev": "vuepress dev docs", "docs:dev": "vuepress dev docs",
"docs:build": "vuepress build docs" "docs:build": "vuepress build docs",
"lint": "prettier --write ."
}, },
"dependencies": { "dependencies": {
"@popperjs/core": "^2.9.1", "@popperjs/core": "^2.9.1",

View File

@ -6398,6 +6398,11 @@ prettier@^1.18.2:
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.19.1.tgz#f7d7f5ff8a9cd872a7be4ca142095956a60797cb"
integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew== integrity sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==
prettier@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.2.1.tgz#795a1a78dd52f073da0cd42b21f9c91381923ff5"
integrity sha512-PqyhM2yCjg/oKkFPtTGUojv7gnZAoG80ttl45O6x2Ug/rMJw4wcc9k6aaf2hibP7BGVCCM33gZoGjyvt9mm16Q==
pretty-error@^2.0.2: pretty-error@^2.0.2:
version "2.1.2" version "2.1.2"
resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6" resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.2.tgz#be89f82d81b1c86ec8fdfbc385045882727f93b6"
@ -8103,11 +8108,6 @@ vuepress-plugin-smooth-scroll@^0.0.3:
dependencies: dependencies:
smoothscroll-polyfill "^0.4.3" smoothscroll-polyfill "^0.4.3"
vuepress-theme-default-prefers-color-scheme@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/vuepress-theme-default-prefers-color-scheme/-/vuepress-theme-default-prefers-color-scheme-2.0.0.tgz#c5d305b1b4d10d0915b4bb413e554966d5171b25"
integrity sha512-4sA3DCiaIIHVjcIC5+mF00mf29IU27KSH97Ga4xb4nUwwlC6eYHg2qchEVOgV25XogCtGgpZ/DCrTkywxvuBcg==
vuepress@^1.8.2: vuepress@^1.8.2:
version "1.8.2" version "1.8.2"
resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.8.2.tgz#97e8bf979630611fc7b621fc4cc35b798ee5e847" resolved "https://registry.yarnpkg.com/vuepress/-/vuepress-1.8.2.tgz#97e8bf979630611fc7b621fc4cc35b798ee5e847"