diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-24 15:40:39 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-11-24 15:40:39 +0100 |
| commit | 8be555e5f91c6069c3d51cb014f1849fd182b1dc (patch) | |
| tree | 9c78f2ee1f5122da1e1ed3e452682f7f6744778f /internal/wireguard | |
| parent | 791fffebff4499e4fad3217e2160596e1b8b3eea (diff) | |
Style: Use stylecheck and fix errors
Diffstat (limited to 'internal/wireguard')
| -rw-r--r-- | internal/wireguard/wireguard.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/internal/wireguard/wireguard.go b/internal/wireguard/wireguard.go index 0a1ba5f..bbb22e4 100644 --- a/internal/wireguard/wireguard.go +++ b/internal/wireguard/wireguard.go @@ -22,14 +22,14 @@ func GenerateKey() (wgtypes.Key, error) { // FIXME: Instead of doing a regex replace, decide if we should use a parser func ConfigAddKey(config string, key wgtypes.Key) string { - interface_section := "[Interface]" - interface_section_escaped := regexp.QuoteMeta(interface_section) + interfaceSection := "[Interface]" + InterfaceSectionEscaped := regexp.QuoteMeta(interfaceSection) // (?m) enables multi line mode // ^ match from beginning of line // $ match till end of line // So it matches [Interface] section exactly - interface_re := regexp.MustCompile(fmt.Sprintf("(?m)^%s$", interface_section_escaped)) - to_replace := fmt.Sprintf("%s\nPrivateKey = %s", interface_section, key.String()) - return interface_re.ReplaceAllString(config, to_replace) + InterfaceRe := regexp.MustCompile(fmt.Sprintf("(?m)^%s$", InterfaceSectionEscaped)) + toReplace := fmt.Sprintf("%s\nPrivateKey = %s", interfaceSection, key.String()) + return InterfaceRe.ReplaceAllString(config, toReplace) } |
