2017-01-24 15:09:23 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
2017-12-22 03:01:21 +00:00
|
|
|
//go:generate easyjson -omit_empty -output_filename easyjson.go chrome.go
|
2017-01-24 15:09:23 +00:00
|
|
|
|
2018-07-13 04:24:37 +00:00
|
|
|
// Chrome holds connection information for a Chrome target.
|
2017-01-24 15:09:23 +00:00
|
|
|
//
|
|
|
|
//easyjson:json
|
|
|
|
type Chrome struct {
|
|
|
|
Description string `json:"description,omitempty"`
|
|
|
|
DevtoolsURL string `json:"devtoolsFrontendUrl,omitempty"`
|
|
|
|
ID string `json:"id,omitempty"`
|
|
|
|
Title string `json:"title,omitempty"`
|
|
|
|
Type TargetType `json:"type,omitempty"`
|
|
|
|
URL string `json:"url,omitempty"`
|
|
|
|
WebsocketURL string `json:"webSocketDebuggerUrl,omitempty"`
|
2017-07-14 06:58:33 +00:00
|
|
|
FaviconURL string `json:"faviconURL,omitempty"`
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// String satisfies the stringer interface.
|
|
|
|
func (c Chrome) String() string {
|
2018-07-13 04:24:37 +00:00
|
|
|
return fmt.Sprintf("[%s]: %q", c.ID, c.Title)
|
2017-01-24 15:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// GetID returns the target ID.
|
|
|
|
func (c *Chrome) GetID() string {
|
|
|
|
return c.ID
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetType returns the target type.
|
|
|
|
func (c *Chrome) GetType() TargetType {
|
|
|
|
return c.Type
|
|
|
|
}
|
|
|
|
|
2018-07-13 04:24:37 +00:00
|
|
|
// GetDevtoolsURL returns the devtools frontend target URL, satisfying the
|
|
|
|
// domains.Target interface.
|
|
|
|
func (c *Chrome) GetDevtoolsURL() string {
|
|
|
|
return c.DevtoolsURL
|
|
|
|
}
|
|
|
|
|
2017-01-24 15:09:23 +00:00
|
|
|
// GetWebsocketURL provides the websocket URL for the target, satisfying the
|
|
|
|
// domains.Target interface.
|
|
|
|
func (c *Chrome) GetWebsocketURL() string {
|
|
|
|
return c.WebsocketURL
|
|
|
|
}
|