summaryrefslogtreecommitdiff
path: root/internal/wireguard.go
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-13 12:12:22 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-05-13 12:12:22 +0200
commit5abf00ab87a55662eefc7716de52ead9749293c6 (patch)
tree1cfa64b99482d7cc08b1d7da5d6833b75f5f7714 /internal/wireguard.go
parent57d6c2ac55a5fd1ea609c873d5410174b7cf6ca4 (diff)
Refactor: Adapt the API to the documentation
Diffstat (limited to 'internal/wireguard.go')
-rw-r--r--internal/wireguard.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/wireguard.go b/internal/wireguard.go
index 7f8da38..6edad08 100644
--- a/internal/wireguard.go
+++ b/internal/wireguard.go
@@ -30,29 +30,29 @@ func wireguardConfigAddKey(config string, key wgtypes.Key) string {
return interface_re.ReplaceAllString(config, to_replace)
}
-func WireguardGetConfig(server Server, supportsOpenVPN bool) (string, error) {
+func WireguardGetConfig(server Server, supportsOpenVPN bool) (string, string, error) {
base, baseErr := server.GetBase()
if baseErr != nil {
- return "", &WireguardGetConfigError{Err: baseErr}
+ return "", "", &WireguardGetConfigError{Err: baseErr}
}
profile_id := base.Profiles.Current
wireguardKey, wireguardErr := wireguardGenerateKey()
if wireguardErr != nil {
- return "", &WireguardGetConfigError{Err: wireguardErr}
+ return "", "", &WireguardGetConfigError{Err: wireguardErr}
}
wireguardPublicKey := wireguardKey.PublicKey().String()
config, content, _, configErr := APIConnectWireguard(server, profile_id, wireguardPublicKey, supportsOpenVPN)
if configErr != nil {
- return "", &WireguardGetConfigError{Err: wireguardErr}
+ return "", "", &WireguardGetConfigError{Err: wireguardErr}
}
+ // FIXME: Store expiry
if content == "wireguard" {
- // FIXME: Store expiry
// This needs the go code a way to identify a connection
// Use the uuid of the connection e.g. on Linux
// This needs the client code to call the go code
@@ -60,7 +60,7 @@ func WireguardGetConfig(server Server, supportsOpenVPN bool) (string, error) {
config = wireguardConfigAddKey(config, wireguardKey)
}
- return config, nil
+ return config, content, nil
}
type WireguardGenerateKeyError struct {