diff --git a/multiaddr_test.go b/multiaddr_test.go index 261cba3..a0cf716 100644 --- a/multiaddr_test.go +++ b/multiaddr_test.go @@ -75,6 +75,7 @@ func TestConstructSucceeds(t *testing.T) { "/onion/timaq4ygg2iegci7:1234", "/onion/timaq4ygg2iegci7:80/http", "/udp/0", + "/dtls", "/tcp/0", "/sctp/0", "/udp/1234", @@ -84,6 +85,7 @@ func TestConstructSucceeds(t *testing.T) { "/tcp/65535", "/ipfs/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC", "/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC", + "/udp/1234/dtls", "/udp/1234/sctp/1234", "/udp/1234/udt", "/udp/1234/utp", @@ -93,6 +95,7 @@ func TestConstructSucceeds(t *testing.T) { "/p2p/QmcgpsyWgH8Y8ajJz1Cu72KnS5uo2Aa2LpzU7kinSupNKC/tcp/1234", "/ip4/127.0.0.1/udp/1234", "/ip4/127.0.0.1/udp/0", + "/ip4/127.0.0.1/udp/1234/dtls", "/ip4/127.0.0.1/tcp/1234", "/ip4/127.0.0.1/tcp/1234/", "/ip4/127.0.0.1/udp/1234/quic", diff --git a/protocols.go b/protocols.go index d466598..ba5428d 100644 --- a/protocols.go +++ b/protocols.go @@ -9,6 +9,7 @@ const ( P_IP4 = 0x0004 P_TCP = 0x0006 P_UDP = 0x0111 + P_DTLS = 0x0020 P_DCCP = 0x0021 P_IP6 = 0x0029 P_IP6ZONE = 0x002A @@ -49,6 +50,11 @@ var ( Path: false, Transcoder: TranscoderPort, } + protoDTLS = Protocol{ + Name: "dtls", + Code: P_DTLS, + VCode: CodeToVarint(P_DTLS), + } protoDCCP = Protocol{ Name: "dccp", Code: P_DCCP, @@ -134,6 +140,7 @@ func init() { protoIP4, protoTCP, protoUDP, + protoDTLS, protoDCCP, protoIP6, protoIP6ZONE,