mirror of
https://github.com/fosrl/newt.git
synced 2026-05-05 23:50:10 -05:00
Compare commits
6 Commits
v1.12.0-rc
...
1.12.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffd26f9a6d | ||
|
|
7610aa40bf | ||
|
|
bf33a66043 | ||
|
|
23caf57bf4 | ||
|
|
df3aa60cf5 | ||
|
|
5c43db466a |
@@ -47,7 +47,7 @@ type Config struct {
|
||||
Interval int `json:"hcInterval"` // in seconds
|
||||
UnhealthyInterval int `json:"hcUnhealthyInterval"` // in seconds
|
||||
Timeout int `json:"hcTimeout"` // in seconds
|
||||
FollowRedirects bool `json:"hcFollowRedirects"`
|
||||
FollowRedirects *bool `json:"hcFollowRedirects"`
|
||||
Headers map[string]string `json:"hcHeaders"`
|
||||
Method string `json:"hcMethod"`
|
||||
Status int `json:"hcStatus"` // HTTP status code
|
||||
@@ -202,7 +202,9 @@ func (m *Monitor) addTargetUnsafe(config Config) error {
|
||||
cancel: cancel,
|
||||
client: &http.Client{
|
||||
CheckRedirect: func() func(*http.Request, []*http.Request) error {
|
||||
if !config.FollowRedirects {
|
||||
// Default to following redirects if not explicitly configured
|
||||
followRedirects := config.FollowRedirects == nil || *config.FollowRedirects
|
||||
if !followRedirects {
|
||||
return func(req *http.Request, via []*http.Request) error {
|
||||
return http.ErrUseLastResponse
|
||||
}
|
||||
@@ -250,7 +252,7 @@ func (m *Monitor) RemoveTarget(id int) error {
|
||||
|
||||
// Notify callback of status change
|
||||
if m.callback != nil {
|
||||
go m.callback(m.GetTargets())
|
||||
go m.callback(m.getAllTargetsUnsafe())
|
||||
}
|
||||
|
||||
logger.Info("Successfully removed target %d", id)
|
||||
@@ -283,7 +285,7 @@ func (m *Monitor) RemoveTargets(ids []int) error {
|
||||
|
||||
// Notify callback of status change if any targets were removed
|
||||
if len(notFound) != len(ids) && m.callback != nil {
|
||||
go m.callback(m.GetTargets())
|
||||
go m.callback(m.getAllTargetsUnsafe())
|
||||
}
|
||||
|
||||
if len(notFound) > 0 {
|
||||
@@ -583,7 +585,7 @@ func (m *Monitor) DisableTarget(id int) error {
|
||||
|
||||
// Notify callback of status change
|
||||
if m.callback != nil {
|
||||
go m.callback(m.GetTargets())
|
||||
go m.callback(m.getAllTargetsUnsafe())
|
||||
}
|
||||
} else {
|
||||
logger.Debug("Target %d is already disabled", id)
|
||||
|
||||
2
main.go
2
main.go
@@ -542,7 +542,7 @@ func runNewtMain(ctx context.Context) {
|
||||
if telErr != nil {
|
||||
logger.Warn("Telemetry init failed: %v", telErr)
|
||||
}
|
||||
if tel != nil {
|
||||
if tel != nil && (metricsEnabled || pprofEnabled) {
|
||||
// Admin HTTP server (exposes /metrics when Prometheus exporter is enabled)
|
||||
logger.Debug("Starting metrics server on %s", tcfg.AdminAddr)
|
||||
mux := http.NewServeMux()
|
||||
|
||||
@@ -185,7 +185,7 @@ func (h *HTTPHandler) Start() error {
|
||||
}
|
||||
}()
|
||||
|
||||
logger.Info("HTTP handler: ready — routing determined per SubnetRule on ports 80/443")
|
||||
logger.Debug("HTTP handler: ready — routing determined per SubnetRule on ports 80/443")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user