config: rename skip_upnp to upnp (#1827)
* config: rename skip_upnp to upnp Change default option to enable upnp. Closes #1806 * doc updates - fix comment and set UPNP to false in TestP2PConfig - add UPNP to config template - update changelog
This commit is contained in:
parent
aa20c45ae9
commit
b1d6deaf0b
|
@ -3,18 +3,17 @@
|
|||
## TBD
|
||||
|
||||
BUG FIXES:
|
||||
|
||||
- [rpc] limited number of HTTP/WebSocket connections
|
||||
(`rpc.max_open_connections`) and gRPC connections
|
||||
(`rpc.grpc_max_open_connections`). Check out [Running In
|
||||
Production](https://tendermint.readthedocs.io/en/master/running-in-production.html)
|
||||
guide if you want to increase them.
|
||||
|
||||
## 0.21.2
|
||||
|
||||
BREAKING CHANGES:
|
||||
- [config] Rename `skip_upnp` to `upnp`, and turn it off by default.
|
||||
|
||||
IMPROVEMENT
|
||||
|
||||
- [rpc/client] Supports https and wss now
|
||||
- [rpc/client] Supports https and wss now.
|
||||
|
||||
## 0.21.0
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ func AddNodeFlags(cmd *cobra.Command) {
|
|||
cmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)")
|
||||
cmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma-delimited ID@host:port seed nodes")
|
||||
cmd.Flags().String("p2p.persistent_peers", config.P2P.PersistentPeers, "Comma-delimited ID@host:port persistent peers")
|
||||
cmd.Flags().Bool("p2p.skip_upnp", config.P2P.SkipUPNP, "Skip UPNP configuration")
|
||||
cmd.Flags().Bool("p2p.upnp", config.P2P.UPNP, "Enable/disable UPNP port forwarding")
|
||||
cmd.Flags().Bool("p2p.pex", config.P2P.PexReactor, "Enable/disable Peer-Exchange")
|
||||
cmd.Flags().Bool("p2p.seed_mode", config.P2P.SeedMode, "Enable/disable seed mode")
|
||||
cmd.Flags().String("p2p.private_peer_ids", config.P2P.PrivatePeerIDs, "Comma-delimited private peer IDs")
|
||||
|
|
|
@ -284,8 +284,8 @@ type P2PConfig struct {
|
|||
// Do not add private peers to this list if you don't want them advertised
|
||||
PersistentPeers string `mapstructure:"persistent_peers"`
|
||||
|
||||
// Skip UPNP port forwarding
|
||||
SkipUPNP bool `mapstructure:"skip_upnp"`
|
||||
// UPNP port forwarding
|
||||
UPNP bool `mapstructure:"upnp"`
|
||||
|
||||
// Path to address book
|
||||
AddrBook string `mapstructure:"addr_book_file"`
|
||||
|
@ -341,6 +341,7 @@ type P2PConfig struct {
|
|||
func DefaultP2PConfig() *P2PConfig {
|
||||
return &P2PConfig{
|
||||
ListenAddress: "tcp://0.0.0.0:26656",
|
||||
UPNP: false,
|
||||
AddrBook: defaultAddrBookPath,
|
||||
AddrBookStrict: true,
|
||||
MaxNumPeers: 50,
|
||||
|
@ -363,7 +364,6 @@ func DefaultP2PConfig() *P2PConfig {
|
|||
func TestP2PConfig() *P2PConfig {
|
||||
cfg := DefaultP2PConfig()
|
||||
cfg.ListenAddress = "tcp://0.0.0.0:36656"
|
||||
cfg.SkipUPNP = true
|
||||
cfg.FlushThrottleTimeout = 10
|
||||
cfg.AllowDuplicateIP = true
|
||||
return cfg
|
||||
|
|
|
@ -149,6 +149,9 @@ seeds = "{{ .P2P.Seeds }}"
|
|||
# Do not add private peers to this list if you don't want them advertised
|
||||
persistent_peers = "{{ .P2P.PersistentPeers }}"
|
||||
|
||||
# UPNP port forwarding
|
||||
upnp = {{ .P2P.UPNP }}
|
||||
|
||||
# Path to address book
|
||||
addr_book_file = "{{ js .P2P.AddrBook }}"
|
||||
|
||||
|
|
|
@ -103,6 +103,9 @@ seeds = ""
|
|||
# Do not add private peers to this list if you don't want them advertised
|
||||
persistent_peers = ""
|
||||
|
||||
# UPNP port forwarding
|
||||
upnp = false
|
||||
|
||||
# Path to address book
|
||||
addr_book_file = "addrbook.json"
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
|
||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
amino "github.com/tendermint/go-amino"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
dbm "github.com/tendermint/tmlibs/db"
|
||||
"github.com/tendermint/tmlibs/log"
|
||||
|
@ -427,7 +427,7 @@ func (n *Node) OnStart() error {
|
|||
|
||||
// Create & add listener
|
||||
protocol, address := cmn.ProtocolAndAddress(n.config.P2P.ListenAddress)
|
||||
l := p2p.NewDefaultListener(protocol, address, n.config.P2P.SkipUPNP, n.Logger.With("module", "p2p"))
|
||||
l := p2p.NewDefaultListener(protocol, address, n.config.P2P.UPNP, n.Logger.With("module", "p2p"))
|
||||
n.sw.AddListener(l)
|
||||
|
||||
// Generate node PrivKey
|
||||
|
|
|
@ -47,8 +47,8 @@ func splitHostPort(addr string) (host string, port int) {
|
|||
return host, port
|
||||
}
|
||||
|
||||
// skipUPNP: If true, does not try getUPNPExternalAddress()
|
||||
func NewDefaultListener(protocol string, lAddr string, skipUPNP bool, logger log.Logger) Listener {
|
||||
// UPNP: If false, does not try getUPNPExternalAddress()
|
||||
func NewDefaultListener(protocol string, lAddr string, UPNP bool, logger log.Logger) Listener {
|
||||
// Local listen IP & port
|
||||
lAddrIP, lAddrPort := splitHostPort(lAddr)
|
||||
|
||||
|
@ -79,7 +79,7 @@ func NewDefaultListener(protocol string, lAddr string, skipUPNP bool, logger log
|
|||
|
||||
// Determine external address...
|
||||
var extAddr *NetAddress
|
||||
if !skipUPNP {
|
||||
if UPNP {
|
||||
// If the lAddrIP is INADDR_ANY, try UPnP
|
||||
if lAddrIP == "" || lAddrIP == "0.0.0.0" {
|
||||
extAddr = getUPNPExternalAddress(lAddrPort, listenerPort, logger)
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
|
||||
func TestListener(t *testing.T) {
|
||||
// Create a listener
|
||||
l := NewDefaultListener("tcp", ":8001", true, log.TestingLogger())
|
||||
l := NewDefaultListener("tcp", ":8001", false, log.TestingLogger())
|
||||
|
||||
// Dial the listener
|
||||
lAddr := l.ExternalAddress()
|
||||
|
|
|
@ -109,7 +109,7 @@ func TestPEXReactorRunning(t *testing.T) {
|
|||
addOtherNodeAddrToAddrBook(2, 1)
|
||||
|
||||
for i, sw := range switches {
|
||||
sw.AddListener(p2p.NewDefaultListener("tcp", sw.NodeInfo().ListenAddr, true, logger.With("pex", i)))
|
||||
sw.AddListener(p2p.NewDefaultListener("tcp", sw.NodeInfo().ListenAddr, false, logger.With("pex", i)))
|
||||
|
||||
err := sw.Start() // start switch and reactors
|
||||
require.Nil(t, err)
|
||||
|
@ -232,7 +232,7 @@ func TestPEXReactorUsesSeedsIfNeeded(t *testing.T) {
|
|||
p2p.NewDefaultListener(
|
||||
"tcp",
|
||||
seed.NodeInfo().ListenAddr,
|
||||
true,
|
||||
false,
|
||||
log.TestingLogger(),
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue