Skip to content

Conversation

@oldthreefeng
Copy link
Contributor

@oldthreefeng oldthreefeng commented Sep 7, 2020

Benchmark, 使用正则的速度是比较慢的. #14

$ go test -v -bench=. -benchtime=3s -benchmem                                
=== RUN   TestIP4Re
[1.1.11.23 36.36.32.200]
false
--- PASS: TestIP4Re (0.00s)
=== RUN   TestValidIP6
--- PASS: TestValidIP6 (0.00s)
goos: linux
goarch: amd64
pkg: github.com/zu1k/nali/internal/tools
BenchmarkValidIP6Re
BenchmarkValidIP6Re-8             807940              4429 ns/op              32 B/op          1 allocs/op
BenchmarkValidIP6
BenchmarkValidIP6-8              9549422               362 ns/op             160 B/op          3 allocs/op
PASS
ok      github.com/zu1k/nali/internal/tools     7.476s

@oldthreefeng
Copy link
Contributor Author

golang/go#6628 这个没有判断, 加上了

IPv6 parser should fail with 8 groups plus one blank
@zu1k
Copy link
Owner

zu1k commented Sep 7, 2020

非常感谢:+1:

@zu1k zu1k merged commit 2d35669 into zu1k:master Sep 7, 2020
zu1k added a commit that referenced this pull request Jul 21, 2022
Optimized ip checking algorithm for ipv6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants