From 1a93df58860e4f09b23a2a646a1881a372d6f980 Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 13 Feb 2025 05:50:49 +0800 Subject: [PATCH] fix route port udp selection and healthcheck interval --- internal/route/route.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/internal/route/route.go b/internal/route/route.go index d92c6d7..0b5980e 100644 --- a/internal/route/route.go +++ b/internal/route/route.go @@ -298,16 +298,18 @@ func (r *Route) Finalize() { if r.Host == cont.PublicHostname { if p, ok := cont.PrivatePortMapping[pp]; ok { pp = int(p.PublicPort) - if r.Scheme == "" && p.Type == "udp" { - r.Scheme = "udp" - } } } else { // replace public port with private port if using private IP. if p, ok := cont.PublicPortMapping[pp]; ok { pp = int(p.PrivatePort) - if r.Scheme == "" && p.Type == "udp" { + } + } + if r.Scheme == "" { + for _, p := range cont.PublicPortMapping { + if p.Type == "udp" { r.Scheme = "udp" + break } } } @@ -330,10 +332,13 @@ func (r *Route) Finalize() { r.HealthCheck = health.DefaultHealthConfig } - // set or keep at least default if !r.HealthCheck.Disable { - r.HealthCheck.Interval |= common.HealthCheckIntervalDefault - r.HealthCheck.Timeout |= common.HealthCheckTimeoutDefault + if r.HealthCheck.Interval == 0 { + r.HealthCheck.Interval = common.HealthCheckIntervalDefault + } + if r.HealthCheck.Timeout == 0 { + r.HealthCheck.Timeout = common.HealthCheckTimeoutDefault + } } if isDocker && cont.IdleTimeout != "" {