mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-18 19:44:00 +00:00
Added missing TCPAddr and UDPAddr implementations to the net package
This commit is contained in:
committed by
Damian Gryski
parent
0bc19735f3
commit
7706c41bf6
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user