mirror of
https://github.com/fosrl/olm.git
synced 2026-02-07 21:46:40 +00:00
Set fingerprint earlier
This commit is contained in:
30
olm/olm.go
30
olm/olm.go
@@ -290,14 +290,27 @@ func (o *Olm) StartTunnel(config TunnelConfig) {
|
||||
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)
|
||||
|
||||
// debug print out the whole config
|
||||
logger.Debug("Starting tunnel with config: %+v", config)
|
||||
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)
|
||||
|
||||
// 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)
|
||||
|
||||
Reference in New Issue
Block a user