Skip to content

Commit

Permalink
Support proxy annotations (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
koho authored Mar 24, 2024
1 parent bc4d6e6 commit 4534dd1
Show file tree
Hide file tree
Showing 14 changed files with 812 additions and 580 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.22

require (
github.com/fatedier/frp v0.55.1
github.com/fatedier/golib v0.4.0
github.com/go-ole/go-ole v1.3.0
github.com/lxn/walk v0.0.0-20210112085537-c389da54e794
github.com/lxn/win v0.0.0-20210218163916-a377121e959e
Expand All @@ -19,7 +20,6 @@ require (
github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c // indirect
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 // indirect
github.com/coreos/go-oidc/v3 v3.6.0 // indirect
github.com/fatedier/golib v0.4.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.1 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/golang/protobuf v1.5.3 // indirect
Expand Down Expand Up @@ -64,4 +64,4 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
)

replace github.com/lxn/walk => github.com/koho/frpmgr v0.0.0-20240309173424-3817a91bcc39
replace github.com/lxn/walk => github.com/koho/frpmgr v0.0.0-20240321011400-ecefcd94f271
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/4
github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/klauspost/reedsolomon v1.12.0 h1:I5FEp3xSwVCcEh3F5A7dofEfhXdF/bWhQWPH+XwBFno=
github.com/klauspost/reedsolomon v1.12.0/go.mod h1:EPLZJeh4l27pUGC3aXOjheaoh1I9yut7xTURiW3LQ9Y=
github.com/koho/frpmgr v0.0.0-20240309173424-3817a91bcc39 h1:xn1qQrWzrxVNwnxVmHmKPyoPbYKWK7WmefftOad86Z0=
github.com/koho/frpmgr v0.0.0-20240309173424-3817a91bcc39/go.mod h1:CdksCbC3x4Swi/ePNXCeg08K1i3XdIVdy3o7elo92k8=
github.com/koho/frpmgr v0.0.0-20240321011400-ecefcd94f271 h1:aKCwtWvkDfPUgegH93hWNBiqAT2WlGXISzSSJ++7ypI=
github.com/koho/frpmgr v0.0.0-20240321011400-ecefcd94f271/go.mod h1:CdksCbC3x4Swi/ePNXCeg08K1i3XdIVdy3o7elo92k8=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand Down
1,141 changes: 580 additions & 561 deletions i18n/catalog.go

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions i18n/locales/en-US/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,13 @@
],
"fuzzy": true
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "Annotations",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1454,6 +1461,13 @@
],
"fuzzy": true
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "Server name is required.",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1468,6 +1482,27 @@
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "Local address is required.",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "Local path is required.",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "Unix path is required.",
"translatorComment": "Copied from source.",
"fuzzy": true
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
25 changes: 25 additions & 0 deletions i18n/locales/es-ES/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,11 @@
}
]
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "Anotaciones"
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1084,6 +1089,11 @@
}
]
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "El nombre del servidor es obligatorio."
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1094,6 +1104,21 @@
"message": "Requires local port or plugin.",
"translation": "Requiere puerto local o complemento."
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "Se requiere dirección local."
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "Se requiere ruta local."
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "Se requiere la ruta Unix."
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
25 changes: 25 additions & 0 deletions i18n/locales/ja-JP/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,11 @@
}
]
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "注釈"
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1094,6 +1099,11 @@
}
]
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "サービス名は必須です。"
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1104,6 +1114,21 @@
"message": "Requires local port or plugin.",
"translation": "ローカルポートまたはプラグインが必要です。"
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "ローカルアドレスは必須です。"
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "ローカルパスは必須です。"
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "Unix パスは必須です。"
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
25 changes: 25 additions & 0 deletions i18n/locales/ko-KR/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,11 @@
}
]
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "주석"
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1084,6 +1089,11 @@
}
]
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "서비스 이름은 필수 항목입니다."
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1094,6 +1104,21 @@
"message": "Requires local port or plugin.",
"translation": "로컬 포트 또는 플러그인이 필요합니다."
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "현지 주소가 필요합니다."
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "로컬 경로가 필요합니다."
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "Unix 경로가 필요합니다."
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
25 changes: 25 additions & 0 deletions i18n/locales/zh-CN/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,11 @@
}
]
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "注释"
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1084,6 +1089,11 @@
}
]
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "必须填写服务名称。"
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1094,6 +1104,21 @@
"message": "Requires local port or plugin.",
"translation": "必须填写本地端口或插件。"
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "必须填写本地地址。"
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "必须填写本地路径。"
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "必须填写 Unix 路径。"
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
25 changes: 25 additions & 0 deletions i18n/locales/zh-TW/messages.gotext.json
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,11 @@
}
]
},
{
"id": "Annotations",
"message": "Annotations",
"translation": "註解"
},
{
"id": "Random",
"message": "Random",
Expand Down Expand Up @@ -1084,6 +1089,11 @@
}
]
},
{
"id": "Server name is required.",
"message": "Server name is required.",
"translation": "必須填寫服務名稱。"
},
{
"id": "Bind port is required.",
"message": "Bind port is required.",
Expand All @@ -1094,6 +1104,21 @@
"message": "Requires local port or plugin.",
"translation": "必須填寫本地端口或插件。"
},
{
"id": "Local address is required.",
"message": "Local address is required.",
"translation": "必須填寫本地地址。"
},
{
"id": "Local path is required.",
"message": "Local path is required.",
"translation": "必須填寫本地路徑。"
},
{
"id": "Unix path is required.",
"message": "Unix path is required.",
"translation": "必須填寫 Unix 路徑。"
},
{
"id": "Invalid local port.",
"message": "Invalid local port.",
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ type BaseProxyConf struct {
HealthCheckConf `ini:",extends"`
// Meta info for each proxy
Metas map[string]string `ini:"-"`
// Annotations for each proxy
Annotations map[string]string `ini:"-"`
// Disabled defines whether to start the proxy.
Disabled bool `ini:"-"`
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ func clientProxyBaseFromV1(c *v1.ProxyBaseConfig, out *Proxy) {
}

out.Metas = c.Metadatas
out.Annotations = c.Annotations
out.Plugin = c.Plugin.Type
switch v := c.Plugin.ClientPluginOptions.(type) {
case *v1.HTTP2HTTPSPluginOptions:
Expand Down Expand Up @@ -455,7 +456,8 @@ func clientProxyBaseToV1(c *BaseProxyConf) (v1.ProxyBaseConfig, error) {
BandwidthLimitMode: c.BandwidthLimitMode,
ProxyProtocolVersion: c.ProxyProtocolVersion,
},
Metadatas: c.Metas,
Metadatas: c.Metas,
Annotations: c.Annotations,
LoadBalancer: v1.LoadBalancerConfig{
Group: c.Group,
GroupKey: c.GroupKey,
Expand Down
1 change: 1 addition & 0 deletions pkg/res/res.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var (
IconNat = Icon{"firewallcontrolpanel", 0}
IconExperiment = Icon{"imageres", -111}
IconFile = Icon{"shell32", -152}
IconInfo = Icon{"imageres", -81}
)

// Colors
Expand Down
Loading

0 comments on commit 4534dd1

Please sign in to comment.