aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorterminaldweller <thabogre@gmail.com>2023-01-30 17:12:54 +0000
committerterminaldweller <thabogre@gmail.com>2023-01-30 17:12:54 +0000
commit15f245763ba7b412e6dbe16e6768f40a789067f2 (patch)
treec7b503d0e236df68cb0261b628d6c9433ca7ad47
parentfixed the common name for the self-signed cert (diff)
downloadicanhazallips-15f245763ba7b412e6dbe16e6768f40a789067f2.tar.gz
icanhazallips-15f245763ba7b412e6dbe16e6768f40a789067f2.zip
added a readme
Diffstat (limited to '')
-rw-r--r--Dockerfile4
-rw-r--r--README.md6
-rw-r--r--icanhazallips.go3
3 files changed, 10 insertions, 3 deletions
diff --git a/Dockerfile b/Dockerfile
index 917b592..1ef3b07 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -13,8 +13,8 @@ RUN apk add openssl
WORKDIR /certs
RUN openssl req -nodes -new -x509 -subj="CN=icanhazallips.terminaldweller.com" -keyout server.key -out server.cert
-FROM gcr.io/distroless/static-debian11
-# FROM alpine:3.17
+# FROM gcr.io/distroless/static-debian11
+FROM alpine:3.17
COPY --from=certbuilder /certs /certs
COPY --from=builder /icanhazallips/icanhazallips /icanhazallips/icanhazallips
ENTRYPOINT ["/icanhazallips/icanhazallips"]
diff --git a/README.md b/README.md
index e3fbf86..2d2b9ff 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,5 @@
-# icanhazallips \ No newline at end of file
+# icanhazallips
+
+Returns the IP address of the caller. It's a poor man's version of icanhazip.com.</br>
+I wasnt sure how many requests I could do before they banned me so I made this instead.</br>
+Don't want IPs getting banned by cloudflare.</br>
diff --git a/icanhazallips.go b/icanhazallips.go
index 218063c..68a2f82 100644
--- a/icanhazallips.go
+++ b/icanhazallips.go
@@ -3,6 +3,7 @@ package main
import (
"errors"
+ "fmt"
"log"
"net"
"net/http"
@@ -13,6 +14,8 @@ func getIP(r *http.Request) (string, error) {
ips := r.Header.Get("X-Forwarded-For")
splitIps := strings.Split(ips, ",")
+ fmt.Println(r.RemoteAddr)
+
if len(splitIps) > 0 {
netIP := net.ParseIP(splitIps[len(splitIps)-1])
if netIP != nil {