Go-libp2p with onion transport, panic: no good addresses

I am using GitHub - cpacia/go-onion-transport to try and connect peers over Tor but I cannot get passed this error when trying to connect two peers. There is also ERROR go-libp2p-swarm swarm_listen.go accept tcp 127.0.0.1:43553: use of closed network connection. Everything appears fine before the connection, Tor starts and create a hidden service, libp2p gets an identity and everything, I get a multiadder like this: /onion3/6ymbnuuu3z3ertz47edmsinxffuf2ofhasfxe3uklsdlh7ncy6ssgiad:53038/p2p/12D3KooWJPnpEUe74qcsUUHm6edQzQhvdGHWMBw2rqoCXznUiz8y
My connection code looks llike this:

peerHost, err := libp2p.New(context.Background(), transportOpt, addressOpt, libp2p.Ping(false), libp2p.Identity(libp2pPrivKey), libp2p.FallbackDefaults)
if len(os.Args) > 1 {

    addr, err := multiaddr.NewMultiaddr(os.Args[1])

    if err != nil {

        onionService.Close()

        torClient.Close()

        panic(err)

    }

    peer, err := peerstore.AddrInfoFromP2pAddr(addr)

    if err != nil {

        onionService.Close()

        torClient.Close()

        panic(err)

    }

    if err := peerHost.Connect(context.Background(), *peer); err != nil {

        onionService.Close()

        torClient.Close()

        panic(err)

    }

    fmt.Println("sending 5 ping messages to", addr)

    ch := pingService.Ping(context.Background(), peer.ID)

    for i := 0; i < 5; i++ {

        res := <-ch

        fmt.Println("pinged", addr, "in", res.RTT)

    }

    onionService.Close()

    torClient.Close()

}

I am running this on two different machines as well.
The error doesn’t provide any more information, can anyone help?

I’ve never used this one and have no idea why it’s failing, however I’ve wrote an other one that is I belive slightly easier to use:

Note for both transports, they don’t protect your privacy and are PoC or alpha software, they leak IP thru DNS and that just the first thing I’ve came up with.

Thanks, I will give yours a shot. Can you confirm that the connection code will work the same?

@Jorropo how do you get the entire multiaddress string? I see no way to get the onion address. Do you have an example that is usable?

I thought the problem may be from older versions of the libs so I updated everything :

github.com/libp2p/go-libp2p v0.17.0
github.com/libp2p/go-libp2p-core v0.13.0
github.com/multiformats/go-multiaddr v0.4.0

However that didn’t fix anything. Here are the debug logs if ANYONE can help.

2021-12-30T16:05:22.998-0800 DEBUG basichost basic/basic_host.go:314 failed to fetch local IPv6 address {“error”: “Element not found.”}
2021-12-30T16:05:23.001-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:109 ResolveUnspecifiedAddresses:[/onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003 /p2p-circuit] [/ip4/192.168.1.235 /ip6/::1 /ip4/127.0.0.1] [/onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003 /p2p-circuit]
2021-12-30T16:05:23.001-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:109 ResolveUnspecifiedAddresses:[/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003] [/ip4/192.168.1.235 /ip6/::1 /ip4/127.0.0.1] [/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003]
2021-12-30T16:06:01.379-0800 DEBUG basichost basic/basic_host.go:767 host 12D3KooWJPnpEUe74qcsUUHm6edQzQhvdGHWMBw2rqoCXznUiz8y dialing 12D3KooWDGJN3bo1dcwCzhUXLqYTvb67Mk65XDJntWragPWPzqB3
2021-12-30T16:06:01.379-0800 DEBUG swarm2 go-libp2p-swarm@v0.9.0/swarm_dial.go:242 dialing peer {“from”: “12D3KooWJPnpEUe74qcsUUHm6edQzQhvdGHWMBw2rqoCXznUiz8y”, “to”: “12D3KooWDGJN3bo1dcwCzhUXLqYTvb67Mk65XDJntWragPWPzqB3”}
2021-12-30T16:06:01.383-0800 DEBUG basichost basic/basic_host.go:314 failed to fetch local IPv6 address {“error”: “Element not found.”}
2021-12-30T16:06:01.383-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:121 InterfaceAddresses: from manet:[/ip6/fe80::38ac:1eba:e21e:58e5 /ip4/169.254.88.229 /ip4/192.168.137.1 /ip6/fe80::7070:2b84:6530:3b73 /ip4/192.168.1.235 /ip6/fe80::a8c1:3024:bf3e:efc3 /ip4/169.254.239.195 /ip6/fe80::d9af:5f2d:7976:27f /ip4/169.254.2.127 /ip6/fe80::99ae:d2e6:737c:143a /ip4/169.254.20.58 /ip6/fe80::15a6:2e29:f538:52fa /ip4/192.168.35.1 /ip6/::1 /ip4/127.0.0.1]
2021-12-30T16:06:01.383-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:133 InterfaceAddresses: usable:[/ip4/169.254.88.229 /ip4/192.168.137.1 /ip4/192.168.1.235 /ip4/169.254.239.195 /ip4/169.254.2.127 /ip4/169.254.20.58 /ip4/192.168.35.1 /ip6/::1 /ip4/127.0.0.1]
2021-12-30T16:06:01.383-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:109 ResolveUnspecifiedAddresses:[/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003] [/ip4/169.254.88.229 /ip4/192.168.137.1 /ip4/192.168.1.235 /ip4/169.254.239.195 /ip4/169.254.2.127 /ip4/169.254.20.58 /ip4/192.168.35.1 /ip6/::1 /ip4/127.0.0.1] [/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003]
2021-12-30T16:06:01.383-0800 DEBUG swarm2 go-libp2p-swarm@v0.9.0/swarm_dial.go:267 network for 12D3KooWJPnpEUe74qcsUUHm6edQzQhvdGHWMBw2rqoCXznUiz8y finished dialing 12D3KooWDGJN3bo1dcwCzhUXLqYTvb67Mk65XDJntWragPWPzqB3
2021-12-30T16:06:01.383-0800 DEBUG swarm2 go-libp2p-swarm@v0.9.0/limiter.go:209 [limiter] clearing all peer dials: 12D3KooWDGJN3bo1dcwCzhUXLqYTvb67Mk65XDJntWragPWPzqB3
Dec 30 16:06:01.000 [notice] Catching signal TERM, exiting cleanly.
2021-12-30T16:06:01.386-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:109 ResolveUnspecifiedAddresses:[/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003] [/ip4/192.168.1.235 /ip6/::1 /ip4/127.0.0.1] [/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003]
2021-12-30T16:06:01.389-0800 DEBUG basichost basic/basic_host.go:314 failed to fetch local IPv6 address {“error”: “Element not found.”}
2021-12-30T16:06:01.392-0800 DEBUG addrutil go-addr-util@v0.1.0/addr.go:109 ResolveUnspecifiedAddresses:[/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003] [/ip4/192.168.1.235 /ip6/::1 /ip4/127.0.0.1] [/p2p-circuit /onion3/xsuekqdtpxx5jsbbmgq3nk7msccvd2pgnwopsgq7adgf2boyhxrhgfyd:9003]
panic: no good addresses