|
|
|
@ -65,7 +65,7 @@ func loadInterfaceConfField(cfg *InterfaceConfig, field basic.Field) error {
|
|
|
|
|
err := cfg.Address.UnmarshalText([]byte(field.Value)) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "unmarshal failed on field %q", field.Key) |
|
|
|
|
default: |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
@ -77,7 +77,7 @@ func loadInterfaceConfField(cfg *InterfaceConfig, field basic.Field) error {
|
|
|
|
|
err := cfg.PrivateKey.UnmarshalText([]byte(field.Value)) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "unmarshal failed on field %q", field.Key) |
|
|
|
|
default: |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
@ -89,7 +89,7 @@ func loadInterfaceConfField(cfg *InterfaceConfig, field basic.Field) error {
|
|
|
|
|
u64, err := strconv.ParseUint(field.Value, 10, 16) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "field %q is not an integer", field.Key) |
|
|
|
|
case u64 == 0: |
|
|
|
|
return core.Wrap(fs.ErrInvalid, "invalid %q value", field.Key) |
|
|
|
|
default: |
|
|
|
@ -117,7 +117,7 @@ func loadPeerConfField(cfg *PeerConfig, field basic.Field) error {
|
|
|
|
|
err := cfg.PublicKey.UnmarshalText([]byte(field.Value)) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "unmarshal failed on field %q", field.Key) |
|
|
|
|
default: |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
@ -129,7 +129,7 @@ func loadPeerConfField(cfg *PeerConfig, field basic.Field) error {
|
|
|
|
|
err := cfg.Endpoint.UnmarshalText([]byte(field.Value)) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "unmarshal failed on field %q", field.Key) |
|
|
|
|
default: |
|
|
|
|
return nil |
|
|
|
|
} |
|
|
|
@ -137,7 +137,7 @@ func loadPeerConfField(cfg *PeerConfig, field basic.Field) error {
|
|
|
|
|
s, err := parseAllowedIPs(field.Value) |
|
|
|
|
switch { |
|
|
|
|
case err != nil: |
|
|
|
|
return core.Wrap(err, field.Key) |
|
|
|
|
return core.Wrap(err, "%q is not an IP", field.Key) |
|
|
|
|
case len(s) > 0: |
|
|
|
|
cfg.AllowedIPs = append(cfg.AllowedIPs, s...) |
|
|
|
|
return nil |
|
|
|
|