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
4a8bd8f8
Commit
4a8bd8f8
authored
Oct 11, 2015
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11 from jbenet/fix/nil-addr
return error if passed nil net.Addr
parents
861fd197
74e0b7e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
convert.go
convert.go
+4
-0
No files found.
convert.go
View file @
4a8bd8f8
...
...
@@ -13,6 +13,10 @@ var errIncorrectNetAddr = fmt.Errorf("incorrect network addr conversion")
// FromNetAddr converts a net.Addr type to a Multiaddr.
func
FromNetAddr
(
a
net
.
Addr
)
(
ma
.
Multiaddr
,
error
)
{
if
a
==
nil
{
return
nil
,
fmt
.
Errorf
(
"nil multiaddr"
)
}
switch
a
.
Network
()
{
case
"tcp"
,
"tcp4"
,
"tcp6"
:
ac
,
ok
:=
a
.
(
*
net
.
TCPAddr
)
...
...
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