libp2p QUIC and NAT traversal features (#251)

Enables additional libp2p NAT traversal features and enables nodes to communicate using UDP/QUIC in addition to TCP. Switches to using libp2p's "routed host". Most commands that previously accepted multiaddress values now accept a Peer IDs instead.
This commit is contained in:
Dmitry Holodov
2022-12-19 18:25:24 -06:00
committed by GitHub
parent 5a4ccb332f
commit ed15ed9c82
60 changed files with 1643 additions and 1342 deletions

View File

@@ -450,7 +450,7 @@ func createWalletRPCService(conf *WalletClientConf) (*os.Process, error) {
if conf.WalletPort == 0 {
var err error
conf.WalletPort, err = getFreePort()
conf.WalletPort, err = getFreeTCPPort()
if err != nil {
return nil, err
}
@@ -591,10 +591,10 @@ func getWalletRPCFlags(conf *WalletClientConf) []string {
return args
}
// getFreePort returns an OS allocated and immediately freed port. There is nothing preventing
// getFreeTCPPort returns an OS allocated and immediately freed port. There is nothing preventing
// something else on the system from using the port before the caller has a chance, but OS
// allocated ports are randomised to make the risk negligible.
func getFreePort() (uint, error) {
func getFreeTCPPort() (uint, error) {
ln, err := net.Listen("tcp", "127.0.0.1:0")
defer func() { _ = ln.Close() }()
if err != nil {

View File

@@ -270,7 +270,7 @@ func Test_validateMonerodConfig_misMatchedEnv(t *testing.T) {
}
func Test_validateMonerodConfig_invalidPort(t *testing.T) {
nonUsedPort, err := getFreePort()
nonUsedPort, err := getFreeTCPPort()
require.NoError(t, err)
err = validateMonerodConfig(common.Development, "127.0.0.1", nonUsedPort)
require.Error(t, err)