21 lines
410 B
Go
21 lines
410 B
Go
package hmm
|
|
|
|
import "testing"
|
|
|
|
func TestIPs(t *testing.T) {
|
|
{
|
|
s := "Failed password for root from 43.229.53.57 port 62954 ssh2"
|
|
ip := ParseIP(s)
|
|
if ip == "" {
|
|
t.Fatalf("didn't find ip, should have")
|
|
}
|
|
}
|
|
{
|
|
s := "Oct 10 12:35:46 impa sshd[13226]: Received disconnect from 116.31.116.6 port 58923:11: [preauth]"
|
|
ip := ParseIP(s)
|
|
if ip != "" {
|
|
t.Fatalf("found ip, shouldn't have")
|
|
}
|
|
}
|
|
}
|