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-blankhost
Commits
a35db1d1
Unverified
Commit
a35db1d1
authored
May 08, 2020
by
vyzo
Committed by
GitHub
May 08, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #44 from libp2p/feat/connmgr-option
add WithConnectionManager option to blankhost
parents
0fd46319
d685d71a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
2 deletions
+21
-2
blank.go
blank.go
+21
-2
No files found.
blank.go
View file @
a35db1d1
...
...
@@ -36,10 +36,29 @@ type BlankHost struct {
}
}
func
NewBlankHost
(
n
network
.
Network
)
*
BlankHost
{
type
config
struct
{
cmgr
connmgr
.
ConnManager
}
type
Option
=
func
(
cfg
*
config
)
func
WithConnectionManager
(
cmgr
connmgr
.
ConnManager
)
Option
{
return
func
(
cfg
*
config
)
{
cfg
.
cmgr
=
cmgr
}
}
func
NewBlankHost
(
n
network
.
Network
,
options
...
Option
)
*
BlankHost
{
cfg
:=
config
{
cmgr
:
&
connmgr
.
NullConnMgr
{},
}
for
_
,
opt
:=
range
options
{
opt
(
&
cfg
)
}
bh
:=
&
BlankHost
{
n
:
n
,
cmgr
:
&
connmgr
.
NullConnMgr
{}
,
cmgr
:
cfg
.
cmgr
,
mux
:
mstream
.
NewMultistreamMuxer
(),
eventbus
:
eventbus
.
NewBus
(),
}
...
...
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