diff options
author | Galen Guyer <galen@galenguyer.com> | 2023-03-23 11:02:08 -0400 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2023-03-23 11:05:04 -0400 |
commit | 8e816bf9f76f3a282511201302b20c7fc7bbd289 (patch) | |
tree | 79fbfcbdac752ee4360f7a3a45d3ce8dc51bdb1d | |
parent | 45572a7ee4b0f761d337e5ee91e01d5d04906a90 (diff) |
improve documentation and add docker-compose file
-rw-r--r-- | Dockerfile | 3 | ||||
-rw-r--r-- | README.md | 23 | ||||
-rw-r--r-- | docker-compose.yaml | 11 | ||||
-rw-r--r-- | main.go | 6 |
4 files changed, 38 insertions, 5 deletions
@@ -2,9 +2,8 @@ FROM docker.io/golang:1.20-alpine AS builder WORKDIR /src/ COPY go.mod go.sum main.go /src/ -RUN go build +RUN go build -v FROM alpine COPY --from=builder /src/lolproxy /lolproxy -EXPOSE 6969 ENTRYPOINT [ "/lolproxy", "--host", "0.0.0.0:6969" ] @@ -1,3 +1,26 @@ # lolproxy "some fuckshit that changes your response codes" + +## running +``` +Usage of ./lolproxy: + -host string + host to bind to (default "localhost:6969") + -only404 + only change status code to 404 + -upstream string + upstream host to proxy to (required) +``` +example: `./lolproxy --upstream https://example.com` + +## docker +the docker image binds to `0.0.0.0:6969` by default, so you'll need to expose the port (`--port 127.0.0.1:6969:6969`). +you'll also need to set the upstream as the command + +example: `docker run --rm -it -p 127.0.0.1:6969:6969 docker.io/galenguyer/lolproxy --upstream https://example.com` + +### docker-compose +a compose file is also provided for your inconvenience. it can be ran with `docker-compose up --build` + +you can also command out the `build` directive and uncomment the `image` directive to use the latest image from docker hub
\ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..28a341c --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,11 @@ +version: "3" + +services: + lolproxy: + #image: docker.io/galenguyer/lolproxy:latest + build: . + command: + - "--upstream" + - "https://example.com" + ports: + - "127.0.0.1:6969:6969" @@ -11,8 +11,8 @@ import ( func main() { host := flag.String("host", "localhost:6969", "host to bind to") - upstreamFlag := flag.String("upstream", "", "upstream host to proxy to") - only404 := flag.Bool("only404", false, "only change 404 status code") + upstreamFlag := flag.String("upstream", "", "upstream host to proxy to (required)") + only404 := flag.Bool("only404", false, "only change status code to 404") flag.Parse() if *upstreamFlag == "" { @@ -23,7 +23,7 @@ func main() { log.Fatal(err) } if upstream.Host == "" { - log.Fatal("upstream host is required") + log.Fatal("upstream host is required (you may be missing the protocol, ie http://)") } if upstream.Scheme == "" { upstream.Scheme = "http" |