fix(settings): wireguard preshared key from toml file

This commit is contained in:
Quentin McGaw
2023-11-08 09:38:10 +00:00
parent ab7d1ccf3d
commit de196490db
2 changed files with 5 additions and 5 deletions

View File

@@ -53,7 +53,7 @@ func parseWireguardInterfaceSection(interfaceSection *ini.Section,
return err // error is already wrapped correctly
}
wireguard.PreSharedKey, err = parseINIWireguardKey(interfaceSection, "PreSharedKey")
wireguard.PreSharedKey, err = parseINIWireguardKey(interfaceSection, "PresharedKey")
if err != nil {
return err // error is already wrapped correctly
}

View File

@@ -63,7 +63,7 @@ PrivateKey = x
fileContent: `
[Interface]
PrivateKey = QOlCgyA/Sn/c/+YNTIEohrjm8IZV+OZ2AUFIoX20sk8=
PreSharedKey = YJ680VN+dGrdsWNjSFqZ6vvwuiNhbq502ZL3G7Q3o3g=
PresharedKey = YJ680VN+dGrdsWNjSFqZ6vvwuiNhbq502ZL3G7Q3o3g=
Address = 10.38.22.35/32
DNS = 193.138.218.74
@@ -121,9 +121,9 @@ PrivateKey = x`,
},
"pre shared key error": {
iniData: `[Interface]
PreSharedKey = x
PresharedKey = x
`,
errMessage: "parsing PreSharedKey: x: " +
errMessage: "parsing PresharedKey: x: " +
"wgtypes: failed to parse base64-encoded key: " +
"illegal base64 data at input byte 0",
},
@@ -137,7 +137,7 @@ Address = x
iniData: `
[Interface]
PrivateKey = QOlCgyA/Sn/c/+YNTIEohrjm8IZV+OZ2AUFIoX20sk8=
PreSharedKey = YJ680VN+dGrdsWNjSFqZ6vvwuiNhbq502ZL3G7Q3o3g=
PresharedKey = YJ680VN+dGrdsWNjSFqZ6vvwuiNhbq502ZL3G7Q3o3g=
Address = 10.38.22.35/32
`,
wireguard: settings.Wireguard{