Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
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
836d042f
Commit
836d042f
authored
6 years ago
by
Abhishek Upperwal
Browse files
Options
Download
Email Patches
Plain Diff
added ipv6 + checking for default transport
parent
d104ff8d
master
2018-Q4-OKR
feat/protobuf
fix/473
fix/no-custom-field
fix/revert-correct-external-addr
multistream-ping
punching
v6.0.23
v6.0.22
v6.0.21
v6.0.20
v6.0.19
v6.0.18
v6.0.17
v6.0.16
v6.0.15
v6.0.14
v6.0.13
v6.0.12
v6.0.11
v6.0.10
v6.0.9
v6.0.8
v6.0.7
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
defaults.go
+14
-6
defaults.go
with
14 additions
and
6 deletions
+14
-6
defaults.go
View file @
836d042f
...
...
@@ -55,11 +55,19 @@ var RandomIdentity = func(cfg *Config) error {
// DefaultListenAddrs configures libp2p to use default listen address
var
DefaultListenAddrs
=
func
(
cfg
*
Config
)
error
{
defaultListenAddr
,
err
:=
multiaddr
.
NewMultiaddr
(
"/ip4/0.0.0.0/tcp/0"
)
default
IP4
ListenAddr
,
err
:=
multiaddr
.
NewMultiaddr
(
"/ip4/0.0.0.0/tcp/0"
)
if
err
!=
nil
{
return
err
}
return
cfg
.
Apply
(
ListenAddrs
(
defaultListenAddr
))
defaultIP6ListenAddr
,
err
:=
multiaddr
.
NewMultiaddr
(
"/ip6/0.0.0.0/tcp/0"
)
if
err
!=
nil
{
return
err
}
return
cfg
.
Apply
(
ListenAddrs
(
defaultIP4ListenAddr
,
defaultIP6ListenAddr
,
))
}
// Complete list of default options and when to fallback on them.
...
...
@@ -70,6 +78,10 @@ var defaults = []struct {
fallback
func
(
cfg
*
Config
)
bool
opt
Option
}{
{
fallback
:
func
(
cfg
*
Config
)
bool
{
return
cfg
.
Transports
==
nil
&&
cfg
.
ListenAddrs
==
nil
},
opt
:
DefaultListenAddrs
,
},
{
fallback
:
func
(
cfg
*
Config
)
bool
{
return
cfg
.
Transports
==
nil
},
opt
:
DefaultTransports
,
...
...
@@ -90,10 +102,6 @@ var defaults = []struct {
fallback
:
func
(
cfg
*
Config
)
bool
{
return
cfg
.
Peerstore
==
nil
},
opt
:
DefaultPeerstore
,
},
{
fallback
:
func
(
cfg
*
Config
)
bool
{
return
cfg
.
ListenAddrs
==
nil
},
opt
:
DefaultListenAddrs
,
},
}
// Defaults configures libp2p to use the default options. Can be combined with
...
...
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help