func Draw(gc draw2d.GraphicContext, x, y float64) {
	// set the fill and stroke color of the droid
	gc.SetFillColor(color.RGBA{0x44, 0xff, 0x44, 0xff})
	gc.SetStrokeColor(color.RGBA{0x44, 0x44, 0x44, 0xff})

	// set line properties
	gc.SetLineCap(draw2d.RoundCap)
	gc.SetLineWidth(5)

	// head
	gc.MoveTo(x+30, y+70)
	gc.ArcTo(x+80, y+70, 50, 50, 180*(math.Pi/180), 180*(math.Pi/180))
	gc.Close()
	gc.FillStroke()
	gc.MoveTo(x+60, y+25)
	gc.LineTo(x+50, y+10)
	gc.MoveTo(x+100, y+25)
	gc.LineTo(x+110, y+10)
	gc.Stroke()

	// left eye
	draw2dkit.Circle(gc, x+60, y+45, 5)
	gc.FillStroke()

	// right eye
	draw2dkit.Circle(gc, x+100, y+45, 5)
	gc.FillStroke()

	// body
	draw2dkit.RoundedRectangle(gc, x+30, y+75, x+30+100, y+75+90, 10, 10)
	gc.FillStroke()
	draw2dkit.Rectangle(gc, x+30, y+75, x+30+100, y+75+80)
	gc.FillStroke()

	// left arm
	draw2dkit.RoundedRectangle(gc, x+5, y+80, x+5+20, y+80+70, 10, 10)
	gc.FillStroke()

	// right arm
	draw2dkit.RoundedRectangle(gc, x+135, y+80, x+135+20, y+80+70, 10, 10)
	gc.FillStroke()

	// left leg
	draw2dkit.RoundedRectangle(gc, x+50, y+150, x+50+20, y+150+50, 10, 10)
	gc.FillStroke()

	// right leg
	draw2dkit.RoundedRectangle(gc, x+90, y+150, x+90+20, y+150+50, 10, 10)
	gc.FillStroke()
}

// Draw the droid on a certain position.


func ChecksumString32S(s string, seed uint32) uint32 {
	if len(s) == 0 {
		return Checksum32S(nil, seed)
	}
	ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
	return Checksum32S((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)], seed)
}

func ChecksumString32S ( s string , seed uint32 ) uint32 { if len ( s ) == 0 { return Checksum32S ( nil , seed ) } ss := ( * reflect . StringHeader ) ( unsafe . Pointer ( & s ) ) return Checksum32S ( ( * [ maxInt32 ] byte ) ( unsafe . Pointer ( ss . Data ) ) [ : len ( s ) : len ( s ) ] , seed ) }

// ChecksumString32S returns the checksum of the input data, without creating a copy, with the specific seed.

ChecksumString32S returns the checksum of the input data without creating a copy with the specific seed .


func ChecksumString64S(s string, seed uint64) uint64 {
	if len(s) == 0 {
		return Checksum64S(nil, seed)
	}

	ss := (*reflect.StringHeader)(unsafe.Pointer(&s))
	return Checksum64S((*[maxInt32]byte)(unsafe.Pointer(ss.Data))[:len(s):len(s)], seed)
}

func ChecksumString64S ( s string , seed uint64 ) uint64 { if len ( s ) == 0 { return Checksum64S ( nil , seed ) } ss := ( * reflect . StringHeader ) ( unsafe . Pointer ( & s ) ) return Checksum64S ( ( * [ maxInt32 ] byte ) ( unsafe . Pointer ( ss . Data ) ) [ : len ( s ) : len ( s ) ] , seed ) }

// ChecksumString64S returns the checksum of the input data, without creating a copy, with the specific seed.

ChecksumString64S returns the checksum of the input data without creating a copy with the specific seed .


func NewS32(seed uint32) (xx *XXHash32) {
	xx = &XXHash32{
		seed: seed,
	}
	xx.Reset()
	return
}

func NewS32 ( seed uint32 ) ( xx * XXHash32 ) { xx = & XXHash32 { seed : seed , } xx . Reset ( ) return }

// NewS32 creates a new hash.Hash32 computing the 32bit xxHash checksum starting with the specific seed.

NewS32 creates a new hash . Hash32 computing the 32bit xxHash checksum starting with the specific seed .


func NewS64(seed uint64) (xx *XXHash64) {
	xx = &XXHash64{
		seed: seed,
	}
	xx.Reset()
	return
}

func NewS64 ( seed uint64 ) ( xx * XXHash64 ) { xx = & XXHash64 { seed : seed , } xx . Reset ( ) return }

// NewS64 creates a new hash.Hash64 computing the 64bit xxHash checksum starting with the specific seed.

NewS64 creates a new hash . Hash64 computing the 64bit xxHash checksum starting with the specific seed .


func round64(h, v uint64) uint64 {
	h += v * prime64x2
	h = rotl64_31(h)
	h *= prime64x1
	return h
}

func round64 ( h , v uint64 ) uint64 { h += v * prime64x2 h = rotl64_31 ( h ) h *= prime64x1 return h }


func Checksum32S(in []byte, seed uint32) (h uint32) {
	var i int

	if len(in) > 15 {
		var (
			v1 = seed + prime32x1 + prime32x2
			v2 = seed + prime32x2
			v3 = seed + 0
			v4 = seed - prime32x1
		)
		for ; i < len(in)-15; i += 16 {
			in := in[i : i+16 : len(in)]
			v1 += u32(in[0:4:len(in)]) * prime32x2
			v1 = rotl32_13(v1) * prime32x1

			v2 += u32(in[4:8:len(in)]) * prime32x2
			v2 = rotl32_13(v2) * prime32x1

			v3 += u32(in[8:12:len(in)]) * prime32x2
			v3 = rotl32_13(v3) * prime32x1

			v4 += u32(in[12:16:len(in)]) * prime32x2
			v4 = rotl32_13(v4) * prime32x1
		}

		h = rotl32_1(v1) + rotl32_7(v2) + rotl32_12(v3) + rotl32_18(v4)

	} else {
		h = seed + prime32x5
	}

	h += uint32(len(in))
	for ; i <= len(in)-4; i += 4 {
		in := in[i : i+4 : len(in)]
		h += u32(in[0:4:len(in)]) * prime32x3
		h = rotl32_17(h) * prime32x4
	}

	for ; i < len(in); i++ {
		h += uint32(in[i]) * prime32x5
		h = rotl32_11(h) * prime32x1
	}

	h ^= h >> 15
	h *= prime32x2
	h ^= h >> 13
	h *= prime32x3
	h ^= h >> 16

	return
}

func Checksum32S ( in [ ] byte , seed uint32 ) ( h uint32 ) { var i int if len ( in ) > 15 { var ( v1 = seed + prime32x1 + prime32x2 v2 = seed + prime32x2 v3 = seed + 0 v4 = seed - prime32x1 ) for ; i < len ( in ) - 15 ; i += 16 { in := in [ i : i + 16 : len ( in ) ] v1 += u32 ( in [ 0 : 4 : len ( in ) ] ) * prime32x2 v1 = rotl32_13 ( v1 ) * prime32x1 v2 += u32 ( in [ 4 : 8 : len ( in ) ] ) * prime32x2 v2 = rotl32_13 ( v2 ) * prime32x1 v3 += u32 ( in [ 8 : 12 : len ( in ) ] ) * prime32x2 v3 = rotl32_13 ( v3 ) * prime32x1 v4 += u32 ( in [ 12 : 16 : len ( in ) ] ) * prime32x2 v4 = rotl32_13 ( v4 ) * prime32x1 } h = rotl32_1 ( v1 ) + rotl32_7 ( v2 ) + rotl32_12 ( v3 ) + rotl32_18 ( v4 ) } else { h = seed + prime32x5 } h += uint32 ( len ( in ) ) for ; i <= len ( in ) - 4 ; i += 4 { in := in [ i : i + 4 : len ( in ) ] h += u32 ( in [ 0 : 4 : len ( in ) ] ) * prime32x3 h = rotl32_17 ( h ) * prime32x4 } for ; i < len ( in ) ; i ++ { h += uint32 ( in [ i ] ) * prime32x5 h = rotl32_11 ( h ) * prime32x1 } h ^= h >> 15 h *= prime32x2 h ^= h >> 13 h *= prime32x3 h ^= h >> 16 return }

// Checksum32S returns the checksum of the input bytes with the specific seed.

Checksum32S returns the checksum of the input bytes with the specific seed .


func Checksum64S(in []byte, seed uint64) uint64 {
	if len(in) == 0 && seed == 0 {
		return 0xef46db3751d8e999
	}

	if len(in) > 31 {
		return checksum64(in, seed)
	}

	return checksum64Short(in, seed)
}

func Checksum64S ( in [ ] byte , seed uint64 ) uint64 { if len ( in ) == 0 && seed == 0 { return 0xef46db3751d8e999 } if len ( in ) > 31 { return checksum64 ( in , seed ) } return checksum64Short ( in , seed ) }

// Checksum64S returns the 64bit xxhash checksum for a single input


func getStage() (stage int, advanceStage func() error, resetEnv func() error) {
	var origValue string
	stage = 0

	daemonStage := os.Getenv(stageVar)
	stageTag := strings.SplitN(daemonStage, ":", 2)
	stageInfo := strings.SplitN(stageTag[0], "/", 3)

	if len(stageInfo) == 3 {
		stageStr, tm, check := stageInfo[0], stageInfo[1], stageInfo[2]

		hash := sha1.New()
		hash.Write([]byte(stageStr + "/" + tm + "/"))

		if check != hex.EncodeToString(hash.Sum([]byte{})) {
			// This whole chunk is original data
			origValue = daemonStage
		} else {
			stage, _ = strconv.Atoi(stageStr)

			if len(stageTag) == 2 {
				origValue = stageTag[1]
			}
		}
	} else {
		origValue = daemonStage
	}

	advanceStage = func() error {
		base := fmt.Sprintf("%d/%09d/", stage+1, time.Now().Nanosecond())
		hash := sha1.New()
		hash.Write([]byte(base))
		tag := base + hex.EncodeToString(hash.Sum([]byte{}))

		if err := os.Setenv(stageVar, tag+":"+origValue); err != nil {
			return fmt.Errorf("can't set %s: %s", stageVar, err)
		}
		return nil
	}
	resetEnv = func() error {
		return os.Setenv(stageVar, origValue)
	}

	return stage, advanceStage, resetEnv
}

func
getStage
(
)
(
stage
int
,
advanceStage
func
(
)
error
,
resetEnv
func
(
)
error
)
{
var
origValue
string
stage
=
0
daemonStage
:=
os
.
Getenv
(
stageVar
)
stageTag
:=
strings
.
SplitN
(
daemonStage
,
"
"
,
2
)
stageInfo
:=
strings
.
SplitN
(
stageTag
[
0
]
,
"
"
,
3
)
if
len
(
stageInfo
)
==
3
{
stageStr
,
tm
,
check
:=
stageInfo
[
0
]
,
stageInfo
[
1
]
,
stageInfo
[
2
]
hash
:=
sha1
.
New
(
)
hash
.
Write
(
[
]
byte
(
stageStr
+
"
"
+
tm
+
"
"
)
)
if
check
!=
hex
.
EncodeToString
(
hash
.
Sum
(
[
]
byte
{
}
)
)
{
// This whole chunk is original data
origValue
=
daemonStage
}
else
{
stage
,
_
=
strconv
.
Atoi
(
stageStr
)
if
len
(
stageTag
)
==
2
{
origValue
=
stageTag
[
1
]
}
}
}
else
{
origValue
=
daemonStage
}
advanceStage
=
func
(
)
error
{
base
:=
fmt
.
Sprintf
(
"
"
,
stage
+
1
,
time
.
Now
(
)
.
Nanosecond
(
)
)
hash
:=
sha1
.
New
(
)
hash
.
Write
(
[
]
byte
(
base
)
)
tag
:=
base
+
hex
.
EncodeToString
(
hash
.
Sum
(
[
]
byte
{
}
)
)
if
err
:=
os
.
Setenv
(
stageVar
,
tag
+
"
"
+
origValue
)
;
err
!=
{
return
fmt
.
Errorf
(
"
"
,
stageVar
,
err
)
}
return
}
resetEnv
=
func
(
)
error
{
return
os
.
Setenv
(
stageVar
,
origValue
)
}
return
stage
,
advanceStage
,
resetEnv
}

// Returns the current stage in the "daemonization process", that's kept in
// an environment variable. The variable is instrumented with a digital
// signature, to avoid misbehavior if it was present in the user's
// environment. The original value is restored after the last stage, so that
// there's no final effect on the environment the application receives.

Returns the current stage in the daemonization process that s kept in an environment variable . The variable is instrumented with a digital signature to avoid misbehavior if it was present in the user s environment . The original value is restored after the last stage so that there s no final effect on the environment the application receives .


func New() *Glg {

	g := &Glg{
		levelCounter: new(uint32),
		buffer: sync.Pool{
			New: func() interface{} {
				return bytes.NewBuffer(make([]byte, 0, bufferSize))
			},
		},
	}

	atomic.StoreUint32(g.levelCounter, uint32(FATAL))

	for lev, log := range map[LEVEL]*logger{
		// standard out
		PRINT: {
			std:     os.Stdout,
			color:   Colorless,
			isColor: true,
			mode:    STD,
		},
		LOG: {
			std:     os.Stdout,
			color:   Colorless,
			isColor: true,
			mode:    STD,
		},
		INFO: {
			std:     os.Stdout,
			color:   Green,
			isColor: true,
			mode:    STD,
		},
		DEBG: {
			std:     os.Stdout,
			color:   Purple,
			isColor: true,
			mode:    STD,
		},
		OK: {
			std:     os.Stdout,
			color:   Cyan,
			isColor: true,
			mode:    STD,
		},
		WARN: {
			std:     os.Stdout,
			color:   Orange,
			isColor: true,
			mode:    STD,
		},
		// error out
		ERR: {
			std:     os.Stderr,
			color:   Red,
			isColor: true,
			mode:    STD,
		},
		FAIL: {
			std:     os.Stderr,
			color:   Red,
			isColor: true,
			mode:    STD,
		},
		FATAL: {
			std:     os.Stderr,
			color:   Red,
			isColor: true,
			mode:    STD,
		},
	} {
		log.tag = lev.String()
		log.updateMode()
		g.logger.Store(lev, log)
	}

	return g
}

func
New
(
)
*
Glg
{
g
:=
&
Glg
{
levelCounter
:
new
(
uint32
)
,
buffer
:
sync
.
Pool
{
New
:
func
(
)
interface
{
}
{
return
bytes
.
NewBuffer
(
make
(
[
]
byte
,
0
,
bufferSize
)
)
}
,
}
,
}
atomic
.
StoreUint32
(
g
.
levelCounter
,
uint32
(
FATAL
)
)
for
lev
,
log
:=
range
map
[
LEVEL
]
*
logger
{
// standard out
PRINT
:
{
std
:
os
.
Stdout
,
color
:
Colorless
,
isColor
:
true
,
mode
:
STD
,
}
,
LOG
:
{
std
:
os
.
Stdout
,
color
:
Colorless
,
isColor
:
true
,
mode
:
STD
,
}
,
INFO
:
{
std
:
os
.
Stdout
,
color
:
Green
,
isColor
:
true
,
mode
:
STD
,
}
,
DEBG
:
{
std
:
os
.
Stdout
,
color
:
Purple
,
isColor
:
true
,
mode
:
STD
,
}
,
OK
:
{
std
:
os
.
Stdout
,
color
:
Cyan
,
isColor
:
true
,
mode
:
STD
,
}
,
WARN
:
{
std
:
os
.
Stdout
,
color
:
Orange
,
isColor
:
true
,
mode
:
STD
,
}
,
// error out
ERR
:
{
std
:
os
.
Stderr
,
color
:
Red
,
isColor
:
true
,
mode
:
STD
,
}
,
FAIL
:
{
std
:
os
.
Stderr
,
color
:
Red
,
isColor
:
true
,
mode
:
STD
,
}
,
FATAL
:
{
std
:
os
.
Stderr
,
color
:
Red
,
isColor
:
true
,
mode
:
STD
,
}
,
}
{
log
.
tag
=
lev
.
String
(
)
log
.
updateMode
(
)
g
.
logger
.
Store
(
lev
,
log
)
}
return
g
}


func Get() *Glg {
	once.Do(func() {
		fastime.SetFormat(timeFormat)
		glg = New()
	})
	return glg
}

func Get ( ) * Glg { once . Do ( func ( ) { fastime . SetFormat ( timeFormat ) glg = New ( ) } ) return glg }


func (g *Glg) SetMode(mode MODE) *Glg {
	g.logger.Range(func(key, val interface{}) bool {
		l := val.(*logger)
		l.mode = mode
		l.updateMode()
		g.logger.Store(key.(LEVEL), l)
		return true
	})

	return g
}

func ( g * Glg ) SetMode ( mode MODE ) * Glg { g . logger . Range ( func ( key , val interface { } ) bool { l := val . ( * logger ) l . mode = mode l . updateMode ( ) g . logger . Store ( key . ( LEVEL ) , l ) return true } ) return g }


func (g *Glg) SetPrefix(pref string) *Glg {
	v, ok := g.logger.Load(PRINT)
	if ok {
		value := v.(*logger)
		value.tag = pref
		g.logger.Store(PRINT, value)
	}
	return g
}

func ( g * Glg ) SetPrefix ( pref string ) * Glg { v , ok := g . logger . Load ( PRINT ) if ok { value := v . ( * logger ) value . tag = pref g . logger . Store ( PRINT , value ) } return g }


func (g *Glg) GetCurrentMode(level LEVEL) MODE {
	l, ok := g.logger.Load(level)
	if ok {
		return l.(*logger).mode
	}
	return NONE
}

func ( g * Glg ) GetCurrentMode ( level LEVEL ) MODE { l , ok := g . logger . Load ( level ) if ok { return l . ( * logger ) . mode } return NONE }

// GetCurrentMode returns current logging mode


func (g *Glg) InitWriter() *Glg {
	g.logger.Range(func(key, val interface{}) bool {
		l := val.(*logger)
		l.writer = nil
		l.updateMode()
		g.logger.Store(key.(LEVEL), l)
		return true
	})
	return g
}

func ( g * Glg ) InitWriter ( ) * Glg { g . logger . Range ( func ( key , val interface { } ) bool { l := val . ( * logger ) l . writer = nil l . updateMode ( ) g . logger . Store ( key . ( LEVEL ) , l ) return true } ) return g }


func (g *Glg) SetWriter(writer io.Writer) *Glg {
	if writer == nil {
		return g
	}

	g.logger.Range(func(key, val interface{}) bool {
		l := val.(*logger)
		l.writer = writer
		l.updateMode()
		g.logger.Store(key.(LEVEL), l)
		return true
	})

	return g
}

func ( g * Glg ) SetWriter ( writer io . Writer ) * Glg { if writer == nil { return g } g . logger . Range ( func ( key , val interface { } ) bool { l := val . ( * logger ) l . writer = writer l . updateMode ( ) g . logger . Store ( key . ( LEVEL ) , l ) return true } ) return g }

// SetWriter sets writer to glg std writers


func (g *Glg) SetLevelColor(level LEVEL, color func(string) string) *Glg {
	lev, ok := g.logger.Load(level)
	if ok {
		l := lev.(*logger)
		l.color = color
		g.logger.Store(level, l)
	}

	return g
}

func ( g * Glg ) SetLevelColor ( level LEVEL , color func ( string ) string ) * Glg { lev , ok := g . logger . Load ( level ) if ok { l := lev . ( * logger ) l . color = color g . logger . Store ( level , l ) } return g }

// SetLevelColor sets the color for each level


func (g *Glg) SetLevelWriter(level LEVEL, writer io.Writer) *Glg {
	if writer == nil {
		return g
	}

	lev, ok := g.logger.Load(level)
	if ok {
		l := lev.(*logger)
		l.writer = writer
		l.updateMode()
		g.logger.Store(level, l)
	}

	return g
}

func ( g * Glg ) SetLevelWriter ( level LEVEL , writer io . Writer ) * Glg { if writer == nil { return g } lev , ok := g . logger . Load ( level ) if ok { l := lev . ( * logger ) l . writer = writer l . updateMode ( ) g . logger . Store ( level , l ) } return g }

// SetLevelWriter sets writer to glg std writer per logging level


func (g *Glg) AddStdLevel(tag string, mode MODE, isColor bool) *Glg {
	atomic.AddUint32(g.levelCounter, 1)
	lev := LEVEL(atomic.LoadUint32(g.levelCounter))
	g.levelMap.Store(tag, lev)
	l := &logger{
		writer:  nil,
		std:     os.Stdout,
		color:   Colorless,
		isColor: isColor,
		mode:    mode,
		tag:     tag,
	}
	l.updateMode()
	g.logger.Store(lev, l)
	return g
}

func ( g * Glg ) AddStdLevel ( tag string , mode MODE , isColor bool ) * Glg { atomic . AddUint32 ( g . levelCounter , 1 ) lev := LEVEL ( atomic . LoadUint32 ( g . levelCounter ) ) g . levelMap . Store ( tag , lev ) l := & logger { writer : nil , std : os . Stdout , color : Colorless , isColor : isColor , mode : mode , tag : tag , } l . updateMode ( ) g . logger . Store ( lev , l ) return g }

// AddStdLevel adds std log level and returns LEVEL


func (g *Glg) EnableColor() *Glg {

	g.logger.Range(func(key, val interface{}) bool {
		l := val.(*logger)
		l.isColor = true
		l.updateMode()
		g.logger.Store(key.(LEVEL), l)
		return true
	})

	return g
}

func ( g * Glg ) EnableColor ( ) * Glg { g . logger . Range ( func ( key , val interface { } ) bool { l := val . ( * logger ) l . isColor = true l . updateMode ( ) g . logger . Store ( key . ( LEVEL ) , l ) return true } ) return g }


func (g *Glg) EnableLevelColor(lv LEVEL) *Glg {
	ins, ok := g.logger.Load(lv)
	if ok {
		l := ins.(*logger)
		l.isColor = true
		l.updateMode()
		g.logger.Store(lv, l)
	}
	return g
}

func ( g * Glg ) EnableLevelColor ( lv LEVEL ) * Glg { ins , ok := g . logger . Load ( lv ) if ok { l := ins . ( * logger ) l . isColor = true l . updateMode ( ) g . logger . Store ( lv , l ) } return g }

// EnableLevelColor enables color output


func (g *Glg) DisableLevelColor(lv LEVEL) *Glg {
	ins, ok := g.logger.Load(lv)
	if ok {
		l := ins.(*logger)
		l.isColor = false
		l.updateMode()
		g.logger.Store(lv, l)
	}
	return g
}

func ( g * Glg ) DisableLevelColor ( lv LEVEL ) * Glg { ins , ok := g . logger . Load ( lv ) if ok { l := ins . ( * logger ) l . isColor = false l . updateMode ( ) g . logger . Store ( lv , l ) } return g }

// DisableLevelColor disables color output


func (g *Glg) RawString(data []byte) string {
	str := *(*string)(unsafe.Pointer(&data))
	return str[strings.Index(str, sep)+sepl : len(str)-rcl]
}

func ( g * Glg ) RawString ( data [ ] byte ) string { str := * ( * string ) ( unsafe . Pointer ( & data ) ) return str [ strings . Index ( str , sep ) + sepl : len ( str ) - rcl ] }

// RawString returns raw log string exclude time & tags


func (g *Glg) TagStringToLevel(tag string) LEVEL {
	l, ok := g.levelMap.Load(tag)
	if !ok {
		return 255
	}
	return l.(LEVEL)
}

func ( g * Glg ) TagStringToLevel ( tag string ) LEVEL { l , ok := g . levelMap . Load ( tag ) if ! ok { return 255 } return l . ( LEVEL ) }

// TagStringToLevel converts level string to Glg.LEVEL

TagStringToLevel converts level string to Glg . LEVEL


func Println(val ...interface{}) error {
	return glg.out(PRINT, blankFormat(len(val)), val...)
}

func Println ( val ... interface { } ) error { return glg . out ( PRINT , blankFormat ( len ( val ) ) , val ... ) }


func (g *Glg) Fatal(val ...interface{}) {
	err := g.out(FATAL, blankFormat(len(val)), val...)
	if err != nil {
		err = g.Error(err.Error())
		if err != nil {
			panic(err)
		}
	}
	exit(1)
}

func ( g * Glg ) Fatal ( val ... interface { } ) { err := g . out ( FATAL , blankFormat ( len ( val ) ) , val ... ) if err != nil { err = g . Error ( err . Error ( ) ) if err != nil { panic ( err ) } } exit ( 1 ) }

// Fatal outputs Failed log and exit program


func (g *Glg) Fatalf(format string, val ...interface{}) {
	err := g.out(FATAL, format, val...)
	if err != nil {
		err = g.Error(err.Error())
		if err != nil {
			panic(err)
		}
	}
	exit(1)
}

func ( g * Glg ) Fatalf ( format string , val ... interface { } ) { err := g . out ( FATAL , format , val ... ) if err != nil { err = g . Error ( err . Error ( ) ) if err != nil { panic ( err ) } } exit ( 1 ) }

// Fatalf outputs formatted Failed log and exit program


func (g *Glg) isModeEnable(l LEVEL) bool {
	return g.GetCurrentMode(l) != NONE
}

func ( g * Glg ) isModeEnable ( l LEVEL ) bool { return g . GetCurrentMode ( l ) != NONE }

// isModeEnable returns the level has already turned on the logging


func CaptureMetrics(hnd http.Handler, w http.ResponseWriter, r *http.Request) Metrics {
	return CaptureMetricsFn(w, func(ww http.ResponseWriter) {
		hnd.ServeHTTP(ww, r)
	})
}

func CaptureMetrics ( hnd http . Handler , w http . ResponseWriter , r * http . Request ) Metrics { return CaptureMetricsFn ( w , func ( ww http . ResponseWriter ) { hnd . ServeHTTP ( ww , r ) } ) }

// CaptureMetrics wraps the given hnd, executes it with the given w and r, and
// returns the metrics it captured from it.

CaptureMetrics wraps the given hnd executes it with the given w and r and returns the metrics it captured from it .


func (da *cedar) get(key []byte, from, pos int) *int {
	for ; pos < len(key); pos++ {
		if value := da.Array[from].Value; value >= 0 && value != ValueLimit {
			to := da.follow(from, 0)
			da.Array[to].Value = value
		}
		from = da.follow(from, key[pos])
	}
	to := from
	if da.Array[from].Value < 0 {
		to = da.follow(from, 0)
	}
	return &da.Array[to].Value
}

func ( da * cedar ) get ( key [ ] byte , from , pos int ) * int { for ; pos < len ( key ) ; pos ++ { if value := da . Array [ from ] . Value ; value >= 0 && value != ValueLimit { to := da . follow ( from , 0 ) da . Array [ to ] . Value = value } from = da . follow ( from , key [ pos ] ) } to := from if da . Array [ from ] . Value < 0 { to = da . follow ( from , 0 ) } return & da . Array [ to ] . Value }

// Get value by key, insert the key if not exist

Get value by key insert the key if not exist


func (da *Cedar) Save(out io.Writer, dataType string) error {
	switch dataType {
	case "gob", "GOB":
		dataEecoder := gob.NewEncoder(out)
		return dataEecoder.Encode(da.cedar)
	case "json", "JSON":
		dataEecoder := json.NewEncoder(out)
		return dataEecoder.Encode(da.cedar)
	}
	return ErrInvalidDataType
}

func ( da * Cedar ) Save ( out io . Writer , dataType string ) error { switch dataType { case " " , " " : dataEecoder := gob . NewEncoder ( out ) return dataEecoder . Encode ( da . cedar ) case " " , " " : dataEecoder := json . NewEncoder ( out ) return dataEecoder . Encode ( da . cedar ) } return ErrInvalidDataType }

// Save saves the cedar to an io.Writer,
// where dataType is either "json" or "gob".

Save saves the cedar to an io . Writer where dataType is either json or gob .


func (da *Cedar) SaveToFile(fileName string, dataType string) error {
	file, err := os.OpenFile(fileName, os.O_CREATE|os.O_WRONLY, 0666)
	if err != nil {
		return err
	}
	defer file.Close()
	out := bufio.NewWriter(file)
	defer out.Flush()
	da.Save(out, dataType)
	return nil
}

func ( da * Cedar ) SaveToFile ( fileName string , dataType string ) error { file , err := os . OpenFile ( fileName , os . O_CREATE | os . O_WRONLY , 0666 ) if err != nil { return err } defer file . Close ( ) out := bufio . NewWriter ( file ) defer out . Flush ( ) da . Save ( out , dataType ) return nil }

// SaveToFile saves the cedar to a file,
// where dataType is either "json" or "gob".

SaveToFile saves the cedar to a file where dataType is either json or gob .


func (da *Cedar) Load(in io.Reader, dataType string) error {
	switch dataType {
	case "gob", "GOB":
		dataDecoder := gob.NewDecoder(in)
		return dataDecoder.Decode(da.cedar)
	case "json", "JSON":
		dataDecoder := json.NewDecoder(in)
		return dataDecoder.Decode(da.cedar)
	}
	return ErrInvalidDataType
}

func ( da * Cedar ) Load ( in io . Reader , dataType string ) error { switch dataType { case " " , " " : dataDecoder := gob . NewDecoder ( in ) return dataDecoder . Decode ( da . cedar ) case " " , " " : dataDecoder := json . NewDecoder ( in ) return dataDecoder . Decode ( da . cedar ) } return ErrInvalidDataType }

// Load loads the cedar from an io.Writer,
// where dataType is either "json" or "gob".

Load loads the cedar from an io . Writer where dataType is either json or gob .


func (da *Cedar) LoadFromFile(fileName string, dataType string) error {
	file, err := os.OpenFile(fileName, os.O_RDONLY, 0600)
	defer file.Close()
	if err != nil {
		return err
	}
	in := bufio.NewReader(file)
	return da.Load(in, dataType)
}

func ( da * Cedar ) LoadFromFile ( fileName string , dataType string ) error { file , err := os . OpenFile ( fileName , os . O_RDONLY , 0600 ) defer file . Close ( ) if err != nil { return err } in := bufio . NewReader ( file ) return da . Load ( in , dataType ) }

// LoadFromFile loads the cedar from a file,
// where dataType is either "json" or "gob".

LoadFromFile loads the cedar from a file where dataType is either json or gob .


func (da *Cedar) Key(id int) (key []byte, err error) {
	for id > 0 {
		from := da.Array[id].Check
		if from < 0 {
			return nil, ErrNoPath
		}
		if char := byte(da.Array[from].base() ^ id); char != 0 {
			key = append(key, char)
		}
		id = from
	}
	if id != 0 || len(key) == 0 {
		return nil, ErrInvalidKey
	}
	for i := 0; i < len(key)/2; i++ {
		key[i], key[len(key)-i-1] = key[len(key)-i-1], key[i]
	}
	return key, nil
}

func ( da * Cedar ) Key ( id int ) ( key [ ] byte , err error ) { for id > 0 { from := da . Array [ id ] . Check if from < 0 { return nil , ErrNoPath } if char := byte ( da . Array [ from ] . base ( ) ^ id ) ; char != 0 { key = append ( key , char ) } id = from } if id != 0 || len ( key ) == 0 { return nil , ErrInvalidKey } for i := 0 ; i < len ( key ) / 2 ; i ++ { key [ i ] , key [ len ( key ) - i - 1 ] = key [ len ( key ) - i - 1 ] , key [ i ] } return key , nil }

// Key returns the key of the node with the given `id`.
// It will return ErrNoPath, if the node does not exist.

Key returns the key of the node with the given id . It will return ErrNoPath if the node does not exist .


func (da *Cedar) Value(id int) (value int, err error) {
	value = da.Array[id].Value
	if value >= 0 {
		return value, nil
	}
	to := da.Array[id].base()
	if da.Array[to].Check == id && da.Array[to].Value >= 0 {
		return da.Array[to].Value, nil
	}
	return 0, ErrNoValue
}

func ( da * Cedar ) Value ( id int ) ( value int , err error ) { value = da . Array [ id ] . Value if value >= 0 { return value , nil } to := da . Array [ id ] . base ( ) if da . Array [ to ] . Check == id && da . Array [ to ] . Value >= 0 { return da . Array [ to ] . Value , nil } return 0 , ErrNoValue }

// Value returns the value of the node with the given `id`.
// It will return ErrNoValue, if the node does not have a value.

Value returns the value of the node with the given id . It will return ErrNoValue if the node does not have a value .


func (da *Cedar) Delete(key []byte) error {
	// if the path does not exist, or the end is not a leaf, nothing to delete
	to, err := da.Jump(key, 0)
	if err != nil {
		return ErrNoPath
	}

	if da.Array[to].Value < 0 {
		base := da.Array[to].base()
		if da.Array[base].Check == to {
			to = base
		}
	}

	for to > 0 {
		from := da.Array[to].Check
		base := da.Array[from].base()
		label := byte(to ^ base)

		// if `to` has sibling, remove `to` from the sibling list, then stop
		if da.Ninfos[to].Sibling != 0 || da.Ninfos[from].Child != label {
			// delete the label from the child ring first
			da.popSibling(from, base, label)
			// then release the current node `to` to the empty node ring
			da.pushEnode(to)
			break
		}
		// otherwise, just release the current node `to` to the empty node ring
		da.pushEnode(to)
		// then check its parent node
		to = from
	}
	return nil
}

// Delete removes a key-value pair from the cedar.
// It will return ErrNoPath, if the key has not been added.

Delete removes a key - value pair from the cedar . It will return ErrNoPath if the key has not been added .


func (v *Version) Set(version string) error {
	metadata := splitOff(&version, "+")
	preRelease := PreRelease(splitOff(&version, "-"))
	dotParts := strings.SplitN(version, ".", 3)

	if len(dotParts) != 3 {
		return fmt.Errorf("%s is not in dotted-tri format", version)
	}

	if err := validateIdentifier(string(preRelease)); err != nil {
		return fmt.Errorf("failed to validate pre-release: %v", err)
	}

	if err := validateIdentifier(metadata); err != nil {
		return fmt.Errorf("failed to validate metadata: %v", err)
	}

	parsed := make([]int64, 3, 3)

	for i, v := range dotParts[:3] {
		val, err := strconv.ParseInt(v, 10, 64)
		parsed[i] = val
		if err != nil {
			return err
		}
	}

	v.Metadata = metadata
	v.PreRelease = preRelease
	v.Major = parsed[0]
	v.Minor = parsed[1]
	v.Patch = parsed[2]
	return nil
}

func ( v * Version ) Set ( version string ) error { metadata := splitOff ( & version , " " ) preRelease := PreRelease ( splitOff ( & version , " " ) ) dotParts := strings . SplitN ( version , " " , 3 ) if len ( dotParts ) != 3 { return fmt . Errorf ( " " , version ) } if err := validateIdentifier ( string ( preRelease ) ) ; err != nil { return fmt . Errorf ( " " , err ) } if err := validateIdentifier ( metadata ) ; err != nil { return fmt . Errorf ( " " , err ) } parsed := make ( [ ] int64 , 3 , 3 ) for i , v := range dotParts [ : 3 ] { val , err := strconv . ParseInt ( v , 10 , 64 ) parsed [ i ] = val if err != nil { return err } } v . Metadata = metadata v . PreRelease = preRelease v . Major = parsed [ 0 ] v . Minor = parsed [ 1 ] v . Patch = parsed [ 2 ] return nil }

// Set parses and updates v from the given version string. Implements flag.Value

Set parses and updates v from the given version string . Implements flag . Value


func (v Version) Compare(versionB Version) int {
	if cmp := recursiveCompare(v.Slice(), versionB.Slice()); cmp != 0 {
		return cmp
	}
	return preReleaseCompare(v, versionB)
}

func ( v Version ) Compare ( versionB Version ) int { if cmp := recursiveCompare ( v . Slice ( ) , versionB . Slice ( ) ) ; cmp != 0 { return cmp } return preReleaseCompare ( v , versionB ) }

// Compare tests if v is less than, equal to, or greater than versionB,
// returning -1, 0, or +1 respectively.

Compare tests if v is less than equal to or greater than versionB returning - 1 0 or + 1 respectively .


func (v Version) Slice() []int64 {
	return []int64{v.Major, v.Minor, v.Patch}
}

func ( v Version ) Slice ( ) [ ] int64 { return [ ] int64 { v . Major , v . Minor , v . Patch } }

// Slice converts the comparable parts of the semver into a slice of integers.

Slice converts the comparable parts of the semver into a slice of integers .


func (v *Version) BumpMajor() {
	v.Major += 1
	v.Minor = 0
	v.Patch = 0
	v.PreRelease = PreRelease("")
	v.Metadata = ""
}

func ( v * Version ) BumpMajor ( ) { v . Major += 1 v . Minor = 0 v . Patch = 0 v . PreRelease = PreRelease ( " " ) v . Metadata = " " }

// BumpMajor increments the Major field by 1 and resets all other fields to their default values


func (v *Version) BumpMinor() {
	v.Minor += 1
	v.Patch = 0
	v.PreRelease = PreRelease("")
	v.Metadata = ""
}

func ( v * Version ) BumpMinor ( ) { v . Minor += 1 v . Patch = 0 v . PreRelease = PreRelease ( " " ) v . Metadata = " " }

// BumpMinor increments the Minor field by 1 and resets all other fields to their default values


func (v *Version) BumpPatch() {
	v.Patch += 1
	v.PreRelease = PreRelease("")
	v.Metadata = ""
}

func ( v * Version ) BumpPatch ( ) { v . Patch += 1 v . PreRelease = PreRelease ( " " ) v . Metadata = " " }

// BumpPatch increments the Patch field by 1 and resets all other fields to their default values


func validateIdentifier(id string) error {
	if id != "" && !reIdentifier.MatchString(id) {
		return fmt.Errorf("%s is not a valid semver identifier", id)
	}
	return nil
}

func validateIdentifier ( id string ) error { if id != " " && ! reIdentifier . MatchString ( id ) { return fmt . Errorf ( " " , id ) } return nil }

// validateIdentifier makes sure the provided identifier satisfies semver spec


func newStream(bufsize int, replay bool) *Stream {
	return &Stream{
		AutoReplay:  replay,
		subscribers: make([]*Subscriber, 0),
		register:    make(chan *Subscriber),
		deregister:  make(chan *Subscriber),
		event:       make(chan *Event, bufsize),
		quit:        make(chan bool),
		Eventlog:    make(EventLog, 0),
	}
}

func newStream ( bufsize int , replay bool ) * Stream { return & Stream { AutoReplay : replay , subscribers : make ( [ ] * Subscriber , 0 ) , register : make ( chan * Subscriber ) , deregister : make ( chan * Subscriber ) , event : make ( chan * Event , bufsize ) , quit : make ( chan bool ) , Eventlog : make ( EventLog , 0 ) , } }


func (str *Stream) addSubscriber(eventid string) *Subscriber {
	sub := &Subscriber{
		eventid:    eventid,
		quit:       str.deregister,
		connection: make(chan *Event, 64),
	}

	str.register <- sub
	return sub
}

func ( str * Stream ) addSubscriber ( eventid string ) * Subscriber { sub := & Subscriber { eventid : eventid , quit : str . deregister , connection : make ( chan * Event , 64 ) , } str . register <- sub return sub }

// addSubscriber will create a new subscriber on a stream


func New() *Server {
	return &Server{
		BufferSize: DefaultBufferSize,
		AutoStream: false,
		AutoReplay: true,
		Streams:    make(map[string]*Stream),
	}
}

func New ( ) * Server { return & Server { BufferSize : DefaultBufferSize , AutoStream : false , AutoReplay : true , Streams : make ( map [ string ] * Stream ) , } }

// New will create a server and setup defaults


func (s *Server) Close() {
	s.mu.Lock()
	defer s.mu.Unlock()

	for id := range s.Streams {
		s.Streams[id].quit <- true
		delete(s.Streams, id)
	}
}

func ( s * Server ) Close ( ) { s . mu . Lock ( ) defer s . mu . Unlock ( ) for id := range s . Streams { s . Streams [ id ] . quit <- true delete ( s . Streams , id ) } }

// Close shuts down the server, closes all of the streams and connections

Close shuts down the server closes all of the streams and connections


func (s *Server) CreateStream(id string) *Stream {
	s.mu.Lock()
	defer s.mu.Unlock()

	if s.Streams[id] != nil {
		return s.Streams[id]
	}

	str := newStream(s.BufferSize, s.AutoReplay)
	str.run()

	s.Streams[id] = str

	return str
}

func ( s * Server ) CreateStream ( id string ) * Stream { s . mu . Lock ( ) defer s . mu . Unlock ( ) if s . Streams [ id ] != nil { return s . Streams [ id ] } str := newStream ( s . BufferSize , s . AutoReplay ) str . run ( ) s . Streams [ id ] = str return str }

// CreateStream will create a new stream and register it


func (s *Server) RemoveStream(id string) {
	s.mu.Lock()
	defer s.mu.Unlock()

	if s.Streams[id] != nil {
		s.Streams[id].close()
		delete(s.Streams, id)
	}
}

func ( s * Server ) RemoveStream ( id string ) { s . mu . Lock ( ) defer s . mu . Unlock ( ) if s . Streams [ id ] != nil { s . Streams [ id ] . close ( ) delete ( s . Streams , id ) } }


func (s *Server) StreamExists(id string) bool {
	s.mu.Lock()
	defer s.mu.Unlock()

	return s.Streams[id] != nil
}

func ( s * Server ) StreamExists ( id string ) bool { s . mu . Lock ( ) defer s . mu . Unlock ( ) return s . Streams [ id ] != nil }

// StreamExists checks whether a stream by a given id exists


func (s *Server) Publish(id string, event *Event) {
	s.mu.Lock()
	defer s.mu.Unlock()
	if s.Streams[id] != nil {
		s.Streams[id].event <- s.process(event)
	}
}

func ( s * Server ) Publish ( id string , event * Event ) { s . mu . Lock ( ) defer s . mu . Unlock ( ) if s . Streams [ id ] != nil { s . Streams [ id ] . event <- s . process ( event ) } }

// Publish sends a mesage to every client in a streamID


func NewClient(url string) *Client {
	return &Client{
		URL:        url,
		Connection: &http.Client{},
		Headers:    make(map[string]string),
		subscribed: make(map[chan *Event]chan bool),
	}
}

func NewClient ( url string ) * Client { return & Client { URL : url , Connection : & http . Client { } , Headers : make ( map [ string ] string ) , subscribed : make ( map [ chan * Event ] chan bool ) , } }


func (c *Client) Subscribe(stream string, handler func(msg *Event)) error {
	operation := func() error {
		resp, err := c.request(stream)
		if err != nil {
			return err
		}
		defer resp.Body.Close()

		reader := NewEventStreamReader(resp.Body)

		for {
			// Read each new line and process the type of event
			event, err := reader.ReadEvent()
			if err != nil {
				if err == io.EOF {
					return nil
				}

				// run user specified disconnect function
				if c.disconnectcb != nil {
					c.disconnectcb(c)
				}

				return err
			}

			// If we get an error, ignore it.
			if msg, err := c.processEvent(event); err == nil {
				if len(msg.ID) > 0 {
					c.EventID = string(msg.ID)
				} else {
					msg.ID = []byte(c.EventID)
				}

				handler(msg)
			}
		}
	}
	return backoff.Retry(operation, backoff.NewExponentialBackOff())
}


func (c *Client) SubscribeChan(stream string, ch chan *Event) error {
	var connected bool
	errch := make(chan error)
	c.mu.Lock()
	c.subscribed[ch] = make(chan bool)
	c.mu.Unlock()

	go func() {
		operation := func() error {
			resp, err := c.request(stream)
			if err != nil {
				c.cleanup(resp, ch)
				return err
			}

			if resp.StatusCode != 200 {
				c.cleanup(resp, ch)
				return errors.New("could not connect to stream")
			}

			if !connected {
				errch <- nil
				connected = true
			}

			reader := NewEventStreamReader(resp.Body)

			for {
				// Read each new line and process the type of event
				event, err := reader.ReadEvent()
				if err != nil {
					if err == io.EOF {
						c.cleanup(resp, ch)
						return nil
					}

					// run user specified disconnect function
					if c.disconnectcb != nil {
						c.disconnectcb(c)
					}

					return err
				}

				// If we get an error, ignore it.
				if msg, err := c.processEvent(event); err == nil {
					if len(msg.ID) > 0 {
						c.EventID = string(msg.ID)
					} else {
						msg.ID = []byte(c.EventID)
					}

					select {
					case <-c.subscribed[ch]:
						c.cleanup(resp, ch)
						return nil
					case ch <- msg:
						// message sent
					}
				}
			}
		}

		err := backoff.Retry(operation, backoff.NewExponentialBackOff())
		if err != nil && !connected {
			errch <- err
		}
	}()
	err := <-errch
	close(errch)

	return err
}

// SubscribeChan sends all events to the provided channel


func (c *Client) SubscribeRaw(handler func(msg *Event)) error {
	return c.Subscribe("", handler)
}

func ( c * Client ) SubscribeRaw ( handler func ( msg * Event ) ) error { return c . Subscribe ( " " , handler ) }


func (c *Client) Unsubscribe(ch chan *Event) {
	c.mu.Lock()
	defer c.mu.Unlock()

	if c.subscribed[ch] != nil {
		c.subscribed[ch] <- true
	}
}

func ( c * Client ) Unsubscribe ( ch chan * Event ) { c . mu . Lock ( ) defer c . mu . Unlock ( ) if c . subscribed [ ch ] != nil { c . subscribed [ ch ] <- true } }


func NewEventStreamReader(eventStream io.Reader) *EventStreamReader {
	scanner := bufio.NewScanner(eventStream)
	split := func(data []byte, atEOF bool) (int, []byte, error) {
		if atEOF && len(data) == 0 {
			return 0, nil, nil
		}

		// We have a full event payload to parse.
		if i := bytes.Index(data, []byte("\r\n\r\n")); i >= 0 {
			return i + 1, data[0:i], nil
		}
		if i := bytes.Index(data, []byte("\r\r")); i >= 0 {
			return i + 1, data[0:i], nil
		}
		if i := bytes.Index(data, []byte("\n\n")); i >= 0 {
			return i + 1, data[0:i], nil
		}
		// If we're at EOF, we have all of the data.
		if atEOF {
			return len(data), data, nil
		}
		// Request more data.
		return 0, nil, nil
	}
	// Set the split function for the scanning operation.
	scanner.Split(split)

	return &EventStreamReader{
		scanner: scanner,
	}
}

// NewEventStreamReader creates an instance of EventStreamReader.

NewEventStreamReader creates an instance of EventStreamReader .


func (e *EventStreamReader) ReadEvent() ([]byte, error) {
	if e.scanner.Scan() {
		event := e.scanner.Bytes()
		return event, nil
	}
	if err := e.scanner.Err(); err != nil {
		return nil, err
	}
	return nil, io.EOF
}

func ( e * EventStreamReader ) ReadEvent ( ) ( [ ] byte , error ) { if e . scanner . Scan ( ) { event := e . scanner . Bytes ( ) return event , nil } if err := e . scanner . Err ( ) ; err != nil { return nil , err } return nil , io . EOF }

// ReadEvent scans the EventStream for events.

ReadEvent scans the EventStream for events .


func (s *Server) HTTPHandler(w http.ResponseWriter, r *http.Request) {
	flusher, err := w.(http.Flusher)
	if !err {
		http.Error(w, "Streaming unsupported!", http.StatusInternalServerError)
		return
	}

	w.Header().Set("Content-Type", "text/event-stream")
	w.Header().Set("Cache-Control", "no-cache")
	w.Header().Set("Connection", "keep-alive")
	w.Header().Set("Access-Control-Allow-Origin", "*")

	// Get the StreamID from the URL
	streamID := r.URL.Query().Get("stream")
	if streamID == "" {
		http.Error(w, "Please specify a stream!", http.StatusInternalServerError)
		return
	}

	stream := s.getStream(streamID)

	if stream == nil && !s.AutoStream {
		http.Error(w, "Stream not found!", http.StatusInternalServerError)
		return
	} else if stream == nil && s.AutoStream {
		stream = s.CreateStream(streamID)
	}

	eventid := r.Header.Get("Last-Event-ID")
	if eventid == "" {
		eventid = "0"
	}

	// Create the stream subscriber
	sub := stream.addSubscriber(eventid)
	defer sub.close()

	notify := w.(http.CloseNotifier).CloseNotify()
	go func() {
		<-notify
		sub.close()
	}()

	// Push events to client
	for {
		select {
		case ev, ok := <-sub.connection:
			if !ok {
				return
			}

			// If the data buffer is an empty string abort.
			if len(ev.Data) == 0 {
				break
			}

			// if the event has expired, dont send it
			if s.EventTTL != 0 && time.Now().After(ev.timestamp.Add(s.EventTTL)) {
				continue
			}

			fmt.Fprintf(w, "id: %s\n", ev.ID)
			fmt.Fprintf(w, "data: %s\n", ev.Data)
			if len(ev.Event) > 0 {
				fmt.Fprintf(w, "event: %s\n", ev.Event)
			}
			if len(ev.Retry) > 0 {
				fmt.Fprintf(w, "retry: %s\n", ev.Retry)
			}
			fmt.Fprint(w, "\n")
			flusher.Flush()
		}
	}
}

// HTTPHandler serves new connections with events for a given stream ...


func (e *EventLog) Add(ev *Event) {
	ev.ID = []byte(e.currentindex())
	ev.timestamp = time.Now()
	(*e) = append((*e), ev)
}

func ( e * EventLog ) Add ( ev * Event ) { ev . ID = [ ] byte ( e . currentindex ( ) ) ev . timestamp = time . Now ( ) ( * e ) = append ( ( * e ) , ev ) }


func (e *EventLog) Replay(s *Subscriber) {
	for i := 0; i < len((*e)); i++ {
		if string((*e)[i].ID) >= s.eventid {
			s.connection <- (*e)[i]
		}
	}
}

func ( e * EventLog ) Replay ( s * Subscriber ) { for i := 0 ; i < len ( ( * e ) ) ; i ++ { if string ( ( * e ) [ i ] . ID ) >= s . eventid { s . connection <- ( * e ) [ i ] } } }


func readKey(path string) (crypto.Signer, error) {
	b, err := ioutil.ReadFile(path)
	if err != nil {
		return nil, err
	}
	d, _ := pem.Decode(b)
	if d == nil {
		return nil, fmt.Errorf("no block found in %q", path)
	}
	switch d.Type {
	case rsaPrivateKey:
		return x509.ParsePKCS1PrivateKey(d.Bytes)
	case ecPrivateKey:
		return x509.ParseECPrivateKey(d.Bytes)
	default:
		return nil, fmt.Errorf("%q is unsupported", d.Type)
	}
}

func readKey ( path string ) ( crypto . Signer , error ) { b , err := ioutil . ReadFile ( path ) if err != nil { return nil , err } d , _ := pem . Decode ( b ) if d == nil { return nil , fmt . Errorf ( " " , path ) } switch d . Type { case rsaPrivateKey : return x509 . ParsePKCS1PrivateKey ( d . Bytes ) case ecPrivateKey : return x509 . ParseECPrivateKey ( d . Bytes ) default : return nil , fmt . Errorf ( " " , d . Type ) } }

// readKey reads a private rsa key from path.
// The key is expected to be in PEM format.

readKey reads a private rsa key from path . The key is expected to be in PEM format .


func writeKey(path string, k *ecdsa.PrivateKey) error {
	f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600)
	if err != nil {
		return err
	}
	bytes, err := x509.MarshalECPrivateKey(k)
	if err != nil {
		return err
	}
	b := &pem.Block{Type: ecPrivateKey, Bytes: bytes}
	if err := pem.Encode(f, b); err != nil {
		f.Close()
		return err
	}
	return f.Close()
}

func writeKey ( path string , k * ecdsa . PrivateKey ) error { f , err := os . OpenFile ( path , os . O_WRONLY | os . O_CREATE | os . O_TRUNC , 0600 ) if err != nil { return err } bytes , err := x509 . MarshalECPrivateKey ( k ) if err != nil { return err } b := & pem . Block { Type : ecPrivateKey , Bytes : bytes } if err := pem . Encode ( f , b ) ; err != nil { f . Close ( ) return err } return f . Close ( ) }

// writeKey writes k to the specified path in PEM format.
// If file does not exists, it will be created with 0600 mod.

writeKey writes k to the specified path in PEM format . If file does not exists it will be created with 0600 mod .


func anyKey(filename string, gen bool) (crypto.Signer, error) {
	k, err := readKey(filename)
	if err == nil {
		return k, nil
	}
	if !os.IsNotExist(err) || !gen {
		return nil, err
	}
	ecKey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
	if err != nil {
		return nil, err
	}
	return ecKey, writeKey(filename, ecKey)
}

func anyKey ( filename string , gen bool ) ( crypto . Signer , error ) { k , err := readKey ( filename ) if err == nil { return k , nil } if ! os . IsNotExist ( err ) || ! gen { return nil , err } ecKey , err := ecdsa . GenerateKey ( elliptic . P256 ( ) , rand . Reader ) if err != nil { return nil , err } return ecKey , writeKey ( filename , ecKey ) }

// anyKey reads the key from file or generates a new one if gen == true.
// It returns an error if filename exists but cannot be read.
// A newly generated key is also stored to filename.

anyKey reads the key from file or generates a new one if gen == true . It returns an error if filename exists but cannot be read . A newly generated key is also stored to filename .


func sameDir(existing, filename string) string {
	return filepath.Join(filepath.Dir(existing), filename)
}

func sameDir ( existing , filename string ) string { return filepath . Join ( filepath . Dir ( existing ) , filename ) }

// sameDir returns filename path placing it in the same dir as existing file.

sameDir returns filename path placing it in the same dir as existing file .


func printAccount(w io.Writer, a *acme.Account, kp string) {
	tw := tabwriter.NewWriter(w, 0, 8, 0, '\t', 0)
	fmt.Fprintln(tw, "URI:\t", a.URI)
	fmt.Fprintln(tw, "Key:\t", kp)
	fmt.Fprintln(tw, "Contact:\t", strings.Join(a.Contact, ", "))
	fmt.Fprintln(tw, "Terms:\t", a.CurrentTerms)
	agreed := a.AgreedTerms
	if a.AgreedTerms == "" {
		agreed = "no"
	} else if a.AgreedTerms == a.CurrentTerms {
		agreed = "yes"
	}
	fmt.Fprintln(tw, "Accepted:\t", agreed)
	// TODO: print authorization and certificates
	tw.Flush()
}

// printAccount outputs account into into w using tabwriter.

printAccount outputs account into into w using tabwriter .


func tmpl(w io.Writer, text string, data interface{}) {
	t := template.New("top")
	t.Funcs(template.FuncMap{
		"trim":       strings.TrimSpace,
		"capitalize": capitalize,
	})
	template.Must(t.Parse(text))
	ew := &errWriter{w: w}
	err := t.Execute(ew, data)
	if ew.err != nil {
		// I/O error writing; ignore write on closed pipe
		if strings.Contains(ew.err.Error(), "pipe") {
			os.Exit(1)
		}
		fatalf("writing output: %v", ew.err)
	}
	if err != nil {
		panic(err)
	}
}

// tmpl executes the given template text on data, writing the result to w.

tmpl executes the given template text on data writing the result to w .


func printUsage(w io.Writer) {
	bw := bufio.NewWriter(w)
	tmpl(bw, usageTemplate, commands)
	bw.Flush()
}

func printUsage ( w io . Writer ) { bw := bufio . NewWriter ( w ) tmpl ( bw , usageTemplate , commands ) bw . Flush ( ) }

// printUsage prints usageTemplate to w.


func FromRequest(r *http.Request) string {
	// Fetch header value
	xRealIP := r.Header.Get("X-Real-Ip")
	xForwardedFor := r.Header.Get("X-Forwarded-For")

	// If both empty, return IP from remote address
	if xRealIP == "" && xForwardedFor == "" {
		var remoteIP string

		// If there are colon in remote address, remove the port number
		// otherwise, return remote address as is
		if strings.ContainsRune(r.RemoteAddr, ':') {
			remoteIP, _, _ = net.SplitHostPort(r.RemoteAddr)
		} else {
			remoteIP = r.RemoteAddr
		}

		return remoteIP
	}

	// Check list of IP in X-Forwarded-For and return the first global address
	for _, address := range strings.Split(xForwardedFor, ",") {
		address = strings.TrimSpace(address)
		isPrivate, err := isPrivateAddress(address)
		if !isPrivate && err == nil {
			return address
		}
	}

	// If nothing succeed, return X-Real-IP
	return xRealIP
}

// FromRequest return client's real public IP address from http request headers.

FromRequest return client s real public IP address from http request headers .


func (p *ClearParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClear, p, nil)
}

func ( p * ClearParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandClear , p , nil ) }

// Do executes DOMStorage.clear against the provided context.

Do executes DOMStorage . clear against the provided context .


func (p *DisableParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDisable, nil, nil)
}

func ( p * DisableParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDisable , nil , nil ) }

// Do executes DOMStorage.disable against the provided context.

Do executes DOMStorage . disable against the provided context .


func (p *RemoveDOMStorageItemParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandRemoveDOMStorageItem, p, nil)
}

func ( p * RemoveDOMStorageItemParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandRemoveDOMStorageItem , p , nil ) }

// Do executes DOMStorage.removeDOMStorageItem against the provided context.

Do executes DOMStorage . removeDOMStorageItem against the provided context .


func (p *SetDOMStorageItemParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetDOMStorageItem, p, nil)
}

func ( p * SetDOMStorageItemParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetDOMStorageItem , p , nil ) }

// Do executes DOMStorage.setDOMStorageItem against the provided context.

Do executes DOMStorage . setDOMStorageItem against the provided context .


func (p *DeliverPushMessageParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeliverPushMessage, p, nil)
}

func ( p * DeliverPushMessageParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDeliverPushMessage , p , nil ) }

// Do executes ServiceWorker.deliverPushMessage against the provided context.

Do executes ServiceWorker . deliverPushMessage against the provided context .


func (p *DispatchSyncEventParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDispatchSyncEvent, p, nil)
}

func ( p * DispatchSyncEventParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDispatchSyncEvent , p , nil ) }

// Do executes ServiceWorker.dispatchSyncEvent against the provided context.

Do executes ServiceWorker . dispatchSyncEvent against the provided context .


func (p *InspectWorkerParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandInspectWorker, p, nil)
}

func ( p * InspectWorkerParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandInspectWorker , p , nil ) }

// Do executes ServiceWorker.inspectWorker against the provided context.

Do executes ServiceWorker . inspectWorker against the provided context .


func (p *SetForceUpdateOnPageLoadParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetForceUpdateOnPageLoad, p, nil)
}

func ( p * SetForceUpdateOnPageLoadParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetForceUpdateOnPageLoad , p , nil ) }

// Do executes ServiceWorker.setForceUpdateOnPageLoad against the provided context.

Do executes ServiceWorker . setForceUpdateOnPageLoad against the provided context .


func (p *SkipWaitingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSkipWaiting, p, nil)
}

func ( p * SkipWaitingParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSkipWaiting , p , nil ) }

// Do executes ServiceWorker.skipWaiting against the provided context.

Do executes ServiceWorker . skipWaiting against the provided context .


func (p *StartWorkerParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartWorker, p, nil)
}

func ( p * StartWorkerParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartWorker , p , nil ) }

// Do executes ServiceWorker.startWorker against the provided context.

Do executes ServiceWorker . startWorker against the provided context .


func (p *StopAllWorkersParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopAllWorkers, nil, nil)
}

func ( p * StopAllWorkersParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopAllWorkers , nil , nil ) }

// Do executes ServiceWorker.stopAllWorkers against the provided context.

Do executes ServiceWorker . stopAllWorkers against the provided context .


func (p *StopWorkerParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopWorker, p, nil)
}

func ( p * StopWorkerParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopWorker , p , nil ) }

// Do executes ServiceWorker.stopWorker against the provided context.

Do executes ServiceWorker . stopWorker against the provided context .


func (p *UnregisterParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUnregister, p, nil)
}

func ( p * UnregisterParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUnregister , p , nil ) }

// Do executes ServiceWorker.unregister against the provided context.

Do executes ServiceWorker . unregister against the provided context .


func (p *UpdateRegistrationParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUpdateRegistration, p, nil)
}

func ( p * UpdateRegistrationParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUpdateRegistration , p , nil ) }

// Do executes ServiceWorker.updateRegistration against the provided context.

Do executes ServiceWorker . updateRegistration against the provided context .


func (p *BindParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandBind, p, nil)
}

func ( p * BindParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandBind , p , nil ) }

// Do executes Tethering.bind against the provided context.

Do executes Tethering . bind against the provided context .


func (p *UnbindParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUnbind, p, nil)
}

func ( p * UnbindParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUnbind , p , nil ) }

// Do executes Tethering.unbind against the provided context.

Do executes Tethering . unbind against the provided context .


func (e *ExceptionDetails) Error() string {
	// TODO: watch script parsed events and match the ExceptionDetails.ScriptID
	// to the name/location of the actual code and display here
	return fmt.Sprintf("encountered exception '%s' (%d:%d)", e.Text, e.LineNumber, e.ColumnNumber)
}


func (p *ReleaseAnimationsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReleaseAnimations, p, nil)
}

func ( p * ReleaseAnimationsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandReleaseAnimations , p , nil ) }

// Do executes Animation.releaseAnimations against the provided context.

Do executes Animation . releaseAnimations against the provided context .


func (p *SeekAnimationsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSeekAnimations, p, nil)
}

func ( p * SeekAnimationsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSeekAnimations , p , nil ) }

// Do executes Animation.seekAnimations against the provided context.

Do executes Animation . seekAnimations against the provided context .


func (p *SetPausedParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetPaused, p, nil)
}

func ( p * SetPausedParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetPaused , p , nil ) }

// Do executes Animation.setPaused against the provided context.

Do executes Animation . setPaused against the provided context .


func (p *SetPlaybackRateParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetPlaybackRate, p, nil)
}

func ( p * SetPlaybackRateParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetPlaybackRate , p , nil ) }

// Do executes Animation.setPlaybackRate against the provided context.

Do executes Animation . setPlaybackRate against the provided context .


func (p *SetTimingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetTiming, p, nil)
}

func ( p * SetTimingParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetTiming , p , nil ) }

// Do executes Animation.setTiming against the provided context.

Do executes Animation . setTiming against the provided context .


func (p *PrepareForLeakDetectionParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandPrepareForLeakDetection, nil, nil)
}

func ( p * PrepareForLeakDetectionParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandPrepareForLeakDetection , nil , nil ) }

// Do executes Memory.prepareForLeakDetection against the provided context.

Do executes Memory . prepareForLeakDetection against the provided context .


func (p *ForciblyPurgeJavaScriptMemoryParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandForciblyPurgeJavaScriptMemory, nil, nil)
}

func ( p * ForciblyPurgeJavaScriptMemoryParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandForciblyPurgeJavaScriptMemory , nil , nil ) }

// Do executes Memory.forciblyPurgeJavaScriptMemory against the provided context.

Do executes Memory . forciblyPurgeJavaScriptMemory against the provided context .


func (p *SetPressureNotificationsSuppressedParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetPressureNotificationsSuppressed, p, nil)
}

// Do executes Memory.setPressureNotificationsSuppressed against the provided context.

Do executes Memory . setPressureNotificationsSuppressed against the provided context .


func (p *SimulatePressureNotificationParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSimulatePressureNotification, p, nil)
}

func ( p * SimulatePressureNotificationParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSimulatePressureNotification , p , nil ) }

// Do executes Memory.simulatePressureNotification against the provided context.

Do executes Memory . simulatePressureNotification against the provided context .


func (p StartSamplingParams) WithSamplingInterval(samplingInterval int64) *StartSamplingParams {
	p.SamplingInterval = samplingInterval
	return &p
}

func ( p StartSamplingParams ) WithSamplingInterval ( samplingInterval int64 ) * StartSamplingParams { p . SamplingInterval = samplingInterval return & p }

// WithSamplingInterval average number of bytes between samples.

WithSamplingInterval average number of bytes between samples .


func (p StartSamplingParams) WithSuppressRandomness(suppressRandomness bool) *StartSamplingParams {
	p.SuppressRandomness = suppressRandomness
	return &p
}

func ( p StartSamplingParams ) WithSuppressRandomness ( suppressRandomness bool ) * StartSamplingParams { p . SuppressRandomness = suppressRandomness return & p }

// WithSuppressRandomness do not randomize intervals between samples.

WithSuppressRandomness do not randomize intervals between samples .


func (p *StartSamplingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartSampling, p, nil)
}

func ( p * StartSamplingParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartSampling , p , nil ) }

// Do executes Memory.startSampling against the provided context.

Do executes Memory . startSampling against the provided context .


func (p *StopSamplingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopSampling, nil, nil)
}

func ( p * StopSamplingParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopSampling , nil , nil ) }

// Do executes Memory.stopSampling against the provided context.

Do executes Memory . stopSampling against the provided context .


func (p *ClearDeviceOrientationOverrideParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearDeviceOrientationOverride, nil, nil)
}

func ( p * ClearDeviceOrientationOverrideParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandClearDeviceOrientationOverride , nil , nil ) }

// Do executes DeviceOrientation.clearDeviceOrientationOverride against the provided context.

Do executes DeviceOrientation . clearDeviceOrientationOverride against the provided context .


func (p *SetDeviceOrientationOverrideParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetDeviceOrientationOverride, p, nil)
}

func ( p * SetDeviceOrientationOverrideParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetDeviceOrientationOverride , p , nil ) }

// Do executes DeviceOrientation.setDeviceOrientationOverride against the provided context.

Do executes DeviceOrientation . setDeviceOrientationOverride against the provided context .


func (p *StartViolationsReportParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartViolationsReport, p, nil)
}

func ( p * StartViolationsReportParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartViolationsReport , p , nil ) }

// Do executes Log.startViolationsReport against the provided context.

Do executes Log . startViolationsReport against the provided context .


func (p *StopViolationsReportParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopViolationsReport, nil, nil)
}

func ( p * StopViolationsReportParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopViolationsReport , nil , nil ) }

// Do executes Log.stopViolationsReport against the provided context.

Do executes Log . stopViolationsReport against the provided context .


func (t Modifier) String() string {
	switch t {
	case ModifierNone:
		return "None"
	case ModifierAlt:
		return "Alt"
	case ModifierCtrl:
		return "Ctrl"
	case ModifierMeta:
		return "Meta"
	case ModifierShift:
		return "Shift"
	}

	return fmt.Sprintf("Modifier(%d)", t)
}

func ( t Modifier ) String ( ) string { switch t { case ModifierNone : return " " case ModifierAlt : return " " case ModifierCtrl : return " " case ModifierMeta : return " " case ModifierShift : return " " } return fmt . Sprintf ( " " , t ) }

// String returns the Modifier as string value.

String returns the Modifier as string value .


func (p GetPartialAXTreeParams) WithNodeID(nodeID cdp.NodeID) *GetPartialAXTreeParams {
	p.NodeID = nodeID
	return &p
}

func ( p GetPartialAXTreeParams ) WithNodeID ( nodeID cdp . NodeID ) * GetPartialAXTreeParams { p . NodeID = nodeID return & p }

// WithNodeID identifier of the node to get the partial accessibility tree
// for.

WithNodeID identifier of the node to get the partial accessibility tree for .


func (p GetPartialAXTreeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *GetPartialAXTreeParams {
	p.BackendNodeID = backendNodeID
	return &p
}

func ( p GetPartialAXTreeParams ) WithBackendNodeID ( backendNodeID cdp . BackendNodeID ) * GetPartialAXTreeParams { p . BackendNodeID = backendNodeID return & p }

// WithBackendNodeID identifier of the backend node to get the partial
// accessibility tree for.

WithBackendNodeID identifier of the backend node to get the partial accessibility tree for .


func (p GetPartialAXTreeParams) WithObjectID(objectID runtime.RemoteObjectID) *GetPartialAXTreeParams {
	p.ObjectID = objectID
	return &p
}

func ( p GetPartialAXTreeParams ) WithObjectID ( objectID runtime . RemoteObjectID ) * GetPartialAXTreeParams { p . ObjectID = objectID return & p }

// WithObjectID JavaScript object id of the node wrapper to get the partial
// accessibility tree for.

WithObjectID JavaScript object id of the node wrapper to get the partial accessibility tree for .


func (p GetPartialAXTreeParams) WithFetchRelatives(fetchRelatives bool) *GetPartialAXTreeParams {
	p.FetchRelatives = fetchRelatives
	return &p
}

func ( p GetPartialAXTreeParams ) WithFetchRelatives ( fetchRelatives bool ) * GetPartialAXTreeParams { p . FetchRelatives = fetchRelatives return & p }

// WithFetchRelatives whether to fetch this nodes ancestors, siblings and
// children. Defaults to true.

WithFetchRelatives whether to fetch this nodes ancestors siblings and children . Defaults to true .


func (p *SetTimeDomainParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetTimeDomain, p, nil)
}

func ( p * SetTimeDomainParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetTimeDomain , p , nil ) }

// Do executes Performance.setTimeDomain against the provided context.

Do executes Performance . setTimeDomain against the provided context .


func (p ProfileSnapshotParams) WithClipRect(clipRect *dom.Rect) *ProfileSnapshotParams {
	p.ClipRect = clipRect
	return &p
}

func ( p ProfileSnapshotParams ) WithClipRect ( clipRect * dom . Rect ) * ProfileSnapshotParams { p . ClipRect = clipRect return & p }

// WithClipRect the clip rectangle to apply when replaying the snapshot.

WithClipRect the clip rectangle to apply when replaying the snapshot .


func (p *ReleaseSnapshotParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReleaseSnapshot, p, nil)
}

func ( p * ReleaseSnapshotParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandReleaseSnapshot , p , nil ) }

// Do executes LayerTree.releaseSnapshot against the provided context.

Do executes LayerTree . releaseSnapshot against the provided context .


func (p *ClearObjectStoreParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearObjectStore, p, nil)
}

func ( p * ClearObjectStoreParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandClearObjectStore , p , nil ) }

// Do executes IndexedDB.clearObjectStore against the provided context.

Do executes IndexedDB . clearObjectStore against the provided context .


func (p *DeleteDatabaseParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeleteDatabase, p, nil)
}

func ( p * DeleteDatabaseParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDeleteDatabase , p , nil ) }

// Do executes IndexedDB.deleteDatabase against the provided context.

Do executes IndexedDB . deleteDatabase against the provided context .


func (p *DeleteObjectStoreEntriesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeleteObjectStoreEntries, p, nil)
}

func ( p * DeleteObjectStoreEntriesParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDeleteObjectStoreEntries , p , nil ) }

// Do executes IndexedDB.deleteObjectStoreEntries against the provided context.

Do executes IndexedDB . deleteObjectStoreEntries against the provided context .


func (p RequestDataParams) WithKeyRange(keyRange *KeyRange) *RequestDataParams {
	p.KeyRange = keyRange
	return &p
}

func ( p RequestDataParams ) WithKeyRange ( keyRange * KeyRange ) * RequestDataParams { p . KeyRange = keyRange return & p }


func (p *SetSamplingIntervalParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetSamplingInterval, p, nil)
}

func ( p * SetSamplingIntervalParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetSamplingInterval , p , nil ) }

// Do executes Profiler.setSamplingInterval against the provided context.

Do executes Profiler . setSamplingInterval against the provided context .


func (p *StartParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStart, nil, nil)
}

func ( p * StartParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStart , nil , nil ) }

// Do executes Profiler.start against the provided context.

Do executes Profiler . start against the provided context .


func (p StartPreciseCoverageParams) WithCallCount(callCount bool) *StartPreciseCoverageParams {
	p.CallCount = callCount
	return &p
}

func ( p StartPreciseCoverageParams ) WithCallCount ( callCount bool ) * StartPreciseCoverageParams { p . CallCount = callCount return & p }

// WithCallCount collect accurate call counts beyond simple 'covered' or 'not
// covered'.

WithCallCount collect accurate call counts beyond simple covered or not covered .


func (p StartPreciseCoverageParams) WithDetailed(detailed bool) *StartPreciseCoverageParams {
	p.Detailed = detailed
	return &p
}

func ( p StartPreciseCoverageParams ) WithDetailed ( detailed bool ) * StartPreciseCoverageParams { p . Detailed = detailed return & p }

// WithDetailed collect block-based coverage.

WithDetailed collect block - based coverage .


func (p *StartPreciseCoverageParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartPreciseCoverage, p, nil)
}

func ( p * StartPreciseCoverageParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartPreciseCoverage , p , nil ) }

// Do executes Profiler.startPreciseCoverage against the provided context.

Do executes Profiler . startPreciseCoverage against the provided context .


func (p *StartTypeProfileParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartTypeProfile, nil, nil)
}

func ( p * StartTypeProfileParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartTypeProfile , nil , nil ) }

// Do executes Profiler.startTypeProfile against the provided context.

Do executes Profiler . startTypeProfile against the provided context .


func (p *StopPreciseCoverageParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopPreciseCoverage, nil, nil)
}

func ( p * StopPreciseCoverageParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopPreciseCoverage , nil , nil ) }

// Do executes Profiler.stopPreciseCoverage against the provided context.

Do executes Profiler . stopPreciseCoverage against the provided context .


func (p *StopTypeProfileParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopTypeProfile, nil, nil)
}

func ( p * StopTypeProfileParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopTypeProfile , nil , nil ) }

// Do executes Profiler.stopTypeProfile against the provided context.

Do executes Profiler . stopTypeProfile against the provided context .


func (p *SetIgnoreCertificateErrorsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetIgnoreCertificateErrors, p, nil)
}

func ( p * SetIgnoreCertificateErrorsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetIgnoreCertificateErrors , p , nil ) }

// Do executes Security.setIgnoreCertificateErrors against the provided context.

Do executes Security . setIgnoreCertificateErrors against the provided context .


func (p *AddInspectedHeapObjectParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandAddInspectedHeapObject, p, nil)
}

func ( p * AddInspectedHeapObjectParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandAddInspectedHeapObject , p , nil ) }

// Do executes HeapProfiler.addInspectedHeapObject against the provided context.

Do executes HeapProfiler . addInspectedHeapObject against the provided context .


func (p *CollectGarbageParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandCollectGarbage, nil, nil)
}

func ( p * CollectGarbageParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandCollectGarbage , nil , nil ) }

// Do executes HeapProfiler.collectGarbage against the provided context.

Do executes HeapProfiler . collectGarbage against the provided context .


func (p StartSamplingParams) WithSamplingInterval(samplingInterval float64) *StartSamplingParams {
	p.SamplingInterval = samplingInterval
	return &p
}

func ( p StartSamplingParams ) WithSamplingInterval ( samplingInterval float64 ) * StartSamplingParams { p . SamplingInterval = samplingInterval return & p }

// WithSamplingInterval average sample interval in bytes. Poisson
// distribution is used for the intervals. The default value is 32768 bytes.

WithSamplingInterval average sample interval in bytes . Poisson distribution is used for the intervals . The default value is 32768 bytes .


func (p *StartTrackingHeapObjectsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartTrackingHeapObjects, p, nil)
}

func ( p * StartTrackingHeapObjectsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartTrackingHeapObjects , p , nil ) }

// Do executes HeapProfiler.startTrackingHeapObjects against the provided context.

Do executes HeapProfiler . startTrackingHeapObjects against the provided context .


func (p StopTrackingHeapObjectsParams) WithReportProgress(reportProgress bool) *StopTrackingHeapObjectsParams {
	p.ReportProgress = reportProgress
	return &p
}

func ( p StopTrackingHeapObjectsParams ) WithReportProgress ( reportProgress bool ) * StopTrackingHeapObjectsParams { p . ReportProgress = reportProgress return & p }

// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken when the tracking is stopped.

WithReportProgress if true reportHeapSnapshotProgress events will be generated while snapshot is being taken when the tracking is stopped .


func (p *StopTrackingHeapObjectsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStopTrackingHeapObjects, p, nil)
}

func ( p * StopTrackingHeapObjectsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStopTrackingHeapObjects , p , nil ) }

// Do executes HeapProfiler.stopTrackingHeapObjects against the provided context.

Do executes HeapProfiler . stopTrackingHeapObjects against the provided context .


func (p TakeHeapSnapshotParams) WithReportProgress(reportProgress bool) *TakeHeapSnapshotParams {
	p.ReportProgress = reportProgress
	return &p
}

func ( p TakeHeapSnapshotParams ) WithReportProgress ( reportProgress bool ) * TakeHeapSnapshotParams { p . ReportProgress = reportProgress return & p }

// WithReportProgress if true 'reportHeapSnapshotProgress' events will be
// generated while snapshot is being taken.

WithReportProgress if true reportHeapSnapshotProgress events will be generated while snapshot is being taken .


func (p *TakeHeapSnapshotParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTakeHeapSnapshot, p, nil)
}

func ( p * TakeHeapSnapshotParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandTakeHeapSnapshot , p , nil ) }

// Do executes HeapProfiler.takeHeapSnapshot against the provided context.

Do executes HeapProfiler . takeHeapSnapshot against the provided context .


func (p GrantPermissionsParams) WithBrowserContextID(browserContextID target.BrowserContextID) *GrantPermissionsParams {
	p.BrowserContextID = browserContextID
	return &p
}

func ( p GrantPermissionsParams ) WithBrowserContextID ( browserContextID target . BrowserContextID ) * GrantPermissionsParams { p . BrowserContextID = browserContextID return & p }

// WithBrowserContextID browserContext to override permissions. When omitted,
// default browser context is used.

WithBrowserContextID browserContext to override permissions . When omitted default browser context is used .


func (p *GrantPermissionsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandGrantPermissions, p, nil)
}

func ( p * GrantPermissionsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandGrantPermissions , p , nil ) }

// Do executes Browser.grantPermissions against the provided context.

Do executes Browser . grantPermissions against the provided context .


func (p ResetPermissionsParams) WithBrowserContextID(browserContextID target.BrowserContextID) *ResetPermissionsParams {
	p.BrowserContextID = browserContextID
	return &p
}

func ( p ResetPermissionsParams ) WithBrowserContextID ( browserContextID target . BrowserContextID ) * ResetPermissionsParams { p . BrowserContextID = browserContextID return & p }

// WithBrowserContextID browserContext to reset permissions. When omitted,
// default browser context is used.

WithBrowserContextID browserContext to reset permissions . When omitted default browser context is used .


func (p *ResetPermissionsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandResetPermissions, p, nil)
}

func ( p * ResetPermissionsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandResetPermissions , p , nil ) }

// Do executes Browser.resetPermissions against the provided context.

Do executes Browser . resetPermissions against the provided context .


func (p *CrashParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandCrash, nil, nil)
}

func ( p * CrashParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandCrash , nil , nil ) }

// Do executes Browser.crash against the provided context.

Do executes Browser . crash against the provided context .


func (p *CrashGpuProcessParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandCrashGpuProcess, nil, nil)
}

func ( p * CrashGpuProcessParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandCrashGpuProcess , nil , nil ) }

// Do executes Browser.crashGpuProcess against the provided context.

Do executes Browser . crashGpuProcess against the provided context .


func (p GetHistogramsParams) WithQuery(query string) *GetHistogramsParams {
	p.Query = query
	return &p
}

func ( p GetHistogramsParams ) WithQuery ( query string ) * GetHistogramsParams { p . Query = query return & p }

// WithQuery requested substring in name. Only histograms which have query as
// a substring in their name are extracted. An empty or absent query returns all
// histograms.

WithQuery requested substring in name . Only histograms which have query as a substring in their name are extracted . An empty or absent query returns all histograms .


func (p GetWindowForTargetParams) WithTargetID(targetID target.ID) *GetWindowForTargetParams {
	p.TargetID = targetID
	return &p
}

func ( p GetWindowForTargetParams ) WithTargetID ( targetID target . ID ) * GetWindowForTargetParams { p . TargetID = targetID return & p }

// WithTargetID devtools agent host id. If called as a part of the session,
// associated targetId is used.

WithTargetID devtools agent host id . If called as a part of the session associated targetId is used .


func (p *SetWindowBoundsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetWindowBounds, p, nil)
}

func ( p * SetWindowBoundsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetWindowBounds , p , nil ) }

// Do executes Browser.setWindowBounds against the provided context.

Do executes Browser . setWindowBounds against the provided context .


func (p SetDockTileParams) WithImage(image string) *SetDockTileParams {
	p.Image = image
	return &p
}

func ( p SetDockTileParams ) WithImage ( image string ) * SetDockTileParams { p . Image = image return & p }


func (p *SetDockTileParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetDockTile, p, nil)
}

func ( p * SetDockTileParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetDockTile , p , nil ) }

// Do executes Browser.setDockTile against the provided context.

Do executes Browser . setDockTile against the provided context .


func (p *DeleteCacheParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeleteCache, p, nil)
}

func ( p * DeleteCacheParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDeleteCache , p , nil ) }

// Do executes CacheStorage.deleteCache against the provided context.

Do executes CacheStorage . deleteCache against the provided context .


func (p *DeleteEntryParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDeleteEntry, p, nil)
}

func ( p * DeleteEntryParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDeleteEntry , p , nil ) }

// Do executes CacheStorage.deleteEntry against the provided context.

Do executes CacheStorage . deleteEntry against the provided context .


func (p RequestEntriesParams) WithPathFilter(pathFilter string) *RequestEntriesParams {
	p.PathFilter = pathFilter
	return &p
}

func ( p RequestEntriesParams ) WithPathFilter ( pathFilter string ) * RequestEntriesParams { p . PathFilter = pathFilter return & p }

// WithPathFilter if present, only return the entries containing this
// substring in the path.

WithPathFilter if present only return the entries containing this substring in the path .


func (p *DiscardSearchResultsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDiscardSearchResults, p, nil)
}

func ( p * DiscardSearchResultsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandDiscardSearchResults , p , nil ) }

// Do executes DOM.discardSearchResults against the provided context.

Do executes DOM . discardSearchResults against the provided context .


func (p *FocusParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandFocus, p, nil)
}

func ( p * FocusParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandFocus , p , nil ) }

// Do executes DOM.focus against the provided context.

Do executes DOM . focus against the provided context .


func (p *MarkUndoableStateParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandMarkUndoableState, nil, nil)
}

func ( p * MarkUndoableStateParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandMarkUndoableState , nil , nil ) }

// Do executes DOM.markUndoableState against the provided context.

Do executes DOM . markUndoableState against the provided context .


func (p PerformSearchParams) WithIncludeUserAgentShadowDOM(includeUserAgentShadowDOM bool) *PerformSearchParams {
	p.IncludeUserAgentShadowDOM = includeUserAgentShadowDOM
	return &p
}

func ( p PerformSearchParams ) WithIncludeUserAgentShadowDOM ( includeUserAgentShadowDOM bool ) * PerformSearchParams { p . IncludeUserAgentShadowDOM = includeUserAgentShadowDOM return & p }

// WithIncludeUserAgentShadowDOM true to search in user agent shadow DOM.

WithIncludeUserAgentShadowDOM true to search in user agent shadow DOM .


func (p *RedoParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandRedo, nil, nil)
}

func ( p * RedoParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandRedo , nil , nil ) }

// Do executes DOM.redo against the provided context.

Do executes DOM . redo against the provided context .


