func (server *Server) SetupEventsPropagations() {
	for {
		ev := <-events.EventQueue
		server.RunModulesByEvents(ev)
	}
}
SetupEventsPropagations will listen on the EventsQueue.
package server
import (
	"bufio"
	"crypto/tls"
	"encoding/gob"
	"errors"
	"io"
	"net"
	"strings"
	"github.com/netm4ul/netm4ul/core/communication"
	"github.com/netm4ul/netm4ul/core/config"
	"github.com/netm4ul/netm4ul/core/database"
	"github.com/netm4ul/netm4ul/core/database/models"
	"github.com/netm4ul/netm4ul/core/events"
	"github.com/netm4ul/netm4ul/core/session"
	log "github.com/sirupsen/logrus"
)
type Server struct {
	Session *session.Session
	Db      models.Database
}
func CreateServer(s *session.Session) *Server {
	server := Server{Session: s}
	db, err := database.NewDatabase(&server.Session.Config)
	if err != nil || db == nil {
		panic(err)
	}
	server.Db = db
	server.Session.Nodes = make(map[string]communication.Node, 0)
	server.Session.Config.Modules = make(map[string]config.Module)
	go server.SetupEventsPropagations()
	return &server
}
func (server *Server) Listen() {
	ipport := server.Session.GetServerIPPort()
	var err error
	var l net.Listener
	if server.Session.Config.TLSParams.UseTLS {
		l, err = tls.Listen("tcp", ipport, server.Session.Config.TLSParams.TLSConfig)
	} else {
		l, err = net.Listen("tcp", ipport)
	}
	if err != nil {
		log.Fatalf("Error listening : %s", err.Error())
	}
	defer l.Close()
	log.Infof("Listenning on : %s", ipport)
	for {
		conn, err := l.Accept()
		if err != nil {
			log.Fatalf("Error accepting : %s", err.Error())
		}
		go server.handleRequest(conn)
	}
}