mirror of
https://github.com/fosrl/newt.git
synced 2026-02-28 15:56:40 +00:00
Quiet up the logs
This commit is contained in:
37
blueprint.yaml
Normal file
37
blueprint.yaml
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
resources:
|
||||||
|
resource-nice-id:
|
||||||
|
name: this is my resource
|
||||||
|
protocol: http
|
||||||
|
full-domain: level1.test3.example.com
|
||||||
|
host-header: example.com
|
||||||
|
tls-server-name: example.com
|
||||||
|
auth:
|
||||||
|
pincode: 123456
|
||||||
|
password: sadfasdfadsf
|
||||||
|
sso-enabled: true
|
||||||
|
sso-roles:
|
||||||
|
- Member
|
||||||
|
sso-users:
|
||||||
|
- owen@fossorial.io
|
||||||
|
whitelist-users:
|
||||||
|
- owen@fossorial.io
|
||||||
|
targets:
|
||||||
|
# - site: glossy-plains-viscacha-rat
|
||||||
|
- hostname: localhost
|
||||||
|
method: http
|
||||||
|
port: 8000
|
||||||
|
healthcheck:
|
||||||
|
port: 8000
|
||||||
|
hostname: localhost
|
||||||
|
# - site: glossy-plains-viscacha-rat
|
||||||
|
- hostname: localhost
|
||||||
|
method: http
|
||||||
|
port: 8001
|
||||||
|
resource-nice-id2:
|
||||||
|
name: this is other resource
|
||||||
|
protocol: tcp
|
||||||
|
proxy-port: 3000
|
||||||
|
targets:
|
||||||
|
# - site: glossy-plains-viscacha-rat
|
||||||
|
- hostname: localhost
|
||||||
|
port: 3000
|
||||||
@@ -76,7 +76,7 @@ type Monitor struct {
|
|||||||
|
|
||||||
// NewMonitor creates a new health check monitor
|
// NewMonitor creates a new health check monitor
|
||||||
func NewMonitor(callback StatusChangeCallback, enforceCert bool) *Monitor {
|
func NewMonitor(callback StatusChangeCallback, enforceCert bool) *Monitor {
|
||||||
logger.Info("Creating new health check monitor with certificate enforcement: %t", enforceCert)
|
logger.Debug("Creating new health check monitor with certificate enforcement: %t", enforceCert)
|
||||||
|
|
||||||
// Configure TLS settings based on certificate enforcement
|
// Configure TLS settings based on certificate enforcement
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
|||||||
14
main.go
14
main.go
@@ -478,7 +478,7 @@ func main() {
|
|||||||
|
|
||||||
// Register handlers for different message types
|
// Register handlers for different message types
|
||||||
client.RegisterHandler("newt/wg/connect", func(msg websocket.WSMessage) {
|
client.RegisterHandler("newt/wg/connect", func(msg websocket.WSMessage) {
|
||||||
logger.Info("Received registration message")
|
logger.Debug("Received registration message")
|
||||||
if stopFunc != nil {
|
if stopFunc != nil {
|
||||||
stopFunc() // stop the ws from sending more requests
|
stopFunc() // stop the ws from sending more requests
|
||||||
stopFunc = nil // reset stopFunc to nil to avoid double stopping
|
stopFunc = nil // reset stopFunc to nil to avoid double stopping
|
||||||
@@ -571,7 +571,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Warn("Initial reliable ping failed, but continuing: %v", err)
|
logger.Warn("Initial reliable ping failed, but continuing: %v", err)
|
||||||
} else {
|
} else {
|
||||||
logger.Info("Initial connection test successful")
|
logger.Debug("Initial connection test successful")
|
||||||
}
|
}
|
||||||
|
|
||||||
pingWithRetryStopChan, _ = pingWithRetry(tnet, wgData.ServerIP, pingTimeout)
|
pingWithRetryStopChan, _ = pingWithRetry(tnet, wgData.ServerIP, pingTimeout)
|
||||||
@@ -610,7 +610,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
if err := healthMonitor.AddTargets(wgData.HealthCheckTargets); err != nil {
|
if err := healthMonitor.AddTargets(wgData.HealthCheckTargets); err != nil {
|
||||||
logger.Error("Failed to bulk add health check targets: %v", err)
|
logger.Error("Failed to bulk add health check targets: %v", err)
|
||||||
} else {
|
} else {
|
||||||
logger.Info("Successfully added %d health check targets", len(wgData.HealthCheckTargets))
|
logger.Debug("Successfully added %d health check targets", len(wgData.HealthCheckTargets))
|
||||||
}
|
}
|
||||||
|
|
||||||
err = pm.Start()
|
err = pm.Start()
|
||||||
@@ -657,7 +657,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
})
|
})
|
||||||
|
|
||||||
client.RegisterHandler("newt/ping/exitNodes", func(msg websocket.WSMessage) {
|
client.RegisterHandler("newt/ping/exitNodes", func(msg websocket.WSMessage) {
|
||||||
logger.Info("Received ping message")
|
logger.Debug("Received ping message")
|
||||||
if stopFunc != nil {
|
if stopFunc != nil {
|
||||||
stopFunc() // stop the ws from sending more requests
|
stopFunc() // stop the ws from sending more requests
|
||||||
stopFunc = nil // reset stopFunc to nil to avoid double stopping
|
stopFunc = nil // reset stopFunc to nil to avoid double stopping
|
||||||
@@ -979,7 +979,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Failed to send Docker container list: %v", err)
|
logger.Error("Failed to send Docker container list: %v", err)
|
||||||
} else {
|
} else {
|
||||||
logger.Info("Docker container list sent, count: %d", len(containers))
|
logger.Debug("Docker container list sent, count: %d", len(containers))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -1095,7 +1095,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
if err := healthMonitor.AddTargets(config.Targets); err != nil {
|
if err := healthMonitor.AddTargets(config.Targets); err != nil {
|
||||||
logger.Error("Failed to add health check targets: %v", err)
|
logger.Error("Failed to add health check targets: %v", err)
|
||||||
} else {
|
} else {
|
||||||
logger.Info("Added %d health check targets", len(config.Targets))
|
logger.Debug("Added %d health check targets", len(config.Targets))
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug("Health check targets added: %+v", config.Targets)
|
logger.Debug("Health check targets added: %+v", config.Targets)
|
||||||
@@ -1238,7 +1238,7 @@ persistent_keepalive_interval=5`, fixKey(privateKey.String()), fixKey(wgData.Pub
|
|||||||
}
|
}
|
||||||
// request from the server the list of nodes to ping at newt/ping/request
|
// request from the server the list of nodes to ping at newt/ping/request
|
||||||
stopFunc = client.SendMessageInterval("newt/ping/request", map[string]interface{}{}, 3*time.Second)
|
stopFunc = client.SendMessageInterval("newt/ping/request", map[string]interface{}{}, 3*time.Second)
|
||||||
logger.Info("Requesting exit nodes from server")
|
logger.Debug("Requesting exit nodes from server")
|
||||||
clientsOnConnect()
|
clientsOnConnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user