mirror of
https://github.com/R0m1k3/Loki.git
synced 2026-10-20 13:38:11 +02:00
acces distant : le tunnel jean-link tourne aussi hors systemd (macOS/Windows)
linkServiceCtl/linkServiceActive etaient Linux-only : sur un Mac le token etait bien enregistre mais rien ne composait jamais le tunnel, d'ou le message << service arrete >> permanent. Hors Linux on lance desormais 'jean link serve' en processus detache suivi par un fichier PID (spawnDetached/pidAlive/killTree, nouvelles primitives par plateforme). - le mode app relance le tunnel au demarrage si une cle est enregistree - nouvelle route POST /api/link/start + bouton << demarrer le tunnel >> dans le panneau, visible quand le lien est configure mais arrete
This commit is contained in:
1 parent
9787923879
commit
075a05ebaa
9 files changed
+214
-7
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
@@ -390,3 +391,28 @@ func ramUsageMB() (used, total int) {
|
||||
const mb = 1024 * 1024
|
||||
return int((m.ullTotalPhys - m.ullAvailPhys) / mb), int(m.ullTotalPhys / mb)
|
||||
}
|
||||
|
||||
// --- Supervision de processus détachés (worker de lien, service). Pendant
|
||||
// Windows de sys_platform_unix.go.
|
||||
|
||||
// spawnDetached prépare une commande détachée et SANS console : en mode app
|
||||
// (double-clic) le moindre enfant console ferait clignoter une fenêtre noire.
|
||||
func spawnDetached(name string, args ...string) *exec.Cmd {
|
||||
cmd := exec.Command(name, args...)
|
||||
cmd.SysProcAttr = &syscall.SysProcAttr{
|
||||
HideWindow: true,
|
||||
CreationFlags: createNewProcessGroup | detachedProcess | createNoWindow,
|
||||
}
|
||||
return cmd
|
||||
}
|
||||
|
||||
// pidAlive : alias de processAlive (API commune avec Unix).
|
||||
func pidAlive(pid int) bool { return processAlive(pid) }
|
||||
|
||||
// killTree arrête le process et toute sa descendance (taskkill /T).
|
||||
func killTree(pid int) {
|
||||
if pid <= 0 {
|
||||
return
|
||||
}
|
||||
_ = hideCmd(exec.Command("taskkill", "/PID", strconv.Itoa(pid), "/T", "/F")).Run()
|
||||
}
|
||||
Reference in new issue
Block a user