From a2d0210780592eb8632ec443ec932070084a7dd2 Mon Sep 17 00:00:00 2001 From: 9seconds Date: Tue, 19 Jun 2018 11:16:47 +0300 Subject: [PATCH] Mention run-mtg script --- README.md | 2 ++ config/global_ips.go | 7 ++++--- run-mtg.sh | 1 + 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ac4875..f697f0d 100644 --- a/README.md +++ b/README.md @@ -96,3 +96,5 @@ $ docker run --name mtg --restart=unless-stopped -p 444:3128 -p 3129:3129 -d nin You will have this tool up and running on port 444. Now curl `localhost:3129` to get `tg://` links or do `docker logs mtg`. Also, port 3129 will show you some statistics if you are interested in. + +Also, you can use [run-mtg.sh](https://github.com/9seconds/mtg/blob/master/run-mtg.sh) script diff --git a/config/global_ips.go b/config/global_ips.go index 5a73747..cf695c9 100644 --- a/config/global_ips.go +++ b/config/global_ips.go @@ -24,14 +24,15 @@ func fetchIP(url string) (net.IP, error) { } defer resp.Body.Close() // nolint: errcheck - respData, err := ioutil.ReadAll(resp.Body) + respDataBytes, err := ioutil.ReadAll(resp.Body) if err != nil { return nil, err } + respData := strings.TrimSpace(string(respDataBytes)) - ip := net.ParseIP(strings.TrimSpace(string(respData))) + ip := net.ParseIP(respData) if ip == nil { - return nil, errors.Errorf("ifconfig.co returns incorrect IP %s", resp) + return nil, errors.Errorf("ifconfig.co returns incorrect IP %s", respData) } return ip, nil diff --git a/run-mtg.sh b/run-mtg.sh index 8edd1cf..7cc965e 100755 --- a/run-mtg.sh +++ b/run-mtg.sh @@ -15,6 +15,7 @@ STAT_PORT=3129 # docker pull "$IMAGE_NAME" docker ps --filter "Name=$CONTAINER_NAME" -aq | xargs -r docker rm -fv docker run \ + -d \ --name "$CONTAINER_NAME" \ --sysctl 'net.ipv4.ip_local_port_range=10000 65000' \ --sysctl net.ipv4.tcp_congestion_control=bbr \