Set fingerprint earlier

Former-commit-id: ef36f7ca82
This commit is contained in:
Owen
2026-01-19 15:05:29 -08:00
parent 6d10650e70
commit f2e81c024a

View File

@@ -289,15 +289,28 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
logger.Info("Tunnel already running")
return
}
// debug print out the whole config
logger.Debug("Starting tunnel with config: %+v", config)
o.tunnelRunning = true // Also set it here in case it is called externally
o.tunnelConfig = config
// Reset terminated status when tunnel starts
o.apiServer.SetTerminated(false)
fingerprint := config.InitialFingerprint
if fingerprint == nil {
fingerprint = make(map[string]any)
}
// debug print out the whole config
logger.Debug("Starting tunnel with config: %+v", config)
postures := config.InitialPostures
if postures == nil {
postures = make(map[string]any)
}
o.SetFingerprint(fingerprint)
o.SetPostures(postures)
// Create a cancellable context for this tunnel process
tunnelCtx, cancel := context.WithCancel(o.olmCtx)
@@ -453,19 +466,6 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
}
})
fingerprint := config.InitialFingerprint
if fingerprint == nil {
fingerprint = make(map[string]any)
}
postures := config.InitialPostures
if postures == nil {
postures = make(map[string]any)
}
o.SetFingerprint(fingerprint)
o.SetPostures(postures)
// Connect to the WebSocket server
if err := o.websocket.Connect(); err != nil {
logger.Error("Failed to connect to server: %v", err)