code: func New(rootLogger *logrus.Logger, cfg *config.Gateway, r *Router) *Gateway {
  	logger := rootLogger.WithFields(logrus.Fields{"prefix": "gateway"})
  
  	cache, _ := lru.New(5000)
  	gw := &Gateway{
  		Channels: make(map[string]*config.ChannelInfo),
  		Message:  r.Message,
  		Router:   r,
  		Bridges:  make(map[string]*bridge.Bridge),
  		Config:   r.Config,
  		Messages: cache,
  		logger:   logger,
  	}
  	if err := gw.AddConfig(cfg); err != nil {
  		logger.Errorf("Failed to add configuration to gateway: %#v", err)
  	}
  	return gw
  }
docs: // New creates a new Gateway object associated with the specified router and
  // following the given configuration.