From 0390ac743419231022d87f393eaa876876e76ee9 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Wed, 15 Dec 2021 00:21:20 -0500 Subject: Basic implementation complete. --- mc/mc.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'mc') diff --git a/mc/mc.go b/mc/mc.go index a70f16e..710e203 100644 --- a/mc/mc.go +++ b/mc/mc.go @@ -13,6 +13,7 @@ var chunkSize int = 5000 type MeasurableConnection interface { Start(context.Context, bool) bool Transferred() uint64 + Client() *http.Client } type LoadBearingDownload struct { @@ -25,10 +26,30 @@ func (lbd *LoadBearingDownload) Transferred() uint64 { return lbd.downloaded } +func (lbd *LoadBearingDownload) Client() *http.Client { + return lbd.client +} + func (lbd *LoadBearingDownload) Start(ctx context.Context, debug bool) bool { lbd.downloaded = 0 lbd.client = &http.Client{} + // At some point this might be useful: It is a snippet of code that will enable + // logging of per-session TLS key material in order to make debugging easier in + // Wireshark. + /* + lbd.client = &http.Client{ + Transport: &http2.Transport{ + TLSClientConfig: &tls.Config{ + KeyLogWriter: w, + + Rand: utilities.RandZeroSource{}, // for reproducible output; don't do this. + InsecureSkipVerify: true, // test server certificate is not trusted. + }, + }, + } + */ + if debug { fmt.Printf("Started a load bearing download.\n") } @@ -64,6 +85,10 @@ func (lbu *LoadBearingUpload) Transferred() uint64 { return lbu.uploaded } +func (lbd *LoadBearingUpload) Client() *http.Client { + return lbd.client +} + type syntheticCountingReader struct { n *uint64 ctx context.Context -- cgit v1.2.3