mirror of
https://github.com/tinygo-org/drivers.git
synced 2026-08-16 12:53:23 +00:00
Add examples/rtl8720dn/udpstation
This commit is contained in:
+12
@@ -342,6 +342,18 @@ func (a *TCPAddr) opAddr() Addr {
|
||||
|
||||
// ParseIP parses s as an IP address, returning the result.
|
||||
func ParseIP(s string) IP {
|
||||
b := strings.Split(s, ".")
|
||||
if len(b) == 4 {
|
||||
ip := make([]byte, 4)
|
||||
|
||||
for i := range ip {
|
||||
x, _ := strconv.ParseUint(b[i], 10, 8)
|
||||
ip[i] = byte(x)
|
||||
}
|
||||
|
||||
return IP(ip)
|
||||
}
|
||||
|
||||
return IP([]byte(s))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user