From e99741159bcc3e863534219835286b5d534585e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Tue, 21 Feb 2023 20:20:17 +0800 Subject: [PATCH] Update documentation --- constant/version.go | 2 +- docs/changelog.md | 6 ++++ docs/configuration/index.md | 2 ++ docs/configuration/ntp/index.md | 50 ++++++++++++++++++++++++++++++ docs/configuration/ntp/index.zh.md | 49 +++++++++++++++++++++++++++++ mkdocs.yml | 8 +++++ ntp/service.go | 2 +- 7 files changed, 117 insertions(+), 2 deletions(-) create mode 100644 docs/configuration/ntp/index.md create mode 100644 docs/configuration/ntp/index.zh.md diff --git a/constant/version.go b/constant/version.go index dee90b96..53269c7c 100644 --- a/constant/version.go +++ b/constant/version.go @@ -1,3 +1,3 @@ package constant -var Version = "1.2-beta3" +var Version = "1.2-beta4" diff --git a/docs/changelog.md b/docs/changelog.md index a84836f2..e0f5c1e2 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,9 @@ +#### 1.2-beta4 + +* Add [NTP service](/configuration/ntp) +* Add Add multiple server names and multi-user support for shadowtls +* Add strict mode support for shadowtls v3 + #### 1.2-beta3 * Update QUIC v2 version number and initial salt diff --git a/docs/configuration/index.md b/docs/configuration/index.md index 99fa9ac1..ee96b5fb 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -8,6 +8,7 @@ sing-box uses JSON for configuration files. { "log": {}, "dns": {}, + "ntp": {}, "inbounds": [], "outbounds": [], "route": {}, @@ -21,6 +22,7 @@ sing-box uses JSON for configuration files. |----------------|--------------------------------| | `log` | [Log](./log) | | `dns` | [DNS](./dns) | +| `ntp` | [NTP](./ntp) | | `inbounds` | [Inbound](./inbound) | | `outbounds` | [Outbound](./outbound) | | `route` | [Route](./route) | diff --git a/docs/configuration/ntp/index.md b/docs/configuration/ntp/index.md new file mode 100644 index 00000000..a63e9719 --- /dev/null +++ b/docs/configuration/ntp/index.md @@ -0,0 +1,50 @@ +# NTP + +Built-in NTP client service. + +If enabled, it will provide time for protocols like TLS/Shadowsocks/VMess, which is useful for environments where time +synchronization is not possible. + +### Structure + +```json +{ + "ntp": { + "enabled": false, + "server": "ntp.apple.com", + "server_port": 123, + "interval": "30m", + + ... // Dial Fields + } +} + +``` + +### Fields + +#### enabled + +Enable NTP service. + +#### server + +==Required== + +NTP server address. + +#### server_port + +NTP server port. + +123 is used by default. + +#### interval + +Time synchronization interval. + +30 minutes is used by default. + +### Dial Fields + +See [Dial Fields](/configuration/shared/dial) for details. \ No newline at end of file diff --git a/docs/configuration/ntp/index.zh.md b/docs/configuration/ntp/index.zh.md new file mode 100644 index 00000000..f8540706 --- /dev/null +++ b/docs/configuration/ntp/index.zh.md @@ -0,0 +1,49 @@ +# NTP + +内建的 NTP 客户端服务。 + +如果启用,它将为像 TLS/Shadowsocks/VMess 这样的协议提供时间,这对于无法进行时间同步的环境很有用。 + +### 结构 + +```json +{ + "ntp": { + "enabled": false, + "server": "ntp.apple.com", + "server_port": 123, + "interval": "30m", + + ... // 拨号字段 + } +} + +``` + +### 字段 + +#### enabled + +启用 NTP 服务。 + +#### server + +==必填== + +NTP 服务器地址。 + +#### server_port + +NTP 服务器端口。 + +默认使用 123。 + +#### interval + +时间同步间隔。 + +默认使用 30 分钟。 + +### 拨号字段 + +参阅 [拨号字段](/zh/configuration/shared/dial/)。 diff --git a/mkdocs.yml b/mkdocs.yml index 1bf75758..f0358522 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,6 +43,8 @@ nav: - configuration/dns/index.md - DNS Server: configuration/dns/server.md - DNS Rule: configuration/dns/rule.md + - NTP: + - configuration/ntp/index.md - Route: - configuration/route/index.md - GeoIP: configuration/route/geoip.md @@ -149,21 +151,27 @@ plugins: Features: 特性 Support: 支持 Change Log: 更新日志 + Configuration: 配置 Log: 日志 DNS Server: DNS 服务器 DNS Rule: DNS 规则 + Route: 路由 Route Rule: 路由规则 Protocol Sniff: 协议探测 + Experimental: 实验性 + Shared: 通用 Listen Fields: 监听字段 Dial Fields: 拨号字段 Multiplex: 多路复用 V2Ray Transport: V2Ray 传输层 + Inbound: 入站 Outbound: 出站 + FAQ: 常见问题 Known Issues: 已知问题 Examples: 示例 diff --git a/ntp/service.go b/ntp/service.go index fef33818..ed0fdc16 100644 --- a/ntp/service.go +++ b/ntp/service.go @@ -37,7 +37,7 @@ func NewService(ctx context.Context, router adapter.Router, logger logger.Logger } var interval time.Duration if options.Interval > 0 { - interval = time.Duration(options.Interval) * time.Second + interval = time.Duration(options.Interval) } else { interval = 30 * time.Minute }