-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add proxy name replacement functionality for override #1481
Conversation
15365f5
to
6306c6b
Compare
a2273e2
to
417d709
Compare
adapter/provider/parser.go
Outdated
@@ -41,6 +48,8 @@ type OverrideSchema struct { | |||
IPVersion *string `provider:"ip-version,omitempty"` | |||
AdditionalPrefix *string `provider:"additional-prefix,omitempty"` | |||
AdditionalSuffix *string `provider:"additional-suffix,omitempty"` | |||
|
|||
ProxyName []*OverrideProxyNameSchema `provider:"proxy-name,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里可以直接使用[]OverrideProxyNameSchema
adapter/provider/parser.go
Outdated
@@ -27,6 +27,13 @@ type healthCheckSchema struct { | |||
ExpectedStatus string `provider:"expected-status,omitempty"` | |||
} | |||
|
|||
type OverrideProxyNameSchema struct { | |||
// matching expression for regex replacement | |||
Pattern string `provider:"pattern,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个schema内部不该允许omitempty
adapter/provider/parser.go
Outdated
// matching expression for regex replacement | ||
Pattern string `provider:"pattern,omitempty"` | ||
// the new content after regex matching | ||
Target string `provider:"target,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
adapter/provider/provider.go
Outdated
case "proxy-name": | ||
exprList, ok := field.Interface().([]*OverrideProxyNameSchema) | ||
if !ok { | ||
return nil, errors.New("file must have a `proxy-name` field") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的报错提示不对
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感谢你的反馈,你提到的问题我会尽快处理
add proxy
name
field replacement functionality. When there are multiple proxy providers, the information in proxy-name can be replaced, making it easier to group them. Replacement content supports using regular expressions.override增加了proxy-name替换功能。当存在多个proxy-provider的时候将可以将proxy-name中的信息进行替换,方便进行代理分组,替换内容支持使用正则表达式