Skip to content

Commit 74a0299

Browse files
committed
phrasing & linter fix
1 parent 5482b75 commit 74a0299

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

ips.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package utils
22

33
import "net"
44

5-
// IsIPv4 is plagiarism of net.ParseIP,
5+
// IsIPv4 works the same way as net.ParseIP,
66
// but without check for IPv6 case and without returning net.IP slice, whereby IsIPv4 makes no allocations.
77
func IsIPv4(s string) bool {
88
for i := 0; i < net.IPv4len; i++ {
@@ -33,14 +33,10 @@ func IsIPv4(s string) bool {
3333
s = s[ci:]
3434
}
3535

36-
if len(s) != 0 {
37-
return false
38-
}
39-
40-
return true
36+
return len(s) == 0
4137
}
4238

43-
// IsIPv6 is plagiarism of net.ParseIP,
39+
// IsIPv6 works the same way as net.ParseIP,
4440
// but without check for IPv4 case and without returning net.IP slice, whereby IsIPv6 makes no allocations.
4541
func IsIPv6(s string) bool {
4642
ellipsis := -1 // position of ellipsis in ip

0 commit comments

Comments
 (0)