@cryptotaxi247 / kubo / commits / 34a0580ea

godep multiaddr update

Juan Batiz-Benet committed Sep 16, 2014 at 06:10 UTC 34a0580ea65cdefdb842813e05bc23d308e9451a
5 files changed +44 -4
Godeps/Godeps.json
+2 -2
@@ -60,8 +60,8 @@
60 },
61 {
62 "ImportPath": "github.com/jbenet/go-multiaddr",
63 - "Comment": "0.1.2-2-g0624ab3",
64 - "Rev": "0624ab3bf754d013585c5d07f0100ba34901a689"
63 + "Comment": "0.1.2-3-g74443fc",
64 + "Rev": "74443fca319c4c2f5e9968b8e268c30a4a74dc64"
65 },
66 {
67 "ImportPath": "github.com/jbenet/go-multihash",
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/index.go
+6
@@ -1,6 +1,7 @@
1 package multiaddr
2
3 import (
4 + "bytes"
5 "fmt"
6 "strings"
7 )
@@ -19,6 +20,11 @@ func NewMultiaddr(s string) (*Multiaddr, error) {
20 return &Multiaddr{Bytes: b}, nil
21 }
22
23 +// Equal tests whether two multiaddrs are equal
24 +func (m *Multiaddr) Equal(m2 *Multiaddr) bool {
25 + return bytes.Equal(m.Bytes, m2.Bytes)
26 +}
27 +
28 // String returns the string representation of a Multiaddr
29 func (m *Multiaddr) String() (string, error) {
30 return bytesToString(m.Bytes)
Godeps/_workspace/src/github.com/jbenet/go-multiaddr/multiaddr_test.go
+34
@@ -6,6 +6,40 @@ import (
6 "testing"
7 )
8
9 +func newMultiaddr(t *testing.T, a string) *Multiaddr {
10 + m, err := NewMultiaddr(a)
11 + if err != nil {
12 + t.Error(err)
13 + }
14 + return m
15 +}
16 +
17 +func TestEqual(t *testing.T) {
18 + m1 := newMultiaddr(t, "/ip4/127.0.0.1/udp/1234")
19 + m2 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
20 + m3 := newMultiaddr(t, "/ip4/127.0.0.1/tcp/1234")
21 +
22 + if m1.Equal(m2) {
23 + t.Error("should not be equal")
24 + }
25 +
26 + if m2.Equal(m1) {
27 + t.Error("should not be equal")
28 + }
29 +
30 + if !m2.Equal(m3) {
31 + t.Error("should be equal")
32 + }
33 +
34 + if !m3.Equal(m2) {
35 + t.Error("should be equal")
36 + }
37 +
38 + if !m1.Equal(m1) {
39 + t.Error("should be equal")
40 + }
41 +}
42 +
43 func TestStringToBytes(t *testing.T) {
44
45 testString := func(s string, h string) {
crypto/spipe/message.pb.go
+1 -1
@@ -14,7 +14,7 @@ It has these top-level messages:
14 */
15 package spipe
16
17 -import proto "code.google.com/p/gogoprotobuf/proto"
17 +import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
18 import json "encoding/json"
19 import math "math"
20
routing/dht/messages.pb.go
+1 -1
@@ -13,7 +13,7 @@ It has these top-level messages:
13 */
14 package dht
15
16 -import proto "code.google.com/p/gogoprotobuf/proto"
16 +import proto "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/gogoprotobuf/proto"
17 import json "encoding/json"
18 import math "math"
19