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-swarm
Commits
fe415aed
Commit
fe415aed
authored
Nov 22, 2016
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose transport parameter to swarm creation
parent
388f3c19
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
swarm.go
swarm.go
+3
-3
swarm_net.go
swarm_net.go
+1
-1
No files found.
swarm.go
View file @
fe415aed
...
...
@@ -105,12 +105,12 @@ type Swarm struct {
func
NewSwarm
(
ctx
context
.
Context
,
listenAddrs
[]
ma
.
Multiaddr
,
local
peer
.
ID
,
peers
pstore
.
Peerstore
,
bwc
metrics
.
Reporter
)
(
*
Swarm
,
error
)
{
return
NewSwarmWithProtector
(
ctx
,
listenAddrs
,
local
,
peers
,
nil
,
bwc
)
return
NewSwarmWithProtector
(
ctx
,
listenAddrs
,
local
,
peers
,
nil
,
PSTransport
,
bwc
)
}
// NewSwarm constructs a Swarm, with a Chan.
func
NewSwarmWithProtector
(
ctx
context
.
Context
,
listenAddrs
[]
ma
.
Multiaddr
,
local
peer
.
ID
,
peers
pstore
.
Peerstore
,
protec
ipnet
.
Protector
,
bwc
metrics
.
Reporter
)
(
*
Swarm
,
error
)
{
peers
pstore
.
Peerstore
,
protec
ipnet
.
Protector
,
tpt
pst
.
Transport
,
bwc
metrics
.
Reporter
)
(
*
Swarm
,
error
)
{
listenAddrs
,
err
:=
filterAddrs
(
listenAddrs
)
if
err
!=
nil
{
...
...
@@ -125,7 +125,7 @@ func NewSwarmWithProtector(ctx context.Context, listenAddrs []ma.Multiaddr, loca
}
s
:=
&
Swarm
{
swarm
:
ps
.
NewSwarm
(
PSTranspor
t
),
swarm
:
ps
.
NewSwarm
(
tp
t
),
local
:
local
,
peers
:
peers
,
ctx
:
ctx
,
...
...
swarm_net.go
View file @
fe415aed
...
...
@@ -28,7 +28,7 @@ func NewNetwork(ctx context.Context, listen []ma.Multiaddr, local peer.ID,
func
NewNetworkWithProtector
(
ctx
context
.
Context
,
listen
[]
ma
.
Multiaddr
,
local
peer
.
ID
,
peers
pstore
.
Peerstore
,
protec
ipnet
.
Protector
,
bwc
metrics
.
Reporter
)
(
*
Network
,
error
)
{
s
,
err
:=
NewSwarmWithProtector
(
ctx
,
listen
,
local
,
peers
,
protec
,
bwc
)
s
,
err
:=
NewSwarmWithProtector
(
ctx
,
listen
,
local
,
peers
,
protec
,
PSTransport
,
bwc
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
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