Added missing TCPAddr and UDPAddr implementations to the net package

This commit is contained in:
Justin A. Wilson
2023-02-05 17:26:51 -06:00
committed by Damian Gryski
parent 0bc19735f3
commit 7706c41bf6
4 changed files with 138 additions and 1 deletions
+28
View File
@@ -11,3 +11,31 @@ type IPAddr struct {
IP IP
Zone string // IPv6 scoped addressing zone
}
// Network returns the address's network name, "ip".
func (a *IPAddr) Network() string { return "ip" }
func (a *IPAddr) String() string {
if a == nil {
return "<nil>"
}
ip := ipEmptyString(a.IP)
if a.Zone != "" {
return ip + "%" + a.Zone
}
return ip
}
func (a *IPAddr) isWildcard() bool {
if a == nil || a.IP == nil {
return true
}
return a.IP.IsUnspecified()
}
func (a *IPAddr) opAddr() Addr {
if a == nil {
return nil
}
return a
}