mirror of
https://github.com/AthanorLabs/atomic-swap.git
synced 2026-01-09 14:18:03 -05:00
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:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user