mirror of
https://github.com/fosrl/olm.git
synced 2026-03-05 10:16:46 +00:00
14
olm/olm.go
14
olm/olm.go
@@ -31,6 +31,10 @@ type GlobalConfig struct {
|
|||||||
SocketPath string
|
SocketPath string
|
||||||
Version string
|
Version string
|
||||||
|
|
||||||
|
// Callbacks
|
||||||
|
OnRegistered func()
|
||||||
|
OnConnected func()
|
||||||
|
|
||||||
// Source tracking (not in JSON)
|
// Source tracking (not in JSON)
|
||||||
sources map[string]string
|
sources map[string]string
|
||||||
}
|
}
|
||||||
@@ -525,6 +529,11 @@ func StartTunnel(config TunnelConfig) {
|
|||||||
|
|
||||||
connected = true
|
connected = true
|
||||||
|
|
||||||
|
// Invoke onConnected callback if configured
|
||||||
|
if globalConfig.OnConnected != nil {
|
||||||
|
go globalConfig.OnConnected()
|
||||||
|
}
|
||||||
|
|
||||||
logger.Info("WireGuard device created.")
|
logger.Info("WireGuard device created.")
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -987,6 +996,11 @@ func StartTunnel(config TunnelConfig) {
|
|||||||
"orgId": config.OrgID,
|
"orgId": config.OrgID,
|
||||||
// "doNotCreateNewClient": config.DoNotCreateNewClient,
|
// "doNotCreateNewClient": config.DoNotCreateNewClient,
|
||||||
}, 1*time.Second)
|
}, 1*time.Second)
|
||||||
|
|
||||||
|
// Invoke onRegistered callback if configured
|
||||||
|
if globalConfig.OnRegistered != nil {
|
||||||
|
go globalConfig.OnRegistered()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
go keepSendingPing(olm)
|
go keepSendingPing(olm)
|
||||||
|
|||||||
Reference in New Issue
Block a user