package app import ( "sync" "time" ) const ( transportHealthFreshTTL = 45 * time.Second transportHealthBackoffMin = 5 * time.Second transportHealthBackoffMax = 2 * time.Minute transportHealthPersistMinAge = 90 * time.Second transportHealthMaxConcurrentProbe = 2 ) type transportHealthRefreshEntry struct { swr refreshCoordinator } type transportHealthRefresher struct { mu sync.Mutex entries map[string]*transportHealthRefreshEntry sem chan struct{} } func newTransportHealthRefresher(maxConcurrent int) *transportHealthRefresher { n := maxConcurrent if n <= 0 { n = transportHealthMaxConcurrentProbe } return &transportHealthRefresher{ entries: map[string]*transportHealthRefreshEntry{}, sem: make(chan struct{}, n), } } var transportHealthSWR = newTransportHealthRefresher(envInt("SVPN_TRANSPORT_HEALTH_MAX_PARALLEL", transportHealthMaxConcurrentProbe))