v0.9.0 : poste distant accessible via ajean.link, chiffré de bout en bout (relais aveugle)

This commit is contained in:
nathaninline committed 2026-08-11 15:29:36 +02:00
1 parent 6d81f5c3f5
commit 1454dff2a7
16 files changed
+640 -199

No files matched your search

+35 -14
View File
@@ -77,24 +77,34 @@ Options :
// doConnect appaire au besoin, sauvegarde, puis installe (service) ou lance
// (avant-plan) selon install.
func doConnect(args []string, install bool) error {
url, code, allow, root, yes := parseFlags(args)
f := parseFlags(args)
cfg, lerr := nodeclient.LoadConfig()
needEnroll := lerr != nil || cfg.Key == ""
if url != "" {
cfg.ServerURL = url
needEnroll := lerr != nil || cfg.Priv == ""
if f.url != "" {
cfg.ServerURL = f.url
}
if f.key != "" {
cfg.AgentPub = f.key
}
if f.machine != "" {
cfg.MachineID = f.machine
}
if needEnroll {
if cfg.ServerURL == "" {
return fmt.Errorf("url du serveur requise (ex: http://192.168.1.127:8090)")
}
if code == "" {
if f.code == "" {
return fmt.Errorf("code d'appairage requis : --code CODE")
}
if err := nodeclient.Enroll(&cfg, code); err != nil {
if cfg.AgentPub == "" {
return fmt.Errorf("clé de l'agent requise : --key <clé> (fournie par la commande d'appairage)")
}
if err := nodeclient.Enroll(&cfg, f.code); err != nil {
return err
}
fmt.Printf("[ok] appairé (id %s)\n", cfg.ID)
}
allow, root, yes := f.allow, f.root, f.yes
if len(allow) > 0 {
cfg.Caps = nodeclient.SanitizeCaps(allow)
}
@@ -150,7 +160,14 @@ func doStatus() error {
return nil
}
func parseFlags(args []string) (url, code string, allow []string, root string, yes bool) {
type flags struct {
url, code, root, key, machine string
allow []string
yes bool
}
func parseFlags(args []string) flags {
var f flags
for i := 0; i < len(args); i++ {
a := args[i]
next := func() string {
@@ -162,20 +179,24 @@ func parseFlags(args []string) (url, code string, allow []string, root string, y
}
switch {
case a == "--code":
code = next()
f.code = next()
case a == "--key":
f.key = next()
case a == "--machine":
f.machine = next()
case a == "--allow":
for _, p := range strings.Split(next(), ",") {
if p = strings.TrimSpace(p); p != "" {
allow = append(allow, p)
f.allow = append(f.allow, p)
}
}
case a == "--root":
root = next()
f.root = next()
case a == "--yes" || a == "-y":
yes = true
case !strings.HasPrefix(a, "-") && url == "":
url = a
f.yes = true
case !strings.HasPrefix(a, "-") && f.url == "":
f.url = a
}
}
return
return f
}
Binary file not shown.
Binary file not shown.
+6 -6
View File
@@ -2,14 +2,14 @@
"FixedFileInfo": {
"FileVersion": {
"Major": 0,
"Minor": 8,
"Patch": 9,
"Minor": 9,
"Patch": 0,
"Build": 0
},
"ProductVersion": {
"Major": 0,
"Minor": 8,
"Patch": 9,
"Minor": 9,
"Patch": 0,
"Build": 0
},
"FileFlagsMask": "3f",
@@ -25,7 +25,7 @@
"LegalCopyright": "Copyright (c) 2026 AJEAN contributors. MIT License.",
"OriginalFilename": "ajean.exe",
"ProductName": "AJEAN",
"ProductVersion": "0.8.9",
"ProductVersion": "0.9.0",
"Comments": "https://github.com/nathaninline/ajean — projet open source (MIT)"
},
"VarFileInfo": {
@@ -34,4 +34,4 @@
"CharsetID": "04B0"
}
}
}
}