@@ -137,12 +137,12 @@ var TranscoderOnion = NewTranscoderFromFunctions(onionStB, onionBtS, nil)
137
137
func onionStB (s string ) ([]byte , error ) {
138
138
addr := strings .Split (s , ":" )
139
139
if len (addr ) != 2 {
140
- return nil , fmt .Errorf ("failed to parse onion addr: %s does not contain a port number. " , s )
140
+ return nil , fmt .Errorf ("failed to parse onion addr: %s does not contain a port number" , s )
141
141
}
142
142
143
143
// onion address without the ".onion" substring
144
144
if len (addr [0 ]) != 16 {
145
- return nil , fmt .Errorf ("failed to parse onion addr: %s not a Tor onion address. " , s )
145
+ return nil , fmt .Errorf ("failed to parse onion addr: %s not a Tor onion address" , s )
146
146
}
147
147
onionHostBytes , err := base32 .StdEncoding .DecodeString (strings .ToUpper (addr [0 ]))
148
148
if err != nil {
@@ -180,7 +180,7 @@ var TranscoderOnion3 = NewTranscoderFromFunctions(onion3StB, onion3BtS, nil)
180
180
func onion3StB (s string ) ([]byte , error ) {
181
181
addr := strings .Split (s , ":" )
182
182
if len (addr ) != 2 {
183
- return nil , fmt .Errorf ("failed to parse onion addr: %s does not contain a port number. " , s )
183
+ return nil , fmt .Errorf ("failed to parse onion addr: %s does not contain a port number" , s )
184
184
}
185
185
186
186
// onion address without the ".onion" substring
@@ -228,7 +228,7 @@ func garlic64StB(s string) ([]byte, error) {
228
228
// i2p base64 address will be between 516 and 616 characters long, depending on
229
229
// certificate type
230
230
if len (s ) < 516 || len (s ) > 616 {
231
- return nil , fmt .Errorf ("failed to parse garlic addr: %s not an i2p base64 address. len: %d\n " , s , len (s ))
231
+ return nil , fmt .Errorf ("failed to parse garlic addr: %s not an i2p base64 address. len: %d" , s , len (s ))
232
232
}
233
233
garlicHostBytes , err := garlicBase64Encoding .DecodeString (s )
234
234
if err != nil {
@@ -249,7 +249,7 @@ func garlic64BtS(b []byte) (string, error) {
249
249
func garlic64Validate (b []byte ) error {
250
250
// A garlic64 address will always be greater than 386 bytes long when encoded.
251
251
if len (b ) < 386 {
252
- return fmt .Errorf ("failed to validate garlic addr: %s not an i2p base64 address. len: %d\n " , b , len (b ))
252
+ return fmt .Errorf ("failed to validate garlic addr: %s not an i2p base64 address. len: %d" , b , len (b ))
253
253
}
254
254
return nil
255
255
}
@@ -286,7 +286,7 @@ func garlic32Validate(b []byte) error {
286
286
// an i2p base64 for an Encrypted Leaseset v2 will be at least 35 bytes
287
287
// long other than that, they will be exactly 32 bytes
288
288
if len (b ) < 35 && len (b ) != 32 {
289
- return fmt .Errorf ("failed to validate garlic addr: %s not an i2p base32 address. len: %d\n " , b , len (b ))
289
+ return fmt .Errorf ("failed to validate garlic addr: %s not an i2p base32 address. len: %d" , b , len (b ))
290
290
}
291
291
return nil
292
292
}
0 commit comments