go test -run Test_Ctx_IsFromUnixSocket_RemoteAddr
(t *testing.T)
| 9005 | |
| 9006 | // go test -run Test_Ctx_IsFromUnixSocket_RemoteAddr |
| 9007 | func Test_Ctx_IsFromUnixSocket_RemoteAddr(t *testing.T) { |
| 9008 | t.Parallel() |
| 9009 | |
| 9010 | { |
| 9011 | app := New() |
| 9012 | fastCtx := &fasthttp.RequestCtx{} |
| 9013 | fastCtx.SetRemoteAddr(&net.TCPAddr{IP: net.ParseIP("127.0.0.1")}) |
| 9014 | c := app.AcquireCtx(fastCtx) |
| 9015 | defer app.ReleaseCtx(c) |
| 9016 | require.False(t, c.IsFromUnixSocket()) |
| 9017 | require.False(t, c.Req().IsFromUnixSocket()) |
| 9018 | } |
| 9019 | |
| 9020 | { |
| 9021 | app := New() |
| 9022 | fastCtx := &fasthttp.RequestCtx{} |
| 9023 | fastCtx.SetRemoteAddr(&net.UnixAddr{Name: "/tmp/fiber.sock", Net: "unix"}) |
| 9024 | c := app.AcquireCtx(fastCtx) |
| 9025 | defer app.ReleaseCtx(c) |
| 9026 | require.True(t, c.IsFromUnixSocket()) |
| 9027 | require.True(t, c.Req().IsFromUnixSocket()) |
| 9028 | } |
| 9029 | } |
| 9030 | |
| 9031 | // go test -run Test_Ctx_extractIPsFromHeader -v |
| 9032 | func Test_Ctx_extractIPsFromHeader(t *testing.T) { |
nothing calls this directly
no test coverage detected