Commit d4cfd691 authored by Jeromy's avatar Jeromy

add ip+net back in

parent 4508ee69
...@@ -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)
}
}
...@@ -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()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment