File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed
internal/configuration/sources/files Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,9 @@ func parseINIWireguardAddress(section *ini.Section) (
101
101
addresses = make ([]netip.Prefix , len (addressStrings ))
102
102
for i , addressString := range addressStrings {
103
103
addressString = strings .TrimSpace (addressString )
104
+ if ! strings .ContainsRune (addressString , '/' ) {
105
+ addressString += "/32"
106
+ }
104
107
addresses [i ], err = netip .ParsePrefix (addressString )
105
108
if err != nil {
106
109
return nil , fmt .Errorf ("parsing address: %w" , err )
Original file line number Diff line number Diff line change @@ -131,7 +131,7 @@ PreSharedKey = x
131
131
iniData : `[Interface]
132
132
Address = x
133
133
` ,
134
- errMessage : "parsing address: netip.ParsePrefix(\" x\" ): no '/' " ,
134
+ errMessage : "parsing address: netip.ParsePrefix(\" x/32 \" ): ParseAddr( \" x \" ): unable to parse IP " ,
135
135
},
136
136
"success" : {
137
137
iniData : `
@@ -238,7 +238,7 @@ func Test_parseINIWireguardAddress(t *testing.T) {
238
238
"bad address" : {
239
239
fileContent : `[Interface]
240
240
Address = x` ,
241
- errMessage : "parsing address: netip.ParsePrefix(\" x\" ): no '/' " ,
241
+ errMessage : "parsing address: netip.ParsePrefix(\" x/32 \" ): ParseAddr( \" x \" ): unable to parse IP " ,
242
242
},
243
243
"success" : {
244
244
fileContent : `[Interface]
You can’t perform that action at this time.
0 commit comments