Repository: ethereum/go-ethereum (language: go)

Issue:
dumpconfig produces invalid NAT toml
#### System information
Geth version: `v1.15.1`

#### Expected behaviour
v1.15.0 added support to configuring `Node.P2P.NAT` in `config.toml`. 

Given a `config.toml` with a NAT value configured, one expects that `geth dumpconfig` would produce valid toml with the same NAT configured. 

#### Actual behaviour
It produces invalid toml that cannot be used a config.

#### Steps to reproduce the behaviour
config.toml:
```
[Node.P2P]
NAT = "extip:1.2.3.4"
```

Run dumpconfig:
```
docker run --volume=./config.toml:/tmp/config.toml ethereum/client-go:v1.15.1 dumpconfig --config=/tmp/config.toml
```

Produces invalid toml that contains:
```

[Node.P2P.NAT]
Interface = "extip:1.2.3.4"

```

Note that running dumpconfig with legacy `--nat=expip:1.2.3.4` cli flag the output is correct.


Discussion / hints:

Fix patch:
diff --git a/p2p/config.go b/p2p/config.go
index 5ea62e12f5bb..68a9c0bb5f2b 100644
--- a/p2p/config.go
+++ b/p2p/config.go
@@ -18,6 +18,7 @@ package p2p
 
 import (
 	"crypto/ecdsa"
+	"encoding"
 	"fmt"
 
 	"github.com/ethereum/go-ethereum/common/mclock"
@@ -135,6 +136,13 @@ type configNAT struct {
 	nat.Interface
 }
 
+func (w *configNAT) MarshalText() ([]byte, error) {
+	if tm, ok := w.Interface.(encoding.TextMarshaler); ok {
+		return tm.MarshalText()
+	}
+	return nil, fmt.Errorf("NAT specification %#v cannot be marshaled", w.Interface)
+}
+
 func (w *configNAT) UnmarshalText(input []byte) error {
 	n, err := nat.Parse(string(input))
 	if err != nil {


Test patch: