func (p *UserAgent) Bot() bool {
	return p.bot
}
Bot returns true if it's a bot, false otherwise.
package user_agent
import "strings"
type section struct {
	name    string
	version string
	comment []string
}
type UserAgent struct {
	ua           string
	mozilla      string
	platform     string
	os           string
	localization string
	browser      Browser
	bot          bool
	mobile       bool
	undecided    bool
}
func readUntil(ua string, index *int, delimiter byte, cat bool) []byte {
	var buffer []byte
	i := *index
	catalan := 0
	for ; i < len(ua); i = i + 1 {
		if ua[i] == delimiter {
			if catalan == 0 {
				*index = i + 1
				return buffer
			}
			catalan--
		} else if cat && ua[i] == '(' {
			catalan++
		}
		buffer = append(buffer, ua[i])
	}
	*index = i + 1
	return buffer
}
func parseProduct(product []byte) (string, string) {
	prod := strings.SplitN(string(product), "/", 2)
	if len(prod) == 2 {
		return prod[0], prod[1]
	}
	return string(product), ""
}
func parseSection(ua string, index *int) (s section) {
	var buffer []byte
	if *index < len(ua) && ua[*index] != '(' && ua[*index] != '[' {
		buffer = readUntil(ua, index, ' ', false)
		s.name, s.version = parseProduct(buffer)
	}
	if *index < len(ua) && ua[*index] == '(' {
		*index++
		buffer = readUntil(ua, index, ')', true)
		s.comment = strings.Split(string(buffer), "; ")
		*index++
	}
	if *index < len(ua) && ua[*index] == '[' {
		*index++
		buffer = readUntil(ua, index, ']', true)
		*index++
	}
	return s
}
func (p *UserAgent) initialize() {
	p.ua = ""
	p.mozilla = ""
	p.platform = ""
	p.os = ""
	p.localization = ""
	p.browser.Engine = ""
	p.browser.EngineVersion = ""
	p.browser.Name = ""
	p.browser.Version = ""
	p.bot = false
	p.mobile = false
	p.undecided = false
}
func New(ua string) *UserAgent {
	o := &UserAgent{}
	o.Parse(ua)
	return o
}
func (p *UserAgent) Parse(ua string) {
	var sections []section
	p.initialize()
	p.ua = ua
	for index, limit := 0, len(ua); index < limit; {
		s := parseSection(ua, &index)
		if !p.mobile && s.name == "Mobile" {
			p.mobile = true
		}
		sections = append(sections, s)
	}
	if len(sections) > 0 {
		if sections[0].name == "Mozilla" {
			p.mozilla = sections[0].version
		}
		p.detectBrowser(sections)
		p.detectOS(sections[0])
		if p.undecided {
			p.checkBot(sections)
		}
	}
}
func (p *UserAgent) Mozilla() string {
	return p.mozilla
}