Skip to content

Commit

Permalink
phrasing & linter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sadfun committed Oct 17, 2022
1 parent 5482b75 commit 74a0299
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions ips.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package utils

import "net"

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

if len(s) != 0 {
return false
}

return true
return len(s) == 0
}

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

0 comments on commit 74a0299

Please sign in to comment.