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
d685d71a
Commit
d685d71a
authored
May 08, 2020
by
Yusef Napora
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add WithConnectionManager option to blankhost
parent
c2cbee27
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 @
d685d71a
...
@@ -33,10 +33,29 @@ type BlankHost struct {
...
@@ -33,10 +33,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
{
bh
:=
&
BlankHost
{
n
:
n
,
n
:
n
,
cmgr
:
&
connmgr
.
NullConnMgr
{}
,
cmgr
:
cfg
.
cmgr
,
mux
:
mstream
.
NewMultistreamMuxer
(),
mux
:
mstream
.
NewMultistreamMuxer
(),
eventbus
:
eventbus
.
NewBus
(),
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