示例#1
0
import (
	"net/http"
	"os"

	"github.com/gorilla/context"
	"maunium.net/go/mauirc-server/interfaces"
	"maunium.net/go/mauirc-server/web/auth"
	"maunium.net/go/mauirc-server/web/misc"
	"maunium.net/go/mauirc-server/web/socket"
	"maunium.net/go/mauirc-server/web/util"
	"maunium.net/go/maulogger"
)

var config interfaces.Configuration
var log = maulogger.CreateSublogger("Web", maulogger.LevelInfo)

// Load the web server
func Load(c interfaces.Configuration) {
	log.Debugln("Loading HTTP server")
	config = c
	auth.InitStore(config)
	misc.Init(config)
	util.Init(config)

	http.HandleFunc("/history/", misc.History)
	http.HandleFunc("/script/", misc.Script)
	http.HandleFunc("/network/", misc.Network)
	http.HandleFunc("/settings/", misc.Settings)
	http.HandleFunc("/auth/login", auth.Login)
	http.HandleFunc("/auth/confirm", auth.EmailConfirm)
示例#2
0
import (
	"bufio"
	"fmt"
	"net"
	"strconv"
	"strings"

	interfaces "maunium.net/go/mauirc-server/interfaces"
	"maunium.net/go/maulogger"
)

// Ports is the port->name mapping
var Ports = make(map[int]string)
var ln net.Listener
var log = maulogger.CreateSublogger("IDENT", maulogger.LevelInfo)

// Load the IDENTd
func Load(config interfaces.IdentConf) error {
	var ipport = fmt.Sprintf("%s:%d", config.IP, config.Port)
	var err error
	ln, err = net.Listen("tcp", ipport)
	if err != nil {
		return err
	}
	return nil
}

// Listen to incoming connections
func Listen() {
	for {