| Index: ct/go/util/util.go
|
| diff --git a/ct/go/util/util.go b/ct/go/util/util.go
|
| index f126532cd9f9cfc8c4265e20e72c90c18c0dddc7..6030b4de27f23fc843c9ad47bfa7133c51fdfb10 100644
|
| --- a/ct/go/util/util.go
|
| +++ b/ct/go/util/util.go
|
| @@ -3,6 +3,7 @@ package util
|
|
|
| import (
|
| "bufio"
|
| + "encoding/json"
|
| "fmt"
|
| "io"
|
| "io/ioutil"
|
| @@ -237,3 +238,25 @@ func ChromeProcessesCleaner(locker sync.Locker, chromeCleanerTimer time.Duration
|
| locker.Unlock()
|
| }
|
| }
|
| +
|
| +// Contains the data included in CT pagesets.
|
| +type PagesetVars struct {
|
| + // A comma separated list of URLs.
|
| + UrlsList string `json:"urls_list"`
|
| + // Will be either "mobile" or "desktop".
|
| + UserAgent string `json:"user_agent"`
|
| + // The location of the web page's WPR data file.
|
| + ArchiveDataFile string `json:"archive_data_file"`
|
| +}
|
| +
|
| +func ReadPageset(pagesetPath string) (PagesetVars, error) {
|
| + decodedPageset := PagesetVars{}
|
| + pagesetContent, err := os.Open(pagesetPath)
|
| + if err != nil {
|
| + return decodedPageset, fmt.Errorf("Could not read %s: %s", pagesetPath, err)
|
| + }
|
| + if err := json.NewDecoder(pagesetContent).Decode(&decodedPageset); err != nil {
|
| + return decodedPageset, fmt.Errorf("Could not JSON decode %s: %s", pagesetPath, err)
|
| + }
|
| + return decodedPageset, nil
|
| +}
|
|
|