goproxy icon indicating copy to clipboard operation
goproxy copied to clipboard

be able to configure defaultTLSConfig from the goproxy-eavesdropper example?

Open rgl opened this issue 9 years ago • 0 comments

Is there a way to configure the defaultTLSConfig from the goproxy-eavesdropper example?

my goal is to try to create a dummy caching server that just saves requests to disk and replies with the cached response if they already exist. I'm not sure If I should just implement a ConnectAction instead of trying to set defaultTLSConfig. But as we can already set GoproxyCa maybe having defaultTLSConfig private was an overlook (or the other way around)?

FYI, as a simple test, I was able to configure the CA certificate with something like:

...
	keypair := flag.String("k", "", "TLS keypair to use")
...
	flag.Parse()
	if keypair != nil {
		kp, err := ioutil.ReadFile(*keypair)
		if err != nil {
			log.Fatal(err)
		}
		ca, err := tls.X509KeyPair(kp, kp)
		if err != nil {
			log.Fatal(err)
		}
		goproxy.GoproxyCa = ca
	}

rgl avatar Jan 17 '17 16:01 rgl