frostfs-node/pkg/network/listen.go
Leonard Lyubich 44def45ff4 [#31] network: Make the address a separate type
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
2020-10-02 11:25:35 +03:00

18 lines
350 B
Go

package network
import (
"net"
"github.com/multiformats/go-multiaddr"
manet "github.com/multiformats/go-multiaddr-net"
)
// Listen announces on the local network address.
func Listen(addr multiaddr.Multiaddr) (net.Listener, error) {
mLis, err := manet.Listen(addr)
if err != nil {
return nil, err
}
return manet.NetListener(mLis), nil
}