This commit is contained in:
18
internal/blocker/validators.go
Normal file
18
internal/blocker/validators.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package blocker
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
)
|
||||
|
||||
func validateIP(ip string) error {
|
||||
if ip == "" {
|
||||
return fmt.Errorf("empty IP")
|
||||
}
|
||||
|
||||
if net.ParseIP(ip) == nil {
|
||||
return fmt.Errorf("invalid IP: %s", ip)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user