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
d4cfd691
Commit
d4cfd691
authored
May 16, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ip+net back in
parent
4508ee69
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
net_test.go
net_test.go
+7
-0
registry.go
registry.go
+10
-0
No files found.
net_test.go
View file @
d4cfd691
...
@@ -505,3 +505,10 @@ func testSliceEqual(t *testing.T, a, b []ma.Multiaddr) {
...
@@ -505,3 +505,10 @@ func testSliceEqual(t *testing.T, a, b []ma.Multiaddr) {
}
}
}
}
}
}
func
TestInterfaceAddressesWorks
(
t
*
testing
.
T
)
{
_
,
err
:=
InterfaceMultiaddrs
()
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
}
registry.go
View file @
d4cfd691
...
@@ -20,6 +20,7 @@ func init() {
...
@@ -20,6 +20,7 @@ func init() {
defaultCodecs
.
RegisterNetCodec
(
utpAddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
utpAddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
ip4AddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
ip4AddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
ip6AddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
ip6AddrSpec
)
defaultCodecs
.
RegisterNetCodec
(
ipnetAddrSpec
)
}
}
type
CodecMap
struct
{
type
CodecMap
struct
{
...
@@ -105,6 +106,15 @@ var ip6AddrSpec = &NetCodec{
...
@@ -105,6 +106,15 @@ var ip6AddrSpec = &NetCodec{
ConvertMultiaddr
:
parseBasicNetMaddr
,
ConvertMultiaddr
:
parseBasicNetMaddr
,
}
}
var
ipnetAddrSpec
=
&
NetCodec
{
ProtocolName
:
"ip+net"
,
NetAddrNetworks
:
[]
string
{
"ip+net"
},
ParseNetAddr
:
parseIpPlusNetAddr
,
ConvertMultiaddr
:
func
(
ma
.
Multiaddr
)
(
net
.
Addr
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"converting ip+net multiaddr not supported"
)
},
}
func
(
cm
*
CodecMap
)
getAddrParser
(
net
string
)
(
FromNetAddrFunc
,
error
)
{
func
(
cm
*
CodecMap
)
getAddrParser
(
net
string
)
(
FromNetAddrFunc
,
error
)
{
cm
.
lk
.
Lock
()
cm
.
lk
.
Lock
()
defer
cm
.
lk
.
Unlock
()
defer
cm
.
lk
.
Unlock
()
...
...
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