用户端实现UDP设置/优化检查端口是否已被使用API

This commit is contained in:
GoEdgeLab
2021-11-24 19:46:59 +08:00
parent 65e363f0fd
commit 36488ff1b5
9 changed files with 252 additions and 27 deletions

View File

@@ -21,15 +21,25 @@ var (
Description: "用户可以配置访问日志转发到自定义的API",
},
{
Name: "负载均衡",
Name: "TCP负载均衡",
Code: "server.tcp",
Description: "用户可以添加TCP/TLS负载均衡服务",
},
{
Name: "自定义负载均衡端口",
Name: "自定义TCP负载均衡端口",
Code: "server.tcp.port",
Description: "用户可以自定义TCP端口",
},
{
Name: "UDP负载均衡",
Code: "server.udp",
Description: "用户可以添加UDP负载均衡服务",
},
{
Name: "自定义UDP负载均衡端口",
Code: "server.udp.port",
Description: "用户可以自定义UDP端口",
},
{
Name: "开启WAF",
Code: "server.waf",
@@ -43,7 +53,7 @@ var (
}
)
// 用户功能
// UserFeature 用户功能
type UserFeature struct {
Name string `json:"name"`
Code string `json:"code"`
@@ -54,12 +64,12 @@ func (this *UserFeature) ToPB() *pb.UserFeature {
return &pb.UserFeature{Name: this.Name, Code: this.Code, Description: this.Description}
}
// 所有功能列表
// FindAllUserFeatures 所有功能列表
func FindAllUserFeatures() []*UserFeature {
return allUserFeatures
}
// 查询单个功能
// FindUserFeature 查询单个功能
func FindUserFeature(code string) *UserFeature {
for _, feature := range allUserFeatures {
if feature.Code == code {