Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
d59ca83d
Commit
d59ca83d
authored
Oct 24, 2018
by
Steven Allen
Browse files
switch to DisablePing instead of PingCustom
parent
7eaeeaa9
Changes
3
Show whitespace changes
Inline
Side-by-side
config/config.go
View file @
d59ca83d
...
...
@@ -57,8 +57,7 @@ type Config struct {
Peerstore
pstore
.
Peerstore
Reporter
metrics
.
Reporter
PingCustom
bool
Ping
bool
DisablePing
bool
}
// NewNode constructs a new libp2p Host from the Config.
...
...
@@ -105,7 +104,7 @@ func (cfg *Config) NewNode(ctx context.Context) (host.Host, error) {
ConnManager
:
cfg
.
ConnManager
,
AddrsFactory
:
cfg
.
AddrsFactory
,
NATManager
:
cfg
.
NATManager
,
EnablePing
:
cfg
.
Ping
,
EnablePing
:
!
cfg
.
Disable
Ping
,
})
if
err
!=
nil
{
swrm
.
Close
()
...
...
defaults.go
View file @
d59ca83d
...
...
@@ -75,11 +75,6 @@ var DefaultEnableRelay = func(cfg *Config) error {
return
cfg
.
Apply
(
EnableRelay
())
}
// DefaultEnablePing enables the ping service by default
var
DefaultEnablePing
=
func
(
cfg
*
Config
)
error
{
return
cfg
.
Apply
(
Ping
(
true
))
}
// Complete list of default options and when to fallback on them.
//
// Please *DON'T* specify default options any other way. Putting this all here
...
...
@@ -116,10 +111,6 @@ var defaults = []struct {
fallback
:
func
(
cfg
*
Config
)
bool
{
return
!
cfg
.
RelayCustom
},
opt
:
DefaultEnableRelay
,
},
{
fallback
:
func
(
cfg
*
Config
)
bool
{
return
!
cfg
.
PingCustom
},
opt
:
DefaultEnablePing
,
},
}
// Defaults configures libp2p to use the default options. Can be combined with
...
...
options.go
View file @
d59ca83d
...
...
@@ -255,8 +255,7 @@ func NATManager(nm config.NATManagerC) Option {
// Ping will configure libp2p to support the ping service; enable by default.
func
Ping
(
enable
bool
)
Option
{
return
func
(
cfg
*
Config
)
error
{
cfg
.
PingCustom
=
true
cfg
.
Ping
=
enable
cfg
.
DisablePing
=
!
enable
return
nil
}
}
...
...
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