-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
title: "端口范围映射" | ||
weight: 80 | ||
--- | ||
|
||
*Added in v0.56.0* | ||
|
||
我们可以利用 Go template 的 range 语法结合内置的 `parseNumberRangePair` 函数来实现端口范围映射。 | ||
|
||
下面的示例,应用运行后会创建 8 个代理,名称为 `test-6000, test-6001 ... test-6007`,分别将远端的端口映射到本地。 | ||
|
||
``` | ||
{{- range $_, $v := parseNumberRangePair "6000-6006,6007" "6000-6006,6007" }} | ||
[[proxies]] | ||
name = "tcp-{{ $v.First }}" | ||
type = "tcp" | ||
localPort = {{ $v.First }} | ||
remotePort = {{ $v.Second }} | ||
{{- end }} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters