func isUsernameValid(username string) bool {
	invalidRunes := []rune{'@', '/', '\'', '"', ':', '<', '>'}
	return strings.IndexFunc(username, isInvalid(invalidRunes)) < 0
}
============================================================================
Helpers, for parsing / validation
package stanza
import (
	"fmt"
	"strings"
	"unicode"
)
type Jid struct {
	Node     string
	Domain   string
	Resource string
}
func NewJid(sjid string) (*Jid, error) {
	jid := new(Jid)
	if sjid == "" {
		return jid, fmt.Errorf("jid cannot be empty")
	}
	s1 := strings.SplitN(sjid, "@", 2)
	if len(s1) == 1 {  
		jid.Domain = s1[0]
	} else {  
		if s1[0] == "" {
			return jid, fmt.Errorf("invalid jid '%s", sjid)
		}
		jid.Node = s1[0]
		if s1[1] == "" {
			return jid, fmt.Errorf("domain cannot be empty")
		}
		jid.Domain = s1[1]
	}
	s2 := strings.SplitN(jid.Domain, "/", 2)
	if len(s2) == 2 {  
		jid.Domain = s2[0]
		jid.Resource = s2[1]
	}
	if !isUsernameValid(jid.Node) {
		return jid, fmt.Errorf("invalid Node in Jid '%s'", sjid)
	}
	if !isDomainValid(jid.Domain) {
		return jid, fmt.Errorf("invalid domain in Jid '%s'", sjid)
	}
	return jid, nil
}
func (j *Jid) Full() string {
	return j.Node + "@" + j.Domain + "/" + j.Resource
}
func (j *Jid) Bare() string {
	return j.Node + "@" + j.Domain
}