Skip to content

Commit

Permalink
Don't try and dial DNSADDR addresses (#343)
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous authored Nov 24, 2023
1 parent e363c49 commit 10514b1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package io.libp2p.transport.tcp

import io.libp2p.core.InternalErrorException
import io.libp2p.core.multiformats.Multiaddr
import io.libp2p.core.multiformats.Protocol.DNSADDR
import io.libp2p.core.multiformats.Protocol.IP4
import io.libp2p.core.multiformats.Protocol.IP6
import io.libp2p.core.multiformats.Protocol.TCP
Expand All @@ -27,7 +28,8 @@ open class TcpTransport(
override fun handles(addr: Multiaddr) =
handlesHost(addr) &&
addr.has(TCP) &&
!addr.has(WS)
!addr.has(WS) &&
!addr.has(DNSADDR)

override fun serverTransportBuilder(
connectionBuilder: ConnectionBuilder,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ class TcpTransportTest : TransportTests() {
"/ip4/0.0.0.0/tcp/1234",
"/ip6/fe80::6f77:b303:aa6e:a16/tcp/42",
"/dns4/localhost/tcp/9999",
"/dns6/localhost/tcp/9999",
"/dnsaddr/ipfs.io/tcp/97"
"/dns6/localhost/tcp/9999"
).map { Multiaddr(it) }

@JvmStatic
Expand Down

0 comments on commit 10514b1

Please sign in to comment.