func (s *Session) updateIrcPrefix() {
	s.ircPrefix = irc.Prefix{
		Name: s.Nick,
		User: s.Username,
		Host: fmt.Sprintf("robust/0x%x", s.Id.Id),
	}
}
updateIrcPrefix MUST be called whenever the Nick field changes.
package ircserver
import (
	"crypto/hmac"
	"crypto/sha256"
	"encoding/base64"
	"errors"
	"fmt"
	"log"
	"math"
	"net/url"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/prometheus/client_golang/prometheus"
	"github.com/robustirc/robustirc/internal/config"
	"github.com/robustirc/robustirc/internal/robust"
	"gopkg.in/sorcix/irc.v2"
)
const (
	maxNickLen    = "30"
	maxChannelLen = "32"
	letter = `\x41-\x5A\x61-\x7A`
	digit = `\x30-\x39`
	special = `\x5B-\x60\x7B-\x7D`
	chanstring = `\x01-\x06\x08-\x09\x0B-\x0C\x0E-\x1F\x21-\x2B\x2D-\x39\x3B-\xFF`
)
var (
	validNickRe    = regexp.MustCompile(`^[` + letter + special + `][` + letter + digit + special + `-]{0,` + maxNickLen + `}$`)
	validChannelRe = regexp.MustCompile(`^#[` + chanstring + `]{0,` + maxChannelLen + `}$`)
	ErrSessionNotYetSeen = errors.New("Session not yet seen")
	ErrNoSuchSession = errors.New("No such session")
	ErrSessionLimitReached = errors.New("MaxSessions limit reached")
	CursorEOF = errors.New("No more messages")
)
var (
	messagesProcessed = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: "irc",
			Name:      "messages_processed",
			Help:      "Number of messages processed by message command",
		},
		[]string{"command"},
	)
	captchasVerified = prometheus.NewCounter(
		prometheus.CounterOpts{
			Subsystem: "captcha",
			Name:      "captchas_verified",
			Help:      "Number of CAPTCHAs successfully verified",
		},
	)
	captchasFailed = prometheus.NewCounter(
		prometheus.CounterOpts{
			Subsystem: "captcha",
			Name:      "captchas_failed",
			Help:      "Number of non-empty CAPTCHAs which failed verification",
		},
	)
)
func init() {
	prometheus.MustRegister(messagesProcessed)
	prometheus.MustRegister(captchasVerified)
	prometheus.MustRegister(captchasFailed)
}
type lcChan string
type lcNick string
type Session struct {
	Id                robust.Id
	auth              string
	loggedIn          bool
	Nick              string
	Username          string
	Realname          string
	Channels          map[lcChan]bool
	LastActivity      time.Time
	LastNonPing       time.Time
	LastSolvedCaptcha time.Time
	Operator          bool
	AwayMsg           string
	Created           int64
	throttlingExponent int
	invitedTo map[lcChan]bool
	modes ['z']bool
	svid string
	Pass string
	Server bool
	lastClientMessageId uint64
	ircPrefix irc.Prefix
	deleted bool
	RemoteAddr string  
}