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
This commit is contained in:
Andrew Gaul 2017-01-13 15:42:17 -08:00
parent 635da9b1a6
commit a7569356c1

View file

@ -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)