Skip to content

Commit 927b81c

Browse files
fix error strings
1 parent e2f4e4e commit 927b81c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

transcoders.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ var TranscoderOnion = NewTranscoderFromFunctions(onionStB, onionBtS, nil)
137137
func onionStB(s string) ([]byte, error) {
138138
addr := strings.Split(s, ":")
139139
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)
141141
}
142142

143143
// onion address without the ".onion" substring
144144
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)
146146
}
147147
onionHostBytes, err := base32.StdEncoding.DecodeString(strings.ToUpper(addr[0]))
148148
if err != nil {
@@ -180,7 +180,7 @@ var TranscoderOnion3 = NewTranscoderFromFunctions(onion3StB, onion3BtS, nil)
180180
func onion3StB(s string) ([]byte, error) {
181181
addr := strings.Split(s, ":")
182182
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)
184184
}
185185

186186
// onion address without the ".onion" substring
@@ -228,7 +228,7 @@ func garlic64StB(s string) ([]byte, error) {
228228
// i2p base64 address will be between 516 and 616 characters long, depending on
229229
// certificate type
230230
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))
232232
}
233233
garlicHostBytes, err := garlicBase64Encoding.DecodeString(s)
234234
if err != nil {
@@ -249,7 +249,7 @@ func garlic64BtS(b []byte) (string, error) {
249249
func garlic64Validate(b []byte) error {
250250
// A garlic64 address will always be greater than 386 bytes long when encoded.
251251
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))
253253
}
254254
return nil
255255
}
@@ -286,7 +286,7 @@ func garlic32Validate(b []byte) error {
286286
// an i2p base64 for an Encrypted Leaseset v2 will be at least 35 bytes
287287
// long other than that, they will be exactly 32 bytes
288288
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))
290290
}
291291
return nil
292292
}

0 commit comments

Comments
 (0)