code: func newTCPServerImpl(ctx context.Context, netType, spec string, loopback net.IP) (StreamServer, error) {
  	tcpAddr, err := net.ResolveTCPAddr(netType, spec)
  	if err != nil {
  		return nil, errors.Annotate(err, "could not resolve %q address %q", netType, spec).Err()
  	}
  
  	if tcpAddr.IP == nil {
  		tcpAddr.IP = loopback
  	}
  
  	return &listenerStreamServer{
  		Context: ctx,
  		address: fmt.Sprintf("%s:%s", netType, tcpAddr.String()),
  		gen: func() (net.Listener, string, error) {
  			l, err := net.ListenTCP(netType, tcpAddr)
  			if err != nil {
  				return nil, "", errors.Annotate(err, "failed to listen to %q address %q", netType, tcpAddr).Err()
  			}
  
  			addr := fmt.Sprintf("%s:%s", netType, l.Addr().String())
  			log.Fields{
  				"addr": addr,
  			}.Debugf(ctx, "Listening on %q stream server...", netType)
  			return l, addr, nil
  		},
  	}, nil
  }
docs: // Listen implements StreamServer.