Skip to content

Commit

Permalink
v20240214
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed Jan 4, 2024
1 parent 8fa4c6e commit eccb0ac
Show file tree
Hide file tree
Showing 12 changed files with 2,584 additions and 1,211 deletions.
704 changes: 681 additions & 23 deletions README.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cli/brook/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func main() {
df := func() {}
app := cli.NewApp()
app.Name = "Brook"
app.Version = "20240101"
app.Version = "20240214"
app.Usage = "A cross-platform programmable network tool"
app.Authors = []*cli.Author{
{
Expand Down
6 changes: 4 additions & 2 deletions docs/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ cd ../../docs
jb '$1`brook mdpage`.split("\n").filter(v=>!v.startsWith("[")).join("\n").replace("```\n```", "```\nbrook [全局参数] 子命令 [子命令参数]\n```").split("\n").forEach(v=> echo(v.startsWith("**") && !v.startsWith("**Usage") ? "- "+v : v))' >> ../readme.md

cat diagram.md >> ../readme.md
cat example.md >> ../readme.md
cat example-zh.md >> ../readme.md

markdown ../readme.md ./index.html

echo '# Brook' > _.md
echo 'A cross-platform programmable network tool. 一个跨平台可编程网络工具' >> _.md
echo 'A cross-platform programmable network tool' >> _.md
echo '' >> _.md
echo '# Sponsor' >> _.md
echo '**❤️ [Shiliew - China Optimized VPN](https://www.txthinking.com/shiliew.html)**' >> _.md
echo '**❤️ [Shiliew - China Optimized Network App](https://www.txthinking.com/shiliew.html)**' >> _.md
mdtoc ../readme.md >> _.md
cat ../readme.md >> _.md
mv _.md ../readme.md
Expand Down
9 changes: 4 additions & 5 deletions docs/example-zh.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# 例子

<!--SIDEBAR-->
<!--G-R3M673HK5V-->

下面列举一些常用场景命令的例子, 注意自己替换示例中的 IP,端口,密码,域名,证书路径等参数

### 运行 brook server
Expand Down Expand Up @@ -265,10 +262,10 @@ echo nameserver 8.8.8.8 > /etc/resolv.conf
```

```
brook tproxy --link 'brook://...' --dnsListen :53
brook tproxy --link 'brook://...' --dnsListen 192.168.1.2:53 --disableAAAA
```

> 配置其他机器的网关和 DNS 为这台机器的 IP 即可
替换 192.168.1.2 为你的 Linux 的IP. 配置其他机器的网关和 DNS 为这台机器的 IP 即可

### 官网原版 OpenWrt 图形客户端

Expand Down Expand Up @@ -307,3 +304,5 @@ brook pac --listen 127.0.0.1:8080 --proxy 'SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.
```
brook pac --file proxy.pac --proxy 'SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT' --bypassDomainList ...
```

### 例子不胜枚举,更多功能建议挨个看 CLI 文档的命令和参数吧,还有博客,YouTube 等...
9 changes: 4 additions & 5 deletions docs/example.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# Examples

<!--SIDEBAR-->
<!--G-R3M673HK5V-->

List some examples of common scene commands, pay attention to replace the parameters such as IP, port, password, domain name, certificate path, etc. in the example by yourself

### Run brook server
Expand Down Expand Up @@ -265,10 +262,10 @@ echo nameserver 8.8.8.8 > /etc/resolv.conf
```

```
brook tproxy --link 'brook://...' --dnsListen :53
brook tproxy --link 'brook://...' --dnsListen 192.168.1.2:53 --disableAAAA
```

You may need to manually configure the computer or mobile gateway and DNS.
Replace 192.168.1.2 with your Linux IP. You may need to manually configure the computer or mobile gateway and DNS.

### GUI for official OpenWrt

Expand Down Expand Up @@ -307,3 +304,5 @@ brook pac --listen 127.0.0.1:8080 --proxy 'SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.
```
brook pac --file proxy.pac --proxy 'SOCKS5 127.0.0.1:1080; SOCKS 127.0.0.1:1080; DIRECT' --bypassDomainList ...
```

### There are countless examples; for more feature suggestions, it's best to look at the commands and parameters in the CLI documentation one by one, and blog, YouTube...
17 changes: 8 additions & 9 deletions docs/gui-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
- [Shiliew](https://www.txthinking.com/shiliew.html)
- [tun2brook](https://github.com/txthinking/tun2brook)

## Programmable
## 编程

```
Brook GUI 会在不同时机向脚本传入不同的全局变量,脚本只需要将处理结果赋值到全局变量 out 即可
Expand Down Expand Up @@ -42,19 +42,18 @@ Brook GUI 会在不同时机向脚本传入不同的全局变量,脚本只需
| ------ | ------ | -------- | ---------- |
| domain | string | 域名 | google.com |
| type | string | 查询类型 | A |
| appid | string | App ID. 仅 Mac | com.google.Chrome.helper |
| appid | string | App ID 或路径 | com.google.Chrome.helper |
| interface | string | 网络接口. 仅 Mac | en0 |

`out`, 如果是 `error` 类型会被记录在日志。如果不是 `map` 类型则会被忽略

| Key | 类型 | 描述 | 示例 |
| ------------ | ------ | -------------------------------------------------------------------------------------------------- | ------- |
| block | bool | 是否 Block, 默认 `false`. 与 GUI Block Domain 是或的关系 | false |
| block | bool | 是否 Block, 默认 `false` | false |
| ip | string | 直接指定 IP,仅当 `type``A`/`AAAA`有效 | 1.2.3.4 |
| forcefakedns | bool | 忽略 GUI Bypass Domain,使用 Fake DNS 来处理,仅当 `type``A`/`AAAA`有效,默认 `false` | false |
| system | bool | 使用 System DNS 来解析,默认 `false` | false |
| bypass | bool | 是否 Bypass, 默认 `false`, 如果为 `true` 则使用 Bypass DNS 来解析. 与 GUI Bypass Domain 是或的关系 | false |
| brooklinkkey | string | 当需要连接代理服务器时,转而连接 通过 in_brooklinks 的 key 指定的 brook link | 自定义名字 |
| bypass | bool | 使用 Bypass DNS 来解析,默认 `false` | false |
| brooklinkkey | string | 当需要连接代理服务器时,转而连接 通过 in_brooklinks 的 key 指定的代理服务器 | 自定义名字 |

### in_address

Expand All @@ -63,7 +62,7 @@ Brook GUI 会在不同时机向脚本传入不同的全局变量,脚本只需
| network | string | 即将发起连接网络,取值 `tcp`/`udp` | tcp |
| ipaddress | string | IP 类型的地址,与 domainaddress 只会存在一个。注意这两个之间没有任何关系 | 1.2.3.4:443 |
| domainaddress | string | 域名类型的地址,因为 FakeDNS 我们这里才能拿到域名地址 | google.com:443 |
| appid | string | App ID. 仅 Mac | com.google.Chrome.helper |
| appid | string | App ID 或路径 | com.google.Chrome.helper |
| interface | string | 网络接口. 仅 Mac | en0 |

`out`, 如果是 `error` 类型会被记录在日志。如果不是 `map` 类型则会被忽略
Expand All @@ -73,7 +72,7 @@ Brook GUI 会在不同时机向脚本传入不同的全局变量,脚本只需
| block | bool | 是否 Block, 默认 `false` | false |
| ipaddress | string | IP 类型地址,重写目的地 | 1.2.3.4:443 |
| ipaddressfrombypassdns | string | 使用 Bypass DNS 获取`A``AAAA` IP 并重写目的地, 仅当 `domainaddress` 存在时有效,取值 `A`/`AAAA` | A |
| bypass | bool | 是否 Bypass, 默认 `false`. 如果为 `true` 并且是 `domainaddress`, 那么必须指定 `ipaddress``ipaddressfrombypassdns`. 与 GUI Bypass IP 是或的关系 | false |
| bypass | bool | 是否 Bypass, 默认 `false`. 如果为 `true` 并且是 `domainaddress`, 那么必须指定 `ipaddress``ipaddressfrombypassdns` | false |
| mitm | bool | 是否进行 MITM, 默认 `false`. 仅当 `network``tcp` 时有效. 需要安装 CA,看下文介绍 | false |
| mitmprotocol | string | 需要明确指定 MITM 协议, 取值 `http`/`https` | https |
| mitmcertdomain | string | MITM 证书域名,默认从`domainaddress`里取。如果是 `ipaddress``mitm``true``mitmprotocol``https` 那么必须明确指定 | example.com |
Expand All @@ -82,7 +81,7 @@ Brook GUI 会在不同时机向脚本传入不同的全局变量,脚本只需
| mitmclienttimeout | int | Timeout for MITM talk to server, second, default 0 | 0 |
| mitmserverreadtimeout | int | Timeout for MITM read from client, second, default 0 | 0 |
| mitmserverwritetimeout | int | Timeout for MITM write to client, second, default 0 | 0 |
| brooklinkkey | string | 当需要连接代理服务器时,转而连接 通过 in_brooklinks 的 key 指定的 brook link | 自定义名字 |
| brooklinkkey | string | 当需要连接代理服务器时,转而连接 通过 in_brooklinks 的 key 指定的代理服务器 | 自定义名字 |

### in_httprequest

Expand Down
17 changes: 8 additions & 9 deletions docs/gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,18 @@ Brook GUI will pass different global variables to the script at different times,
| ------ | ------ | ----------- | ---------- |
| domain | string | domain name | google.com |
| type | string | query type | A |
| appid | string | App ID. Mac only | com.google.Chrome.helper |
| appid | string | App ID or path | com.google.Chrome.helper |
| interface | string | network interface. Mac only | en0 |

`out`, if it is `error` type will be recorded in the log. Ignored if not of type `map`

| Key | Type | Description | Example |
| ------------ | ------ | ----------------------------------------------------------------------------------------------------------------------------- | ------- |
| block | bool | Whether Block, default `false`. It is an OR relationship with GUI Block Domain | false |
| block | bool | Whether Block, default `false` | false |
| ip | string | Specify IP directly, only valid when `type` is `A`/`AAAA` | 1.2.3.4 |
| forcefakedns | bool | Ignore GUI Bypass Domain, handle with Fake DNS, only valid when `type` is `A`/`AAAA`, default `false` | false |
| system | bool | Get IP from system DNS, default `false` | false |
| bypass | bool | whether to Bypass, default `false`, if `true` then use bypass DNS to resolve. It is an OR relationship with GUI Bypass Domain | false |
| brooklinkkey | string | When need to connect the Server,instead, connect to the brook link specified by the key in_brooklinks | custom name |
| system | bool | Resolve by System DNS, default `false` | false |
| bypass | bool | Resolve by Bypass DNS, default `false` | false |
| brooklinkkey | string | When need to connect the Server,instead, connect to the Server specified by the key in_brooklinks | custom name |

### in_address

Expand All @@ -63,7 +62,7 @@ Brook GUI will pass different global variables to the script at different times,
| network | string | Network type, the value `tcp`/`udp` | tcp |
| ipaddress | string | IP type address. There is only of ipaddress and domainaddress. Note that there is no relationship between these two | 1.2.3.4:443 |
| domainaddress | string | Domain type address, because of FakeDNS we can get the domain name address here | google.com:443 |
| appid | string | App ID. Mac only | com.google.Chrome.helper |
| appid | string | App ID or path | com.google.Chrome.helper |
| interface | string | network interface. Mac only | en0 |

`out`, if it is `error` type will be recorded in the log. Ignored if not of type `map`
Expand All @@ -73,7 +72,7 @@ Brook GUI will pass different global variables to the script at different times,
| block | bool | Whether Block, default `false` | false |
| ipaddress | string | IP type address, rewrite destination | 1.2.3.4:443 |
| ipaddressfrombypassdns | string | Use Bypass DNS to obtain `A` or `AAAA` IP and rewrite the destination, only valid when `domainaddress` exists, the value `A`/`AAAA` | A |
| bypass | bool | Bypass, default `false`. If `true` and `domainaddress`, then `ipaddress` or `ipaddressfrombypassdns` must be specified. It is an OR relationship with GUI Bypass IP | false |
| bypass | bool | Bypass, default `false`. If `true` and `domainaddress`, then `ipaddress` or `ipaddressfrombypassdns` must be specified | false |
| mitm | bool | Whether to perform MITM, default `false`. Only valid when `network` is `tcp`. Need to install CA, see below | false |
| mitmprotocol | string | MITM protocol needs to be specified explicitly, the value is `http`/`https` | https |
| mitmcertdomain | string | The MITM certificate domain name, which is taken from `domainaddress` by default. If `ipaddress` and `mitm` is `true` and `mitmprotocol` is `https` then must be must be specified explicitly | example.com |
Expand All @@ -82,7 +81,7 @@ Brook GUI will pass different global variables to the script at different times,
| mitmclienttimeout | int | Timeout for MITM talk to server, second, default 0 | 0 |
| mitmserverreadtimeout | int | Timeout for MITM read from client, second, default 0 | 0 |
| mitmserverwritetimeout | int | Timeout for MITM write to client, second, default 0 | 0 |
| brooklinkkey | string | When need to connect the Server,instead, connect to the brook link specified by the key in_brooklinks | custom name |
| brooklinkkey | string | When need to connect the Server,instead, connect to the Server specified by the key in_brooklinks | custom name |

### in_httprequest

Expand Down
Loading

0 comments on commit eccb0ac

Please sign in to comment.