func (p *RemoveAttributeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandRemoveAttribute, p, nil)
}

func ( p * RemoveAttributeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandRemoveAttribute , p , nil ) }

// Do executes DOM.removeAttribute against the provided context.

Do executes DOM . removeAttribute against the provided context .


func (p *RemoveNodeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandRemoveNode, p, nil)
}

func ( p * RemoveNodeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandRemoveNode , p , nil ) }

// Do executes DOM.removeNode against the provided context.

Do executes DOM . removeNode against the provided context .


func (p *RequestChildNodesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandRequestChildNodes, p, nil)
}

func ( p * RequestChildNodesParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandRequestChildNodes , p , nil ) }

// Do executes DOM.requestChildNodes against the provided context.

Do executes DOM . requestChildNodes against the provided context .


func (p ResolveNodeParams) WithNodeID(nodeID cdp.NodeID) *ResolveNodeParams {
	p.NodeID = nodeID
	return &p
}

func ( p ResolveNodeParams ) WithNodeID ( nodeID cdp . NodeID ) * ResolveNodeParams { p . NodeID = nodeID return & p }

// WithNodeID ID of the node to resolve.


func (p ResolveNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *ResolveNodeParams {
	p.BackendNodeID = backendNodeID
	return &p
}

func ( p ResolveNodeParams ) WithBackendNodeID ( backendNodeID cdp . BackendNodeID ) * ResolveNodeParams { p . BackendNodeID = backendNodeID return & p }

// WithBackendNodeID backend identifier of the node to resolve.

WithBackendNodeID backend identifier of the node to resolve .


func (p ResolveNodeParams) WithExecutionContextID(executionContextID runtime.ExecutionContextID) *ResolveNodeParams {
	p.ExecutionContextID = executionContextID
	return &p
}

func ( p ResolveNodeParams ) WithExecutionContextID ( executionContextID runtime . ExecutionContextID ) * ResolveNodeParams { p . ExecutionContextID = executionContextID return & p }

// WithExecutionContextID execution context in which to resolve the node.

WithExecutionContextID execution context in which to resolve the node .


func (p *SetAttributeValueParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetAttributeValue, p, nil)
}

func ( p * SetAttributeValueParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetAttributeValue , p , nil ) }

// Do executes DOM.setAttributeValue against the provided context.

Do executes DOM . setAttributeValue against the provided context .


func (p SetAttributesAsTextParams) WithName(name string) *SetAttributesAsTextParams {
	p.Name = name
	return &p
}

func ( p SetAttributesAsTextParams ) WithName ( name string ) * SetAttributesAsTextParams { p . Name = name return & p }

// WithName attribute name to replace with new attributes derived from text
// in case text parsed successfully.

WithName attribute name to replace with new attributes derived from text in case text parsed successfully .


func (p *SetAttributesAsTextParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetAttributesAsText, p, nil)
}

func ( p * SetAttributesAsTextParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetAttributesAsText , p , nil ) }

// Do executes DOM.setAttributesAsText against the provided context.

Do executes DOM . setAttributesAsText against the provided context .


func (p *SetFileInputFilesParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetFileInputFiles, p, nil)
}

func ( p * SetFileInputFilesParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetFileInputFiles , p , nil ) }

// Do executes DOM.setFileInputFiles against the provided context.

Do executes DOM . setFileInputFiles against the provided context .


func (p *SetInspectedNodeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetInspectedNode, p, nil)
}

func ( p * SetInspectedNodeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetInspectedNode , p , nil ) }

// Do executes DOM.setInspectedNode against the provided context.

Do executes DOM . setInspectedNode against the provided context .


func (p *SetNodeValueParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetNodeValue, p, nil)
}

func ( p * SetNodeValueParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetNodeValue , p , nil ) }

// Do executes DOM.setNodeValue against the provided context.

Do executes DOM . setNodeValue against the provided context .


func (p *SetOuterHTMLParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetOuterHTML, p, nil)
}

func ( p * SetOuterHTMLParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetOuterHTML , p , nil ) }

// Do executes DOM.setOuterHTML against the provided context.

Do executes DOM . setOuterHTML against the provided context .


func (p *UndoParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUndo, nil, nil)
}

func ( p * UndoParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUndo , nil , nil ) }

// Do executes DOM.undo against the provided context.

Do executes DOM . undo against the provided context .


func (p *ForcePseudoStateParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandForcePseudoState, p, nil)
}

func ( p * ForcePseudoStateParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandForcePseudoState , p , nil ) }

// Do executes CSS.forcePseudoState against the provided context.

Do executes CSS . forcePseudoState against the provided context .


func (p *SetEffectivePropertyValueForNodeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetEffectivePropertyValueForNode, p, nil)
}

func ( p * SetEffectivePropertyValueForNodeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetEffectivePropertyValueForNode , p , nil ) }

// Do executes CSS.setEffectivePropertyValueForNode against the provided context.

Do executes CSS . setEffectivePropertyValueForNode against the provided context .


func (p *StartRuleUsageTrackingParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandStartRuleUsageTracking, nil, nil)
}

func ( p * StartRuleUsageTrackingParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandStartRuleUsageTracking , nil , nil ) }

// Do executes CSS.startRuleUsageTracking against the provided context.

Do executes CSS . startRuleUsageTracking against the provided context .


func (p *CloseParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClose, p, nil)
}

func ( p * CloseParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandClose , p , nil ) }

// Do executes IO.close against the provided context.

Do executes IO . close against the provided context .


func (p *ClearDataForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandClearDataForOrigin, p, nil)
}

func ( p * ClearDataForOriginParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandClearDataForOrigin , p , nil ) }

// Do executes Storage.clearDataForOrigin against the provided context.

Do executes Storage . clearDataForOrigin against the provided context .


func (p *TrackCacheStorageForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackCacheStorageForOrigin, p, nil)
}

func ( p * TrackCacheStorageForOriginParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandTrackCacheStorageForOrigin , p , nil ) }

// Do executes Storage.trackCacheStorageForOrigin against the provided context.

Do executes Storage . trackCacheStorageForOrigin against the provided context .


func (p *TrackIndexedDBForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandTrackIndexedDBForOrigin, p, nil)
}

func ( p * TrackIndexedDBForOriginParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandTrackIndexedDBForOrigin , p , nil ) }

// Do executes Storage.trackIndexedDBForOrigin against the provided context.

Do executes Storage . trackIndexedDBForOrigin against the provided context .


func (p *UntrackCacheStorageForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackCacheStorageForOrigin, p, nil)
}

func ( p * UntrackCacheStorageForOriginParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUntrackCacheStorageForOrigin , p , nil ) }

// Do executes Storage.untrackCacheStorageForOrigin against the provided context.

Do executes Storage . untrackCacheStorageForOrigin against the provided context .


func (p *UntrackIndexedDBForOriginParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandUntrackIndexedDBForOrigin, p, nil)
}

func ( p * UntrackIndexedDBForOriginParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandUntrackIndexedDBForOrigin , p , nil ) }

// Do executes Storage.untrackIndexedDBForOrigin against the provided context.

Do executes Storage . untrackIndexedDBForOrigin against the provided context .


func (p *HideHighlightParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandHideHighlight, nil, nil)
}

func ( p * HideHighlightParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandHideHighlight , nil , nil ) }

// Do executes Overlay.hideHighlight against the provided context.

Do executes Overlay . hideHighlight against the provided context .


func (p *HighlightFrameParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandHighlightFrame, p, nil)
}

func ( p * HighlightFrameParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandHighlightFrame , p , nil ) }

// Do executes Overlay.highlightFrame against the provided context.

Do executes Overlay . highlightFrame against the provided context .


func (p HighlightNodeParams) WithNodeID(nodeID cdp.NodeID) *HighlightNodeParams {
	p.NodeID = nodeID
	return &p
}

func ( p HighlightNodeParams ) WithNodeID ( nodeID cdp . NodeID ) * HighlightNodeParams { p . NodeID = nodeID return & p }

// WithNodeID identifier of the node to highlight.

WithNodeID identifier of the node to highlight .


func (p HighlightNodeParams) WithBackendNodeID(backendNodeID cdp.BackendNodeID) *HighlightNodeParams {
	p.BackendNodeID = backendNodeID
	return &p
}

func ( p HighlightNodeParams ) WithBackendNodeID ( backendNodeID cdp . BackendNodeID ) * HighlightNodeParams { p . BackendNodeID = backendNodeID return & p }

// WithBackendNodeID identifier of the backend node to highlight.

WithBackendNodeID identifier of the backend node to highlight .


func (p HighlightNodeParams) WithObjectID(objectID runtime.RemoteObjectID) *HighlightNodeParams {
	p.ObjectID = objectID
	return &p
}

func ( p HighlightNodeParams ) WithObjectID ( objectID runtime . RemoteObjectID ) * HighlightNodeParams { p . ObjectID = objectID return & p }

// WithObjectID JavaScript object id of the node to be highlighted.

WithObjectID JavaScript object id of the node to be highlighted .


func (p HighlightNodeParams) WithSelector(selector string) *HighlightNodeParams {
	p.Selector = selector
	return &p
}

func ( p HighlightNodeParams ) WithSelector ( selector string ) * HighlightNodeParams { p . Selector = selector return & p }

// WithSelector selectors to highlight relevant nodes.

WithSelector selectors to highlight relevant nodes .


func (p *HighlightNodeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandHighlightNode, p, nil)
}

func ( p * HighlightNodeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandHighlightNode , p , nil ) }

// Do executes Overlay.highlightNode against the provided context.

Do executes Overlay . highlightNode against the provided context .


func (p *HighlightQuadParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandHighlightQuad, p, nil)
}

func ( p * HighlightQuadParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandHighlightQuad , p , nil ) }

// Do executes Overlay.highlightQuad against the provided context.

Do executes Overlay . highlightQuad against the provided context .


func (p *HighlightRectParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandHighlightRect, p, nil)
}

func ( p * HighlightRectParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandHighlightRect , p , nil ) }

// Do executes Overlay.highlightRect against the provided context.

Do executes Overlay . highlightRect against the provided context .


func (p SetInspectModeParams) WithHighlightConfig(highlightConfig *HighlightConfig) *SetInspectModeParams {
	p.HighlightConfig = highlightConfig
	return &p
}

func ( p SetInspectModeParams ) WithHighlightConfig ( highlightConfig * HighlightConfig ) * SetInspectModeParams { p . HighlightConfig = highlightConfig return & p }

// WithHighlightConfig a descriptor for the highlight appearance of
// hovered-over nodes. May be omitted if enabled == false.

WithHighlightConfig a descriptor for the highlight appearance of hovered - over nodes . May be omitted if enabled == false .


func (p *SetInspectModeParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetInspectMode, p, nil)
}

func ( p * SetInspectModeParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetInspectMode , p , nil ) }

// Do executes Overlay.setInspectMode against the provided context.

Do executes Overlay . setInspectMode against the provided context .


func (p *SetShowAdHighlightsParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetShowAdHighlights, p, nil)
}

func ( p * SetShowAdHighlightsParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetShowAdHighlights , p , nil ) }

// Do executes Overlay.setShowAdHighlights against the provided context.

Do executes Overlay . setShowAdHighlights against the provided context .


func (p SetPausedInDebuggerMessageParams) WithMessage(message string) *SetPausedInDebuggerMessageParams {
	p.Message = message
	return &p
}

func ( p SetPausedInDebuggerMessageParams ) WithMessage ( message string ) * SetPausedInDebuggerMessageParams { p . Message = message return & p }

// WithMessage the message to display, also triggers resume and step over
// controls.

WithMessage the message to display also triggers resume and step over controls .


func (p *SetPausedInDebuggerMessageParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetPausedInDebuggerMessage, p, nil)
}

func ( p * SetPausedInDebuggerMessageParams ) Do ( ctx context . Context ) ( err error ) { return cdp . Execute ( ctx , CommandSetPausedInDebuggerMessage , p , nil ) }

// Do executes Overlay.setPausedInDebuggerMessage against the provided context.

Do executes Overlay . setPausedInDebuggerMessage against the provided context .