func Hostname(host string) string {
	_, _, hostname := Split(host)
	return hostname
}
Hostname returns the host of the host.
package irc
import (
	"regexp"
	"strings"
)
var (
	rgxHost = regexp.MustCompile(
		`(?i)^` +
			`([\w\x5B-\x60][\w\d\x5B-\x60]*)` +  
			`!([^\0@\s]+)` +  
			`@([^\0\s]+)` +  
			`$`,
	)
	rgxMask = regexp.MustCompile(
		`(?i)^` +
			`([\w\x5B-\x60\?\*][\w\d\x5B-\x60\?\*]*)` +  
			`!([^\0@\s]+)` +  
			`@([^\0\s]+)` +  
			`$`,
	)
)
type Host string
func (h Host) Nick() string {
	return Nick(string(h))
}
func (h Host) Username() string {
	return Username(string(h))
}
func (h Host) Hostname() string {
	return Hostname(string(h))
}
func (h Host) Split() (nick, user, hostname string) {
	return Split(string(h))
}
func (h Host) String() string {
	return string(h)
}
func (h Host) IsValid() bool {
	return rgxHost.MatchString(string(h))
}
type Mask string
func (m Mask) Match(h Host) bool {
	return isMatch(string(h), string(m))
}
func (m Mask) IsValid() bool {
	return rgxMask.MatchString(string(m))
}
func (m Mask) Split() (nick, user, host string) {
	fragments := rgxMask.FindStringSubmatch(string(m))
	if len(fragments) == 0 {
		return
	}
	return fragments[1], fragments[2], fragments[3]
}
func (h Host) Match(m Mask) bool {
	return isMatch(string(h), string(m))
}
func isMatch(hs, ms string) bool {
	ml, hl := len(ms), len(hs)
	if ml == 0 {
		return hl == 0
	}
	var i, j, consume = 0, 0, 0
	for i < ml && j < hl {
		switch ms[i] {
		case '?', '*':
			star := false
			consume = 0
			for i < ml && (ms[i] == '*' || ms[i] == '?') {
				star = star || ms[i] == '*'
				i++
				consume++
			}
			if star {
				consume = -1
			}
		case hs[j]:
			consume = 0
			i++
			j++
		default:
			if consume != 0 {
				consume--
				j++
			} else {
				return false
			}
		}
	}
	for i < ml && (ms[i] == '?' || ms[i] == '*') {
		i++
	}
	if consume < 0 {
		consume = hl - j
	}
	j += consume
	if i < ml || j < hl {
		return false
	}
	return true
}
func Nick(host string) string {
	index := strings.IndexAny(host, "!@")
	if index >= 0 {
		return host[:index]
	}
	return host
}
func Username(host string) string {
	_, user, _ := Split(host)
	return user
}