mirror of
https://github.com/bunny-lab-io/Borealis.git
synced 2026-02-04 06:40:32 -07:00
Fixed WireGuard Issues
This commit is contained in:
@@ -1080,7 +1080,7 @@ function Install_Agent_Dependencies {
|
|||||||
|
|
||||||
if (-not $TunnelName) { return }
|
if (-not $TunnelName) { return }
|
||||||
$logPrefix = '[WireGuard]'
|
$logPrefix = '[WireGuard]'
|
||||||
$serviceName = "WireGuardTunnel$TunnelName"
|
$serviceName = 'WireGuardTunnel$' + $TunnelName
|
||||||
Write-AgentLog -FileName $LogName -Message ("$logPrefix Cleaning tunnel service {0}" -f $serviceName)
|
Write-AgentLog -FileName $LogName -Message ("$logPrefix Cleaning tunnel service {0}" -f $serviceName)
|
||||||
$serviceExists = $false
|
$serviceExists = $false
|
||||||
try {
|
try {
|
||||||
@@ -1221,7 +1221,7 @@ function Install_Agent_Dependencies {
|
|||||||
$logPrefix = '[WireGuard]'
|
$logPrefix = '[WireGuard]'
|
||||||
$friendlyName = $wireGuardTunnelNameFriendly
|
$friendlyName = $wireGuardTunnelNameFriendly
|
||||||
$internalName = $wireGuardTunnelNameInternal
|
$internalName = $wireGuardTunnelNameInternal
|
||||||
$serviceName = "WireGuardTunnel$internalName"
|
$serviceName = 'WireGuardTunnel$' + $internalName
|
||||||
|
|
||||||
Write-AgentLog -FileName $LogName -Message ("$logPrefix Ensuring tunnel adapter: {0}" -f $friendlyName)
|
Write-AgentLog -FileName $LogName -Message ("$logPrefix Ensuring tunnel adapter: {0}" -f $friendlyName)
|
||||||
$existing = Get-WireGuardAdapterByName -AdapterName $friendlyName
|
$existing = Get-WireGuardAdapterByName -AdapterName $friendlyName
|
||||||
|
|||||||
@@ -462,7 +462,17 @@ class WireGuardClient:
|
|||||||
_write_log("WireGuard client activity bump; idle timer reset.")
|
_write_log("WireGuard client activity bump; idle timer reset.")
|
||||||
|
|
||||||
|
|
||||||
client = WireGuardClient()
|
_client: Optional[WireGuardClient] = None
|
||||||
|
_client_lock = threading.Lock()
|
||||||
|
|
||||||
|
|
||||||
|
def _get_client() -> WireGuardClient:
|
||||||
|
global _client
|
||||||
|
if _client is None:
|
||||||
|
with _client_lock:
|
||||||
|
if _client is None:
|
||||||
|
_client = WireGuardClient()
|
||||||
|
return _client
|
||||||
|
|
||||||
|
|
||||||
def _parse_allowed_ips(value: Any, fallback: Optional[str]) -> Optional[str]:
|
def _parse_allowed_ips(value: Any, fallback: Optional[str]) -> Optional[str]:
|
||||||
@@ -485,7 +495,7 @@ def _coerce_int(value: Any, default: int) -> int:
|
|||||||
class Role:
|
class Role:
|
||||||
def __init__(self, ctx) -> None:
|
def __init__(self, ctx) -> None:
|
||||||
self.ctx = ctx
|
self.ctx = ctx
|
||||||
self.client = client
|
self.client = _get_client()
|
||||||
hooks = getattr(ctx, "hooks", {}) or {}
|
hooks = getattr(ctx, "hooks", {}) or {}
|
||||||
self._log_hook = hooks.get("log_agent")
|
self._log_hook = hooks.get("log_agent")
|
||||||
self._http_client_factory = hooks.get("http_client")
|
self._http_client_factory = hooks.get("http_client")
|
||||||
|
|||||||
Reference in New Issue
Block a user