From a7569356c1b9353a427c267bb9f66b5ac9c57f4b Mon Sep 17 00:00:00 2001 From: Andrew Gaul Date: Fri, 13 Jan 2017 15:42:17 -0800 Subject: [PATCH] Add friendly error for missing cert or key Previously compy failed with the confusing: 2017/01/13 15:34:38 open : no such file or directory --- compy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/compy.go b/compy.go index aaf87ea..3395b06 100644 --- a/compy.go +++ b/compy.go @@ -26,6 +26,14 @@ func main() { p := proxy.New() + if (*ca == "") != (*caKey == "") { + log.Fatalln("must specify both CA certificate and key") + } + + if (*cert == "") != (*key == "") { + log.Fatalln("must specify both certificate and key") + } + if *ca != "" { if err := p.EnableMitm(*ca, *caKey); err != nil { fmt.Println("not using mitm:", err)