Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
mf
go-multiaddr
Commits
8f388501
Unverified
Commit
8f388501
authored
Dec 09, 2019
by
Steven Allen
Committed by
GitHub
Dec 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #116 from aratz-lasa/patch-1
Validate bytes when parsing string
parents
64e34154
b00b4ac8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
transcoders.go
transcoders.go
+6
-0
No files found.
transcoders.go
View file @
8f388501
...
...
@@ -14,8 +14,11 @@ import (
)
type
Transcoder
interface
{
// Validates and encodes to bytes a multiaddr that's in the string representation.
StringToBytes
(
string
)
([]
byte
,
error
)
// Validates and decodes to a string a multiaddr that's in the bytes representation.
BytesToString
([]
byte
)
(
string
,
error
)
// Validates bytes when parsing a multiaddr that's already in the bytes representation.
ValidateBytes
([]
byte
)
error
}
...
...
@@ -63,6 +66,9 @@ func ip6zoneStB(s string) ([]byte, error) {
if
len
(
s
)
==
0
{
return
nil
,
fmt
.
Errorf
(
"empty ip6zone"
)
}
if
strings
.
Contains
(
s
,
"/"
)
{
return
nil
,
fmt
.
Errorf
(
"IPv6 zone ID contains '/': %s"
,
s
)
}
return
[]
byte
(
s
),
nil
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment