mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-12 19:03:42 +00:00
(#501) make IP.String() method return something sensible
This commit is contained in:
committed by
Ron Evans
parent
0b6e1d0e78
commit
b1c9612158
+4
-1
@@ -357,7 +357,10 @@ func ParseIP(s string) IP {
|
||||
|
||||
// String returns the string form of the IP address ip.
|
||||
func (ip IP) String() string {
|
||||
return string(ip)
|
||||
if len(ip) < 4 {
|
||||
return ""
|
||||
}
|
||||
return strconv.Itoa(int(ip[0])) + "." + strconv.Itoa(int(ip[1])) + "." + strconv.Itoa(int(ip[2])) + "." + strconv.Itoa(int(ip[3]))
|
||||
}
|
||||
|
||||
// Conn is a generic stream-oriented network connection.
|
||||
|
||||
Reference in New Issue
Block a user