From 5512a9e325acbb298683d0caa2dd7f9f0ce99259 Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Sun, 15 Oct 2017 20:34:45 -0400 Subject: [PATCH 1/4] Use new() over empty struct init --- connection.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/connection.go b/connection.go index 4fe5576..8878d31 100644 --- a/connection.go +++ b/connection.go @@ -103,9 +103,9 @@ func (c *connection) Handle() { logger.Info.Println(c.id, "Processing connection to:", request.Method, request.Host) if request.Method == "CONNECT" { - c.proxy = &httpsProxy{} + c.proxy = new(httpsProxy) } else { - c.proxy = &httpProxy{} + c.proxy = new(httpProxy) } err = c.proxy.SetupOutgoing(c, request) From 1ebfcbff6e034e2811d844b10748a4411c7d701f Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Sat, 6 Oct 2018 13:46:52 -0400 Subject: [PATCH 2/4] Switch dockerfile to 1.11 --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1ded695..e8db9e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.8.1-alpine +FROM golang:1.11-alpine ADD . /turbulence WORKDIR /turbulence ENV GOPATH /turbulence From 1c683128b7a5757c24168e916a3e9956b961d895 Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Sat, 6 Oct 2018 14:24:44 -0400 Subject: [PATCH 3/4] Move Dockerfile to be from scratch --- Dockerfile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e8db9e7..ca3efe9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,10 @@ -FROM golang:1.11-alpine +FROM golang:1.11-alpine as builder ADD . /turbulence WORKDIR /turbulence ENV GOPATH /turbulence -RUN go build -ENTRYPOINT ["/turbulence/turbulence"] +RUN CGO_ENABLED=0 go build + +FROM scratch +COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +COPY --from=builder /turbulence/turbulence / +ENTRYPOINT ["/turbulence"] From 751cc94c0c84dcf6344a11c6c30a36b7752e6e0a Mon Sep 17 00:00:00 2001 From: Garrett Thornburg Date: Sat, 6 Oct 2018 14:28:18 -0400 Subject: [PATCH 4/4] Update README --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33506cb..f4279ef 100644 --- a/README.md +++ b/README.md @@ -14,10 +14,16 @@ $ go get github.com/film42/turbulence $ ./bin/turbulence ``` -Or you can grab the pre-built docker container: +Or you can grab the pre-built docker container with default options: ``` -$ docker run -p 26000:26000 -d film42/turbulence:latest --config test/config.json +$ docker run -p 25000:25000 -d film42/turbulence:latest +``` + +Or use your own config: + +``` +$ docker run -p 26000:26000 -d -v $(pwd)/test:/config film42/turbulence:latest --config config/config.json ``` ### Configuring