Skip to content

Commit baae12c

Browse files
committed
feat(poJun-proxy): 更新插件版本至 1.3.0,添加 post-destroy 钩子以撤销代理节点
1 parent 6e10ac0 commit baae12c

4 files changed

Lines changed: 23 additions & 7 deletions

File tree

plugins/redc-plugin-pojun-proxy/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# redc-plugin-pojun-proxy
22

33
在代理场景部署成功后,为 PoJun Worker 生成私有、可校验的 Shadowsocks 代理节点 bundle。
4+
场景成功销毁后,插件会删除该 bundle 并撤销节点数和 revision 输出,避免消费者继续使用
5+
已经不存在的代理节点。
46

57
## 生成内容
68

@@ -17,7 +19,7 @@ pojun-proxy/
1719

1820
## 依赖
1921

20-
- redc `3.3.7` 或更高版本
22+
- redc `3.3.8` 或更高版本
2123
- 无额外命令行依赖;插件使用 redc 的 Go Template 引擎,可在 Windows、macOS 和 Linux 运行
2224

2325
## 安装
@@ -28,7 +30,8 @@ pojun-proxy/
2830
redc plugin install ./plugins/redc-plugin-pojun-proxy
2931
```
3032

31-
`aliyun/proxy` 模板已在 `case.json` 中声明该插件。场景在 Terraform apply 成功后会通过跨平台 `.tmpl` hook 自动生成 bundle。
33+
`aliyun/proxy` 模板已在 `case.json` 中声明该插件。场景在 Terraform apply 成功后会通过
34+
跨平台 `.tmpl` hook 自动生成 bundle,并在 Terraform destroy 成功后通过同类 hook 撤销。
3235

3336
## 配置
3437

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{- removePojunProxyBundle -}}
2+
{{- setOutput "pojun_proxy_bundle_file" "" -}}
3+
{{- setOutput "pojun_proxy_node_count" "0" -}}
4+
{{- setOutput "pojun_proxy_revision" "" -}}

plugins/redc-plugin-pojun-proxy/plugin.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
{
22
"name": "redc-plugin-pojun-proxy",
3-
"version": "1.2.1",
3+
"version": "1.3.0",
44
"description": "为 PoJun Worker 生成安全、可校验的 Shadowsocks 代理节点 Bundle",
55
"description_en": "Generate a private, verifiable Shadowsocks proxy bundle for PoJun Workers",
66
"author": "wgpsec",
77
"homepage": "https://github.com/wgpsec/redc-template",
88
"category": "proxy",
99
"tags": ["pojun", "proxy", "shadowsocks", "mihomo"],
10-
"min_redc_version": "3.3.7",
10+
"min_redc_version": "3.3.8",
1111
"capabilities": {
1212
"hooks": {
1313
"post-apply": {
1414
"type": "template",
1515
"template": "hooks/post-apply.tmpl",
1616
"output": ""
17+
},
18+
"post-destroy": {
19+
"type": "template",
20+
"template": "hooks/post-destroy.tmpl",
21+
"output": ""
1722
}
1823
}
1924
},

plugins/redc-plugin-pojun-proxy/tests/post-apply_test.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,17 @@ test_plugin_metadata_and_aliyun_binding() {
366366
[[ -f "$manifest" ]] || fail "plugin.json is missing"
367367
jq -e '
368368
.name == "redc-plugin-pojun-proxy" and
369-
.version == "1.2.1" and
370-
.min_redc_version == "3.3.7" and
369+
.version == "1.3.0" and
370+
.min_redc_version == "3.3.8" and
371371
.capabilities.hooks["post-apply"].type == "template" and
372372
.capabilities.hooks["post-apply"].template == "hooks/post-apply.tmpl" and
373-
.capabilities.hooks["post-apply"].output == ""
373+
.capabilities.hooks["post-apply"].output == "" and
374+
.capabilities.hooks["post-destroy"].type == "template" and
375+
.capabilities.hooks["post-destroy"].template == "hooks/post-destroy.tmpl" and
376+
.capabilities.hooks["post-destroy"].output == ""
374377
' "$manifest" >/dev/null || fail "plugin.json contract is invalid"
375378
[[ -f "$PLUGIN_DIR/hooks/post-apply.tmpl" ]] || fail "template hook is missing"
379+
[[ -f "$PLUGIN_DIR/hooks/post-destroy.tmpl" ]] || fail "post-destroy template hook is missing"
376380
jq -e '
377381
(.redc_plugins | split(",") | index("redc-plugin-pojun-proxy")) != null and
378382
.version == "1.4.0"

0 commit comments

Comments
 (0)