Add node mode with SSH auto-install and Remnawave-style manual deploy.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
orohi
2026-07-29 04:03:33 +03:00
co-authored by Cursor
parent 93bbbf8ce8
commit 7b77d84f68
20 changed files with 1470 additions and 8 deletions
+44
View File
@@ -0,0 +1,44 @@
package nodeclient
import (
"encoding/json"
"fmt"
"io"
"net/http"
"time"
"github.com/orohi/vpn-panel/internal/models"
)
type HealthResponse struct {
OK bool `json:"ok"`
Name string `json:"name"`
Version string `json:"version"`
Uptime int64 `json:"uptime_sec"`
Protocols []string `json:"protocols"`
}
func Health(n *models.Node) (*HealthResponse, error) {
url := fmt.Sprintf("http://%s:%d/health", n.Host, n.NodePort)
req, err := http.NewRequest(http.MethodGet, url, nil)
if err != nil {
return nil, err
}
req.Header.Set("Authorization", "Bearer "+n.SecretKey)
client := &http.Client{Timeout: 8 * time.Second}
res, err := client.Do(req)
if err != nil {
return nil, err
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
if res.StatusCode != http.StatusOK {
return nil, fmt.Errorf("status %d: %s", res.StatusCode, string(body))
}
var hr HealthResponse
if err := json.Unmarshal(body, &hr); err != nil {
return nil, err
}
return &hr, nil
}