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
p2p
go-p2p-kad-dht
Commits
e21c73a5
Commit
e21c73a5
authored
Oct 06, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated multiaddr use across codebase
parent
84781abf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
9 deletions
+5
-9
Message.go
Message.go
+1
-5
dht_test.go
dht_test.go
+3
-3
ext_test.go
ext_test.go
+1
-1
No files found.
Message.go
View file @
e21c73a5
...
...
@@ -20,11 +20,7 @@ func peerToPBPeer(p *peer.Peer) *Message_Peer {
if
len
(
p
.
Addresses
)
==
0
||
p
.
Addresses
[
0
]
==
nil
{
pbp
.
Addr
=
proto
.
String
(
""
)
}
else
{
addr
,
err
:=
p
.
Addresses
[
0
]
.
String
()
if
err
!=
nil
{
//Temp: what situations could cause this?
panic
(
err
)
}
addr
:=
p
.
Addresses
[
0
]
.
String
()
pbp
.
Addr
=
&
addr
}
pid
:=
string
(
p
.
ID
)
...
...
dht_test.go
View file @
e21c73a5
...
...
@@ -43,8 +43,8 @@ func setupDHT(t *testing.T, p *peer.Peer) *IpfsDHT {
return
d
}
func
setupDHTS
(
n
int
,
t
*
testing
.
T
)
([]
*
ma
.
Multiaddr
,
[]
*
peer
.
Peer
,
[]
*
IpfsDHT
)
{
var
addrs
[]
*
ma
.
Multiaddr
func
setupDHTS
(
n
int
,
t
*
testing
.
T
)
([]
ma
.
Multiaddr
,
[]
*
peer
.
Peer
,
[]
*
IpfsDHT
)
{
var
addrs
[]
ma
.
Multiaddr
for
i
:=
0
;
i
<
n
;
i
++
{
a
,
err
:=
ma
.
NewMultiaddr
(
fmt
.
Sprintf
(
"/ip4/127.0.0.1/tcp/%d"
,
5000
+
i
))
if
err
!=
nil
{
...
...
@@ -67,7 +67,7 @@ func setupDHTS(n int, t *testing.T) ([]*ma.Multiaddr, []*peer.Peer, []*IpfsDHT)
return
addrs
,
peers
,
dhts
}
func
makePeer
(
addr
*
ma
.
Multiaddr
)
*
peer
.
Peer
{
func
makePeer
(
addr
ma
.
Multiaddr
)
*
peer
.
Peer
{
p
:=
new
(
peer
.
Peer
)
p
.
AddAddress
(
addr
)
sk
,
pk
,
err
:=
ci
.
GenerateKeyPair
(
ci
.
RSA
,
512
)
...
...
ext_test.go
View file @
e21c73a5
...
...
@@ -184,7 +184,7 @@ func TestGetFailures(t *testing.T) {
func
_randPeer
()
*
peer
.
Peer
{
p
:=
new
(
peer
.
Peer
)
p
.
ID
=
make
(
peer
.
ID
,
16
)
p
.
Addresses
=
[]
*
ma
.
Multiaddr
{
nil
}
p
.
Addresses
=
[]
ma
.
Multiaddr
{
nil
}
crand
.
Read
(
p
.
ID
)
return
p
}
...
...
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