在各个地方支持IPv6

This commit is contained in:
刘祥超
2021-07-20 10:55:52 +08:00
parent b9e01b7738
commit a241b9a9df
7 changed files with 97 additions and 49 deletions

View File

@@ -1,12 +1,12 @@
package serverconfigs
// 协议基础数据结构
// BaseProtocol 协议基础数据结构
type BaseProtocol struct {
IsOn bool `yaml:"isOn" json:"isOn"` // 是否开启
Listen []*NetworkAddressConfig `yaml:"listen" json:"listen"` // 绑定的网络地址
}
// 初始化
// InitBase 初始化
func (this *BaseProtocol) InitBase() error {
for _, addr := range this.Listen {
err := addr.Init()
@@ -17,7 +17,7 @@ func (this *BaseProtocol) InitBase() error {
return nil
}
// 获取完整的地址列表
// FullAddresses 获取完整的地址列表
func (this *BaseProtocol) FullAddresses() []string {
result := []string{}
for _, addr := range this.Listen {
@@ -26,7 +26,7 @@ func (this *BaseProtocol) FullAddresses() []string {
return result
}
// 添加地址
// AddListen 添加地址
func (this *BaseProtocol) AddListen(addr ...*NetworkAddressConfig) {
this.Listen = append(this.Listen, addr...)
}