1
0
mirror of https://github.com/MontFerret/ferret.git synced 2025-01-18 03:22:02 +02:00
ferret/pkg/drivers/cdp/options.go
Tim Voronov 5620be211c
Next (#214)
* Renamed DOCUMENT to PAGE

* Added PageLoadParams

* Added PageLoadParams

* Renamed LoadPageParams -> PageLoadParams

* Added support for context.Done() (#201)

* Bug/#189 operators precedence (#202)

* Fixed math operators precedence

* Fixed logical operators precedence

* Fixed array operator

* Added support for parentheses to enforce a different operator evaluation order

* Feature/#200 drivers (#209)

* Added new interfaces

* Renamed dynamic to cdp driver

* Renamed drivers

* Added ELEMENT_EXISTS function (#210)

* Renamed back PAGE to DOCUMENT (#211)

* Added Getter and Setter interfaces
2018-12-21 23:14:41 -05:00

43 lines
650 B
Go

package cdp
type (
Options struct {
proxy string
userAgent string
address string
}
Option func(opts *Options)
)
const DefaultAddress = "http://127.0.0.1:9222"
func newOptions(setters []Option) *Options {
opts := new(Options)
opts.address = DefaultAddress
for _, setter := range setters {
setter(opts)
}
return opts
}
func WithAddress(address string) Option {
return func(opts *Options) {
opts.address = address
}
}
func WithProxy(address string) Option {
return func(opts *Options) {
opts.proxy = address
}
}
func WithUserAgent(value string) Option {
return func(opts *Options) {
opts.userAgent = value
}
}