Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Jun 15, 2023
1 parent a695a5e commit 6ee544c
Show file tree
Hide file tree
Showing 11 changed files with 254 additions and 78 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ npx surgio generate
```

:::warning 注意
目前 Surgio 仅支持 Node.js 版本 >= 16.9.0。
目前 Surgio 仅支持 Node.js 版本 >= 18.0.0。
:::

### 交流
Expand Down
31 changes: 29 additions & 2 deletions docs/guide/advance/custom-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ module.exports = {
2. 默认开启严格模式;
:::

### useGlob <Badge text="v2.19.0" vertical="middle" />
### useGlob

能够使用 glob 语法筛选出节点。

Expand All @@ -220,7 +220,7 @@ module.exports = {
}
```

### discardGlob <Badge text="v2.19.0" vertical="middle" />
### discardGlob

能够使用 glob 语法移出节点。

Expand All @@ -237,6 +237,33 @@ module.exports = {
}
```

### reverseFilter

你可以使用 `reverseFilter` 来反转过滤器的结果。

```js
const notUSFilter = reverseFilter(usFilter)
```

### mergeReversedFilters

你可以使用 `mergeReversedFilters` 来合并多个反转过滤器,`discardKeywords`, `discardProviders`, `discardGlob` 过滤器。


```js
// 丢弃 US 和包含 BGP 关键字的节点
const notUSAndNotBGP = mergeReversedFilters(
[notUSFilter, discardKeywords(['BGP'])],
true, // 严格模式
)

// 香港 BGP ✅
// 香港 IPLC ✅
// 洛杉矶 BGP 🚫
// 洛杉矶 IPLC ✅
```


## 如何在自定义过滤器时引用内置的过滤器

你可能需要在自定义过滤器时引用内置的过滤器(你可以在 [这里](/guide/custom-template.md#过滤器) 找到所有内置的过滤器)。
Expand Down
76 changes: 37 additions & 39 deletions docs/guide/custom-config.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
sidebarDepth: 2
sidebarDepth: 1
---

# 配置文件
Expand Down Expand Up @@ -28,17 +28,15 @@ module.exports = {
};
```

## 配置属性

### artifacts
## artifacts

- 类型: `Artifact[]`
- 默认值: `undefined`
- <Badge text="必须" vertical="middle" />

数组内容见 [自定义 Artifact](/guide/custom-artifact.md)

### urlBase
## urlBase

