Repository: traefik/traefik (language: go)

Issue:
Error while Peeking first byte 
### Welcome!

- [X] Yes, I've searched similar issues on [GitHub](https://github.com/traefik/traefik/issues) and didn't find any.
- [X] Yes, I've searched similar issues on the [Traefik community forum](https://community.traefik.io) and didn't find any.

### What did you do?

Since we upgraded to Traefik v3 we see Messages like this all the time (~1 per sec)
```
2024-09-24T08:10:22Z ERR github.com/traefik/traefik/v3/pkg/server/router/tcp/postgres.go:32 > Error while Peeking first byte error="read tcp 100.111.28.246:8443->100.117.198.128:28318: i/o timeout"
```




### What did you see instead?

Since we dont have problems using Traefik i searched and stumbled over this code review after a commit was merged:
https://github.com/traefik/traefik/pull/9663/files/3422dd755f719f5db4da433fa99e2f0b18b80b68

So it seems that exactly this is happening for us what @juldou found when reviewing. 

### What version of Traefik are you using?

v3.1.2

### What is your environment & configuration?

Traefik inside Kubernetes Cluster.

Args:
```
      --tracing.servicename=redacted
      --tracing.otlp=true
      --tracing.otlp.grpc=true
      --tracing.otlp.grpc.endpoint=$(HOST_IP):4317
      --tracing.otlp.grpc.insecure=true
      --metrics.prometheus.buckets=0.050000, 0.100000, 0.300000, 1.200000, 5.000000
      --entryPoints.metrics.address=:9100/tcp
      --entryPoints.traefik.address=:9000/tcp
      --entryPoints.web.address=:8000/tcp
      --entryPoints.websecure.address=:8443/tcp
      --api.dashboard=true
      --ping=true
      --metrics.prometheus=true
      --metrics.prometheus.entrypoint=metrics
      --providers.kubernetescrd
      --providers.kubernetescrd.ingressClass=redacted
      --providers.kubernetescrd.allowCrossNamespace=true
      --providers.kubernetescrd.allowExternalNameServices=true
      --providers.kubernetesingress
      --providers.kubernetesingress.allowExternalNameServices=true
      --providers.kubernetesingress.ingressClass=redacted
      --entryPoints.web.forwardedHeaders.insecure
      --entryPoints.websecure.forwardedHeaders.insecure
      --log.level=INFO
      --accesslog=true
      --accesslog.format=json
      --accesslog.fields.defaultmode=keep
      --accesslog.fields.headers.defaultmode=drop
```


### If applicable, please paste the log output in DEBUG level

_No response_


Discussion / hints:

Fix patch:
diff --git a/pkg/server/router/tcp/postgres.go b/pkg/server/router/tcp/postgres.go
index e82ba7eb3b..99a658c0eb 100644
--- a/pkg/server/router/tcp/postgres.go
+++ b/pkg/server/router/tcp/postgres.go
@@ -28,7 +28,7 @@ func isPostgres(br *bufio.Reader) (bool, error) {
 		peeked, err := br.Peek(i)
 		if err != nil {
 			var opErr *net.OpError
-			if !errors.Is(err, io.EOF) && (!errors.As(err, &opErr) || opErr.Timeout()) {
+			if !errors.Is(err, io.EOF) && (!errors.As(err, &opErr) || !opErr.Timeout()) {
 				log.Error().Err(err).Msg("Error while Peeking first byte")
 			}
 			return false, err
diff --git a/pkg/server/router/tcp/router.go b/pkg/server/router/tcp/router.go
index 06ea5c2239..46da18b5d9 100644
--- a/pkg/server/router/tcp/router.go
+++ b/pkg/server/router/tcp/router.go
@@ -363,7 +363,7 @@ func clientHelloInfo(br *bufio.Reader) (*clientHello, error) {
 	hdr, err := br.Peek(1)
 	if err != nil {
 		var opErr *net.OpError
-		if !errors.Is(err, io.EOF) && (!errors.As(err, &opErr) || opErr.Timeout()) {
+		if !errors.Is(err, io.EOF) && (!errors.As(err, &opErr) || !opErr.Timeout()) {
 			log.Error().Err(err).Msg("Error while Peeking first byte")
 		}
 		return nil, err


Test patch: