fix: qcloud reserved first, second and last ip for internal connection

This commit is contained in:
ioito
2019-07-29 20:01:12 +08:00
parent ed2804da68
commit cd0a16a6da

View File

@@ -118,10 +118,12 @@ func (self *SNetwork) GetGateway() string {
return endIp.String()
}
//https://cloud.tencent.com/document/product/215/20046
func (self *SNetwork) GetIpStart() string {
pref, _ := netutils.NewIPV4Prefix(self.CidrBlock)
startIp := pref.Address.NetAddr(pref.MaskLen) // 0
startIp = startIp.StepUp() // 1
startIp = startIp.StepUp() // 2
return startIp.String()
}
@@ -129,8 +131,6 @@ func (self *SNetwork) GetIpEnd() string {
pref, _ := netutils.NewIPV4Prefix(self.CidrBlock)
endIp := pref.Address.BroadcastAddr(pref.MaskLen) // 255
endIp = endIp.StepDown() // 254
endIp = endIp.StepDown() // 253
endIp = endIp.StepDown() // 252
return endIp.String()
}