阶段性提交

This commit is contained in:
GoEdgeLab
2020-09-15 14:44:38 +08:00
parent f3289fff09
commit aa86446f4f
32 changed files with 5228 additions and 410 deletions

View File

@@ -11,9 +11,9 @@ var regexpSinglePort = regexp.MustCompile(`^\d+$`)
// 网络地址配置
type NetworkAddressConfig struct {
Protocol string `yaml:"protocol" json:"protocol"` // 协议http、tcp、tcp4、tcp6、unix、udp等
Host string `yaml:"host" json:"host"` // 主机地址或主机名
PortRange string `yaml:"portRange" json:"portRange"` // 端口范围,支持 8080、8080-8090、8080:8090
Protocol Protocol `yaml:"protocol" json:"protocol"` // 协议http、tcp、tcp4、tcp6、unix、udp等
Host string `yaml:"host" json:"host"` // 主机地址或主机名
PortRange string `yaml:"portRange" json:"portRange"` // 端口范围,支持 8080、8080-8090、8080:8090
minPort int
maxPort int
@@ -58,13 +58,13 @@ func (this *NetworkAddressConfig) Init() error {
func (this *NetworkAddressConfig) FullAddresses() []string {
if this.Protocol == ProtocolUnix {
return []string{this.Protocol + ":" + this.Host}
return []string{this.Protocol.String() + ":" + this.Host}
}
result := []string{}
for i := this.minPort; i <= this.maxPort; i++ {
host := this.Host
result = append(result, this.Protocol+"://"+host+":"+strconv.Itoa(i))
result = append(result, this.Protocol.String()+"://"+host+":"+strconv.Itoa(i))
}
return result
}