mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-27 13:27:50 +08:00
godep multiaddr update
This commit is contained in:
parent
70ea4f540c
commit
34a0580ea6
4
Godeps/Godeps.json
generated
4
Godeps/Godeps.json
generated
@ -60,8 +60,8 @@
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/jbenet/go-multiaddr",
|
||||
"Comment": "0.1.2-2-g0624ab3",
|
||||
"Rev": "0624ab3bf754d013585c5d07f0100ba34901a689"
|
||||
"Comment": "0.1.2-3-g74443fc",
|
||||
"Rev": "74443fca319c4c2f5e9968b8e268c30a4a74dc64"
|
||||
},
|
||||
{
|
||||
"ImportPath": "github.com/jbenet/go-multihash",
|
||||
|
||||
6
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/index.go
generated
vendored
6
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/index.go
generated
vendored
@ -1,6 +1,7 @@
|
||||
package multiaddr
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
@ -19,6 +20,11 @@ func NewMultiaddr(s string) (*Multiaddr, error) {
|
||||
return &Multiaddr{Bytes: b}, nil
|
||||
}
|
||||
|
||||
// Equal tests whether two multiaddrs are equal
|
||||
func (m *Multiaddr) Equal(m2 *Multiaddr) bool {
|
||||
return bytes.Equal(m.Bytes, m2.Bytes)
|
||||
}
|
||||
|
||||
// String returns the string representation of a Multiaddr
|
||||
func (m *Multiaddr) String() (string, error) {
|
||||
return bytesToString(m.Bytes)
|
||||
|
||||
34
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/multiaddr_test.go
generated
vendored
34
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/multiaddr_test.go
generated
vendored
@ -6,6 +6,40 @@ import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func newMultiaddr(t *testing.T, a string) *Multiaddr {
|
||||
m, err := NewMultiaddr(a)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
return m
|
||||
}
|
||||
|
||||
func TestEqual(t *testing.T) {
|
||||
m1 := newMultiaddr(t, "/ip4/127.0.0.1/udp/1234")
|
||||
m2 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
|
||||
m3 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
|
||||
|
||||
if m1.Equal(m2) {
|
||||
t.Error("should not be equal")
|
||||
}
|
||||
|
||||
if m2.Equal(m1) {
|
||||
t.Error("should not be equal")
|
||||
}
|
||||
|
||||
if !m2.Equal(m3) {
|
||||
t.Error("should be equal")
|
||||
}
|
||||
|
||||
if !m3.Equal(m2) {
|
||||
t.Error("should be equal")
|
||||
}
|
||||
|
||||
if !m1.Equal(m1) {
|
||||
t.Error("should be equal")
|
||||
}
|
||||
}
|
||||
|
||||
func TestStringToBytes(t *testing.T) {
|
||||
|
||||
testString := func(s string, h string) {
|
||||
|
||||
@ -14,7 +14,7 @@ It has these top-level messages:
|
||||
*/
|
||||
package spipe
|
||||
|
||||
import proto "code.google.com/p/gogoprotobuf/proto"
|
||||
import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
|
||||
import json "encoding/json"
|
||||
import math "math"
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@ It has these top-level messages:
|
||||
*/
|
||||
package dht
|
||||
|
||||
import proto "code.google.com/p/gogoprotobuf/proto"
|
||||
import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
|
||||
import json "encoding/json"
|
||||
import math "math"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user