- 类型: `string`
- 默认值: `/`
Expand All @@ -50,7 +48,7 @@ module.exports = {
:::


### remoteSnippets
## remoteSnippets

- 类型: `RemoteSnippet[]`
- 默认值: `undefined`
Expand Down Expand Up @@ -103,7 +101,7 @@ module.exports = {
片段中宏的入参需要和 `main` 方法调用时的入参 **一一对应**,一个都不能少。
:::

### upload
## upload

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -116,25 +114,25 @@ module.exports = {
- 请不要通过 CDN 访问 OSS 内的文件,这样会导致更新不即时且很难删除
:::

#### upload.prefix
### upload.prefix

- 类型: `string`
- 默认值: `/`

默认保存至根目录,可以修改子目录名,以 / 结尾

#### upload.bucket
### upload.bucket

- 类型: `string`
- 默认值: `undefined`
- <Badge text="必须" vertical="middle" />

#### upload.region
### upload.region

- 类型: `string`
- 默认值: `oss-cn-hangzhou`

#### upload.accessKeyId
### upload.accessKeyId

- 类型: `string`
- 默认值: `undefined`
Expand All @@ -144,7 +142,7 @@ module.exports = {
请不要将该字段上传至公共仓库。
:::

#### upload.accessKeySecret
### upload.accessKeySecret

- 类型: `string`
- 默认值: `undefined`
Expand All @@ -154,18 +152,18 @@ module.exports = {
请不要将该字段上传至公共仓库。
:::

### binPath
## binPath

如果需要生成针对 Surge 的 SSR 订阅,需要额外配置此项。

#### binPath.shadowsocksr
### binPath.shadowsocksr

- 类型: `string`
- 默认值: `undefined`

SSR 的可执行文件地址。请使用 libev 版本的二进制文件,可以在 [这篇文章](/guide/advance/surge-advance.md) 找到下载地址和使用方法。

### surgeConfig
## surgeConfig

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -177,7 +175,7 @@ module.exports = {
};
```

#### surgeConfig.resolveHostname
### surgeConfig.resolveHostname

- 类型: `boolean`
- 默认值: `false`
Expand All @@ -186,14 +184,14 @@ module.exports = {

打开这个选项后,Surgio 会在生成配置的时候解析域名。不过,这必然会造成生成时间延长,所以请按照个人的需要进行选择。

#### surgeConfig.vmessAEAD
### surgeConfig.vmessAEAD

- 类型: `boolean`
- 默认值: `true`

默认开启 Vmess AEAD 加密,如果您的服务器不支持 AEAD 加密,请关闭。

### quantumultXConfig
## quantumultXConfig

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -205,14 +203,14 @@ module.exports = {
};
```

#### quantumultXConfig.vmessAEAD
### quantumultXConfig.vmessAEAD

- 类型: `boolean`
- 默认值: `true`

默认开启 Vmess AEAD 加密,如果您的服务器不支持 AEAD 加密,请关闭。

### clashConfig
## clashConfig

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -226,14 +224,14 @@ module.exports = {
};
```

#### clashConfig.enableTuic
### clashConfig.enableTuic

- 类型: `boolean`
- 默认值: `false`

目前仅 Stash 支持 Tuic,如果你希望在 Clash 订阅中输出 Tuic 节点请开启此项。

#### clashConfig.enableShadowTls
### clashConfig.enableShadowTls

> <Badge text="v3.0.0" vertical="middle" />
Expand All @@ -242,7 +240,7 @@ module.exports = {

目前仅 Stash 支持 shadow-tls,如果你希望在 Shadowsocks 节点中使用 shadow-tls 请开启此项。

### surfboardConfig
## surfboardConfig

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -254,14 +252,14 @@ module.exports = {
};
```

#### surfboardConfig.vmessAEAD
### surfboardConfig.vmessAEAD

- 类型: `boolean`
- 默认值: `true`

默认开启 Vmess AEAD 加密,如果您的服务器不支持 AEAD 加密,请关闭。

### gateway
## gateway

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -275,21 +273,21 @@ module.exports = {

托管 API 相关配置

#### gateway.auth
### gateway.auth

- 类型: `boolean`
- 默认值: `false`

是否开启鉴权,默认关闭。若开启则需要在访问 URL 上增加参数 `access_token`

#### gateway.accessToken
### gateway.accessToken

- 类型: `string`
- 默认值: `undefined`

用于调用接口和登录的鉴权码。

#### gateway.viewerToken
### gateway.viewerToken

- 类型: `string`
- 默认值: `undefined`
Expand All @@ -300,7 +298,7 @@ module.exports = {
- `/export-providers`
- `/render`

#### gateway.useCacheOnError
### gateway.useCacheOnError

- 类型: `boolean`
- 默认值: `false`
Expand All @@ -314,7 +312,7 @@ module.exports = {
2. 适用缓存的接口有 `/get-artifact``/export-providers`
:::

#### gateway.passRequestUserAgent
### gateway.passRequestUserAgent

> <Badge text="Gateway: v2.0.0" vertical="middle" /><br />
> <Badge text="Surgio v3.0.0" vertical="middle" />
Expand All @@ -324,7 +322,7 @@ module.exports = {

是否将 `/get-artifact` 请求中的 `User-Agent` 传递给上游机场的订阅服务器。这个选项主要用于解决某些机场的订阅服务器对 `User-Agent` 有特殊处理的问题。

### customFilters
## customFilters

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -335,21 +333,21 @@ module.exports = {
全局的过滤器优先级没有 Provider 中定义的过滤器高,如果遇到同名的过滤器则这里定义的值会被覆盖。
:::

### proxyTestUrl
## proxyTestUrl

- 类型: `string`
- 默认值: `http://cp.cloudflare.com/generate_204`

Clash 规则中的 `url`

### proxyTestInterval
## proxyTestInterval

- 类型: `number`
- 默认值: `1200`

Clash 规则中的 `interval`

### customParams
## customParams

- 类型: `object`
- 默认值: `{}`
Expand All @@ -361,7 +359,7 @@ Clash 规则中的 `interval`。
2. 在合并全局、局部模板变量和面板 URL 参数时的优先级为:URL 参数 > 局部 > 全局;
:::

### checkHostname
## checkHostname

- 类型: `boolean`
- 默认值: `false`
Expand All @@ -370,7 +368,7 @@ Clash 规则中的 `interval`。

某些机场的节点域名 TTL 非常小,在某些情况下可能会导致 DNS 回溯解析超时,这样会导致节点本身可用但是被抛弃,所以建议谨慎开启该选项。

### flags
## flags

- 类型: `object`
- 默认值: `undefined`
Expand All @@ -395,14 +393,14 @@ module.exports = {
2. 英文字母请使用大写;
:::

### cache
## cache

- 类型: `object`
- 默认值: `undefined`

定义缓存的实现方式。默认情况下使用本地缓存文件和内存的方式存储。如果你使用了 API 网关,非常推荐开启 Redis 缓存,可以有效降低冷启动的时间。

#### cache.type
### cache.type

- 类型: `string`
- 默认值: `default`
Expand All @@ -412,7 +410,7 @@ module.exports = {
- `default`:使用本地缓存文件和内存的方式存储
- `redis`: 使用 Redis 的方式存储

#### cache.redisUrl
### cache.redisUrl

- 类型: `string`
- 默认值: `undefined`
Expand Down
Loading

0 comments on commit 6ee544c

Please sign in to comment.