macOS: Refactor config file parsing

- To report more fine grained errors
- To make the parse errors conform to WireGuardAppError

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander
2019-01-08 15:44:17 +05:30
parent 96fa6d3ba6
commit c2a6241b5c
4 changed files with 147 additions and 26 deletions
@@ -256,3 +256,25 @@
"macEditDiscard" = "Discard";
"macEditSave" = "Save";
"macAlertInvalidLine (%@)" = "Invalid line: '%@'.";
"macAlertNoInterface" = "Configuration must have an 'Interface' section.";
"macAlertMultipleInterfaces" = "Configuration must have only one 'Interface' section.";
"macAlertPrivateKeyInvalid" = "Private key is invalid.";
"macAlertListenPortInvalid (%@)" = "Listen port '%@' is invalid.";
"macAlertAddressInvalid (%@)" = "Address '%@' is invalid.";
"macAlertDNSInvalid (%@)" = "DNS '%@' is invalid.";
"macAlertMTUInvalid (%@)" = "MTU '%@' is invalid.";
"macAlertUnrecognizedInterfaceKey (%@)" = "Interface contains unrecognized key '%@'";
"macAlertInfoUnrecognizedInterfaceKey" = "Valid keys are: 'PrivateKey', 'ListenPort', 'Address', 'DNS' and 'MTU'.";
"macAlertPublicKeyInvalid" = "Public key is invalid";
"macAlertPreSharedKeyInvalid" = "Preshared key is invalid";
"macAlertAllowedIPInvalid (%@)" = "Allowed IP '%@' is invalid";
"macAlertEndpointInvalid (%@)" = "Endpoint '%@' is invalid";
"macAlertPersistentKeepliveInvalid (%@)" = "Persistent keepalive value '%@' is invalid";
"macAlertUnrecognizedPeerKey (%@)" = "Peer contains unrecognized key '%@'";
"macAlertInfoUnrecognizedPeerKey" = "Valid keys are: 'PublicKey', 'PresharedKey', 'AllowedIPs', 'Endpoint' and 'PersistentKeepalive'";