Commit fc41d585 authored by Marten Seemann's avatar Marten Seemann
Browse files

use multiaddr.Encapsulate to create QUIC multiaddrs

parent 782b1004
...@@ -82,15 +82,14 @@ func (c *conn) Transport() tpt.Transport { ...@@ -82,15 +82,14 @@ func (c *conn) Transport() tpt.Transport {
return c.transport return c.transport
} }
// TODO: there must be a better way to do this
func quicMultiaddr(na net.Addr) (ma.Multiaddr, error) { func quicMultiaddr(na net.Addr) (ma.Multiaddr, error) {
udpMA, err := manet.FromNetAddr(na) udpMA, err := manet.FromNetAddr(na)
if err != nil { if err != nil {
return nil, err return nil, err
} }
quicMA, err := ma.NewMultiaddr(udpMA.String() + "/quic") quicMA, err := ma.NewMultiaddr("/quic")
if err != nil { if err != nil {
return nil, err return nil, err
} }
return quicMA, nil return udpMA.Encapsulate(quicMA), nil
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment