fix route port udp selection and healthcheck interval

This commit is contained in:
yusing 2025-02-13 05:50:49 +08:00
parent bdc086c285
commit 1a93df5886

View file

@ -298,16 +298,18 @@ func (r *Route) Finalize() {
if r.Host == cont.PublicHostname { if r.Host == cont.PublicHostname {
if p, ok := cont.PrivatePortMapping[pp]; ok { if p, ok := cont.PrivatePortMapping[pp]; ok {
pp = int(p.PublicPort) pp = int(p.PublicPort)
if r.Scheme == "" && p.Type == "udp" {
r.Scheme = "udp"
}
} }
} else { } else {
// replace public port with private port if using private IP. // replace public port with private port if using private IP.
if p, ok := cont.PublicPortMapping[pp]; ok { if p, ok := cont.PublicPortMapping[pp]; ok {
pp = int(p.PrivatePort) 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" r.Scheme = "udp"
break
} }
} }
} }
@ -330,10 +332,13 @@ func (r *Route) Finalize() {
r.HealthCheck = health.DefaultHealthConfig r.HealthCheck = health.DefaultHealthConfig
} }
// set or keep at least default
if !r.HealthCheck.Disable { if !r.HealthCheck.Disable {
r.HealthCheck.Interval |= common.HealthCheckIntervalDefault if r.HealthCheck.Interval == 0 {
r.HealthCheck.Timeout |= common.HealthCheckTimeoutDefault r.HealthCheck.Interval = common.HealthCheckIntervalDefault
}
if r.HealthCheck.Timeout == 0 {
r.HealthCheck.Timeout = common.HealthCheckTimeoutDefault
}
} }
if isDocker && cont.IdleTimeout != "" { if isDocker && cont.IdleTimeout != "" {