| Index: web_page_replay_go/src/wpr.go
|
| diff --git a/web_page_replay_go/src/wpr.go b/web_page_replay_go/src/wpr.go
|
| index 159b9dbf8ee5c3586d94026824cf0c42ad3a9416..3f715651dae84a77e7f5d9c248f7227360ee1bfb 100644
|
| --- a/web_page_replay_go/src/wpr.go
|
| +++ b/web_page_replay_go/src/wpr.go
|
| @@ -83,6 +83,7 @@ type ReplayCommand struct {
|
|
|
| type RootCACommand struct {
|
| certConfig CertConfig
|
| + isAndroid bool
|
| cmd cli.Command
|
| }
|
|
|
| @@ -358,21 +359,14 @@ func (r *ReplayCommand) Run(c *cli.Context) {
|
| }
|
|
|
| func (r *RootCACommand) Install(c *cli.Context) {
|
| - log.Printf("Loading cert from %v\n", r.certConfig.certFile)
|
| - log.Printf("Loading key from %v\n", r.certConfig.keyFile)
|
| - root_cert, err := tls.LoadX509KeyPair(r.certConfig.certFile, r.certConfig.keyFile)
|
| - if err != nil {
|
| - fmt.Fprintf(os.Stderr, "error opening cert or key files: %v", err)
|
| - os.Exit(1)
|
| - }
|
| - err = webpagereplay.InstallRoot(root_cert.Certificate[0])
|
| - if err != nil {
|
| + if err := webpagereplay.InstallRoot(r.certConfig.certFile, r.certConfig.keyFile, r.isAndroid); err != nil {
|
| fmt.Fprintf(os.Stderr, "Install root failed: %v", err)
|
| + os.Exit(1)
|
| }
|
| }
|
|
|
| func (r *RootCACommand) Remove(c *cli.Context) {
|
| - webpagereplay.RemoveRoot()
|
| + webpagereplay.RemoveRoot(r.isAndroid)
|
| }
|
|
|
| func main() {
|
| @@ -400,15 +394,28 @@ func main() {
|
| }
|
|
|
| installroot.cmd = cli.Command{
|
| - Name: "installroot",
|
| - Usage: "Install a test root CA",
|
| - Flags: installroot.certConfig.Flags(),
|
| + Name: "installroot",
|
| + Usage: "Install a test root CA",
|
| + Flags: append(installroot.certConfig.Flags(),
|
| + cli.BoolFlag{
|
| + Name: "android",
|
| + Hidden: false,
|
| + Usage: "If specified, will install test root CA on an android device.",
|
| + Destination: &installroot.isAndroid,
|
| + }),
|
| Action: installroot.Install,
|
| }
|
|
|
| removeroot.cmd = cli.Command{
|
| - Name: "removeroot",
|
| - Usage: "Remove a test root CA",
|
| + Name: "removeroot",
|
| + Usage: "Remove a test root CA",
|
| + Flags: []cli.Flag{
|
| + cli.BoolFlag{
|
| + Name: "android",
|
| + Hidden: false,
|
| + Usage: "If specified, will remove test root CA from an android device.",
|
| + Destination: &removeroot.isAndroid,
|
| + }},
|
| Action: removeroot.Remove,
|
| }
|
|
|
|
|