From 6efadc8ed3bbb1d2919882758e3fc8703362f2f0 Mon Sep 17 00:00:00 2001 From: Toby Date: Fri, 29 Mar 2024 14:58:10 -0700 Subject: [PATCH] various updates --- docs/analyzers.md | 4 ++++ docs/analyzers.zh.md | 8 ++++++-- docs/build-run.md | 1 + docs/build-run.zh.md | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs/analyzers.md b/docs/analyzers.md index f4c5e48..be2d94c 100644 --- a/docs/analyzers.md +++ b/docs/analyzers.md @@ -11,6 +11,10 @@ only those that are needed. This document lists the properties provided by each analyzer that can be used by rules. +!!! tip + + Many analyzers do not provide all properties at once, but rather gradually add/update fields as the connection proceeds. For instance, when an HTTP connection has sent a request but has not yet received a response, the HTTP analyzer will only have the `req` part without `resp`. Each connection is checked against rules whenever at least one property changes. Rules need to be able to correctly handle cases where the needed fields are nil. (e.g., `http != nil && http.resp != nil` or using the `?` operator `http?.resp`) + ## Built-in Every connection will always have the following properties: diff --git a/docs/analyzers.zh.md b/docs/analyzers.zh.md index 6b39515..65f9a30 100644 --- a/docs/analyzers.zh.md +++ b/docs/analyzers.zh.md @@ -4,9 +4,13 @@ hide: - navigation --- -OpenGFW 的最主要组件之一是分析器。分析器的作用是分析连接,检查它是否是它们支持的协议,如果是,就从该连接中提取信息,为规则引擎提供属性,以便与用户提供的规则进行匹配。OpenGFW 会自动分析提供的规则中引用了哪些分析器,仅启用需要的分析器。 +分析器是 OpenGFW 的重要组件之一,作用是分析连接,检查是否是支持的协议,并从该连接中提取信息,作为提供给规则引擎的属性,以便与用户提供的规则进行匹配。OpenGFW 会自动分析提供的规则中引用了哪些分析器,仅启用需要的分析器。 -本文档列出了每个分析器提供的属性,这些属性可以被规则使用。 +本文档列出了每个分析器提供的属性。所有列出的属性都可以在规则中使用。 + +!!! tip + + 许多分析器并非一次性提供全部属性,而是会随着传输进行逐步增加/更新字段。例如,当一个 HTTP 连接发送了请求但还没有收到响应时,HTTP 分析器只会有 `req` 部分而没有 `resp`。每个连接会在任何属性发生变化时匹配一次规则。规则需要能正确处理需要的字段为 `nil` 的情况。(如 `http != nil && http.resp != nil` 或利用 `?` 操作符 `http?.resp`) ## 内置 diff --git a/docs/build-run.md b/docs/build-run.md index 8b7d8a1..7abf610 100644 --- a/docs/build-run.md +++ b/docs/build-run.md @@ -7,6 +7,7 @@ hide: ### Build ```shell +export CGO_ENABLED=0 go build ``` diff --git a/docs/build-run.zh.md b/docs/build-run.zh.md index ac07e46..874a522 100644 --- a/docs/build-run.zh.md +++ b/docs/build-run.zh.md @@ -7,6 +7,7 @@ hide: ### 构建 ```shell +export CGO_ENABLED=0 go build ```