Skip to content

Commit

Permalink
add default listen addresses for QUIC
Browse files Browse the repository at this point in the history
  • Loading branch information
marten-seemann committed Jun 24, 2022
1 parent 650c35a commit 252b33d
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,28 @@ var RandomIdentity = func(cfg *Config) error {

// DefaultListenAddrs configures libp2p to use default listen address.
var DefaultListenAddrs = func(cfg *Config) error {
defaultIP4ListenAddr, err := multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0")
defaultIP4TCPListenAddr, err := multiaddr.NewMultiaddr("/ip4/0.0.0.0/tcp/0")
if err != nil {
return err
}
defaultIP4QUICListenAddr, err := multiaddr.NewMultiaddr("/ip4/0.0.0.0/udp/0/quic")
if err != nil {
return err
}

defaultIP6ListenAddr, err := multiaddr.NewMultiaddr("/ip6/::/tcp/0")
defaultIP6TCPListenAddr, err := multiaddr.NewMultiaddr("/ip6/::/tcp/0")
if err != nil {
return err
}
defaultIP6QUICListenAddr, err := multiaddr.NewMultiaddr("/ip6/::/udp/0/quic")
if err != nil {
return err
}
return cfg.Apply(ListenAddrs(
defaultIP4ListenAddr,
defaultIP6ListenAddr,
defaultIP4TCPListenAddr,
defaultIP4QUICListenAddr,
defaultIP6TCPListenAddr,
defaultIP6QUICListenAddr,
))
}

Expand Down

0 comments on commit 252b33d

Please sign in to comment.