| 1 | // ⚡️ Fiber is an Express inspired web framework written in Go with ☕️ |
| 2 | // 🤖 Github Repository: https://github.com/gofiber/fiber |
| 3 | // 📌 API Documentation: https://docs.gofiber.io |
| 4 | |
| 5 | package utilsscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ |
| 6 | |
| 7 | import ( |
| 8 | "netscip-go gomod github.com/golang/go/src go1.25.0 net/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | |
| 11 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/" |
| 12 | ) |
| 13 | |
| 14 | func Test_IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_IsIPv4().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 15 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 16 | |
| 17 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("255.255.255.255")) |
| 18 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("174.23.33.100")) |
| 19 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("127.0.0.1")) |
| 20 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("0.0.0.0")) |
| 21 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("1.1.1.1")) |
| 22 | |
| 23 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().(".0.0.0")) |
| 24 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("0.0.0.")) |
| 25 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("0.0.0")) |
| 26 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().(".0.0.0.")) |
| 27 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("0.0.0.0.0")) |
| 28 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("0")) |
| 29 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("")) |
| 30 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("2345:0425:2CA1::0567:5673:23b5")) |
| 31 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("invalid")) |
| 32 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("189.12.34.260")) |
| 33 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("189.12.260.260")) |
| 34 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("189.260.260.260")) |
| 35 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("255.255.255.256")) |
| 36 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("999.999.999.999")) |
| 37 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("9999.9999.9999.9999")) |
| 38 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("192168.1.1")) |
| 39 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("192.1681.1")) |
| 40 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("192a168.1.1")) |
| 41 | } |
| 42 | |
| 43 | func Test_IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_IsIPv6().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 44 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 45 | |
| 46 | // Valid Cases |
| 47 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("9396:9549:b4f7:8ed0:4791:1330:8c06:e62d")) |
| 48 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2345:0425:2CA1::0567:5673:23b5")) |
| 49 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2001:1:2:3:4:5:6:7")) |
| 50 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::1"), "IPv6 loopback address with leading ellipsis") |
| 51 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1::"), "Shortest possible IPv6 address with trailing ellipsis") |
| 52 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2001:db8::8a2e:370:7334"), "Valid IPv6 address with ellipsis in the middle") |
| 53 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::ffff:192.0.2.128"), "IPv4-mapped IPv6 address") |
| 54 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::192.168.1.1"), "IPv4-compatible IPv6 address") |
| 55 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("ffff::"), "Address with a single non-zero group and leading ellipsis") |
| 56 | |
| 57 | // Boundary values |
| 58 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff"), "Maximum value for all groups") |
| 59 | |
| 60 | // Invalid cases |
| 61 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1::2::3"), "IPv6 address with multiple ellipses") |
| 62 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2001::25de::cade"), "IPv6 address with multiple ellipses in the middle") |
| 63 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("g:a:b:c:d:e:f:1"), "Invalid character 'g' in address") |
| 64 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::192.168.1.256"), "Invalid IPv4 segment in IPv6 address") |
| 65 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3:4:5:6:7:8:9"), "IPv6 address too long") |
| 66 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3"), "IPv6 address too short") |
| 67 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:::3:4"), "Consecutive colons not part of a valid ellipsis") |
| 68 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::ffff:256.0.0.1"), "Embedded IPv4 address with invalid IPv4 segment") |
| 69 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1111:2222:3333:4444:5555:6666:7777:8888:9999"), "IPv6 address with too many groups") |
| 70 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2001:db8::8a2e:370g:7334"), "IPv6 address with invalid hex character 'g'") |
| 71 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1.1.1.1")) |
| 72 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("2001:1:2:3:4:5:6:")) |
| 73 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().(":1:2:3:4:5:6:")) |
| 74 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3:4:5:6:")) |
| 75 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("")) |
| 76 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("invalid")) |
| 77 | } |
| 78 | |
| 79 | func Test_IsIPv6_EdgeCasesscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_IsIPv6_EdgeCases().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 80 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 81 | |
| 82 | // hex group larger than 4 digits |
| 83 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3:4:5:6:7:12345")) |
| 84 | |
| 85 | // IPv4 part at wrong position |
| 86 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3:4:1.2.3.4")) |
| 87 | |
| 88 | // IPv4 part would exceed length |
| 89 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1:2:3:4:5:6:7:1.2.3.4")) |
| 90 | |
| 91 | // ellipsis present but no zero group |
| 92 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("1::2:3:4:5:6:7:8")) |
| 93 | } |
| 94 | |
| 95 | func Test_IPWhitespacescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Test_IPWhitespace().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 96 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 97 | |
| 98 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().(" 1.1.1.1")) |
| 99 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().("1.1.1.1 ")) |
| 100 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().(" ::1")) |
| 101 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Falsescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/False().(t, IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().("::1 ")) |
| 102 | } |
| 103 | |
| 104 | // go test -v -run=^$ -bench=Benchmark_IsIPv4 -benchmem -count=6 |
| 105 | func Benchmark_IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_IsIPv4().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 106 | ip := "174.23.33.100" |
| 107 | var res bool |
| 108 | |
| 109 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 110 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 111 | res = IsIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv4().(ip) |
| 112 | } |
| 113 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 114 | }) |
| 115 | |
| 116 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 117 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 118 | res = netscip-go gomod github.com/golang/go/src go1.25.0 net/.ParseIPscip-go gomod github.com/golang/go/src go1.25.0 net/ParseIP().(ip) != nil |
| 119 | } |
| 120 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 121 | }) |
| 122 | } |
| 123 | |
| 124 | // go test -v -run=^$ -bench=Benchmark_IsIPv6 -benchmem -count=6 |
| 125 | func Benchmark_IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/Benchmark_IsIPv6().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 126 | ip := "9396:9549:b4f7:8ed0:4791:1330:8c06:e62d" |
| 127 | var res bool |
| 128 | |
| 129 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("fiber", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 130 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 131 | res = IsIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsIPv6().(ip) |
| 132 | } |
| 133 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 134 | }) |
| 135 | |
| 136 | b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("default", func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) { |
| 137 | for i := 0; i < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; i++ { |
| 138 | res = netscip-go gomod github.com/golang/go/src go1.25.0 net/.ParseIPscip-go gomod github.com/golang/go/src go1.25.0 net/ParseIP().(ip) != nil |
| 139 | } |
| 140 | requirescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.12.1 `github.com/stretchr/testify/require`/True().(b, res) |
| 141 | }) |
| 142 | } |