Initial hp working but need to fix port issue

This commit is contained in:
Owen
2025-02-22 11:21:13 -05:00
parent afa93d8a3f
commit 4aa718d55f
2 changed files with 77 additions and 11 deletions

12
main.go
View File

@@ -344,10 +344,16 @@ func main() {
var connected bool
var wgData WgData
if reachableAt != "" {
logger.Info("Sending reachableAt to server: %s", reachableAt)
if generateAndSaveKeyTo != "" {
var host = endpoint
if strings.HasPrefix(host, "http://") {
host = strings.TrimPrefix(host, "http://")
} else if strings.HasPrefix(host, "https://") {
host = strings.TrimPrefix(host, "https://")
}
// Create WireGuard service
wgService, err = wg.NewWireGuardService(interfaceName, mtuInt, reachableAt, generateAndSaveKeyTo, endpoint, id, client)
wgService, err = wg.NewWireGuardService(interfaceName, mtuInt, reachableAt, generateAndSaveKeyTo, host, id, client)
if err != nil {
logger.Fatal("Failed to create WireGuard service: %v", err)
}