|
5 | 5 | package fiber |
6 | 6 |
|
7 | 7 | import ( |
8 | | - "crypto/tls" |
9 | 8 | "fmt" |
10 | | - "net" |
11 | 9 | "strings" |
12 | 10 | "testing" |
13 | 11 | "time" |
@@ -260,48 +258,6 @@ func Benchmark_Utils_IsNoCache(b *testing.B) { |
260 | 258 | utils.AssertEqual(b, true, ok) |
261 | 259 | } |
262 | 260 |
|
263 | | -func Test_Utils_lnMetadata(t *testing.T) { |
264 | | - t.Run("closed listen", func(t *testing.T) { |
265 | | - ln, err := net.Listen(NetworkTCP, ":0") |
266 | | - utils.AssertEqual(t, nil, err) |
267 | | - |
268 | | - utils.AssertEqual(t, nil, ln.Close()) |
269 | | - |
270 | | - addr, config := lnMetadata(NetworkTCP, ln) |
271 | | - |
272 | | - utils.AssertEqual(t, ln.Addr().String(), addr) |
273 | | - utils.AssertEqual(t, true, config == nil) |
274 | | - }) |
275 | | - |
276 | | - t.Run("non tls", func(t *testing.T) { |
277 | | - ln, err := net.Listen(NetworkTCP, ":0") |
278 | | - |
279 | | - utils.AssertEqual(t, nil, err) |
280 | | - |
281 | | - addr, config := lnMetadata(NetworkTCP4, ln) |
282 | | - |
283 | | - utils.AssertEqual(t, ln.Addr().String(), addr) |
284 | | - utils.AssertEqual(t, true, config == nil) |
285 | | - }) |
286 | | - |
287 | | - t.Run("tls", func(t *testing.T) { |
288 | | - cer, err := tls.LoadX509KeyPair("./.github/testdata/ssl.pem", "./.github/testdata/ssl.key") |
289 | | - utils.AssertEqual(t, nil, err) |
290 | | - |
291 | | - config := &tls.Config{Certificates: []tls.Certificate{cer}} |
292 | | - |
293 | | - ln, err := net.Listen(NetworkTCP4, ":0") |
294 | | - utils.AssertEqual(t, nil, err) |
295 | | - |
296 | | - ln = tls.NewListener(ln, config) |
297 | | - |
298 | | - addr, config := lnMetadata(NetworkTCP4, ln) |
299 | | - |
300 | | - utils.AssertEqual(t, ln.Addr().String(), addr) |
301 | | - utils.AssertEqual(t, true, config != nil) |
302 | | - }) |
303 | | -} |
304 | | - |
305 | 261 | // go test -v -run=^$ -bench=Benchmark_SlashRecognition -benchmem -count=4 |
306 | 262 | func Benchmark_SlashRecognition(b *testing.B) { |
307 | 263 | search := "wtf/1234" |
|
0 commit comments