mirror of
https://github.com/dcarrillo/whatismyip.git
synced 2024-12-22 13:18:01 +00:00
Tidy up the house
This commit is contained in:
parent
f7d0a679c9
commit
ab46275990
15
README.md
15
README.md
@ -3,6 +3,7 @@
|
|||||||
[![CI](https://github.com/dcarrillo/whatismyip/workflows/CI/badge.svg)](https://github.com/dcarrillo/whatismyip/actions)
|
[![CI](https://github.com/dcarrillo/whatismyip/workflows/CI/badge.svg)](https://github.com/dcarrillo/whatismyip/actions)
|
||||||
[![Go Report Card](https://goreportcard.com/badge/github.com/dcarrillo/whatismyip)](https://goreportcard.com/report/github.com/dcarrillo/whatismyip)
|
[![Go Report Card](https://goreportcard.com/badge/github.com/dcarrillo/whatismyip)](https://goreportcard.com/report/github.com/dcarrillo/whatismyip)
|
||||||
[![GitHub release](https://img.shields.io/github/release/dcarrillo/whatismyip.svg)](https://github.com/dcarrillo/whatismyip/releases/)
|
[![GitHub release](https://img.shields.io/github/release/dcarrillo/whatismyip.svg)](https://github.com/dcarrillo/whatismyip/releases/)
|
||||||
|
[![License Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE)
|
||||||
|
|
||||||
- [What is my IP address](#what-is-my-ip-address)
|
- [What is my IP address](#what-is-my-ip-address)
|
||||||
- [Features](#features)
|
- [Features](#features)
|
||||||
@ -15,7 +16,7 @@
|
|||||||
- [Run a default TCP server with a custom template and trust a custom header set by an upstream proxy](#run-a-default-tcp-server-with-a-custom-template-and-trust-a-custom-header-set-by-an-upstream-proxy)
|
- [Run a default TCP server with a custom template and trust a custom header set by an upstream proxy](#run-a-default-tcp-server-with-a-custom-template-and-trust-a-custom-header-set-by-an-upstream-proxy)
|
||||||
- [Download](#download)
|
- [Download](#download)
|
||||||
- [Docker](#docker)
|
- [Docker](#docker)
|
||||||
- [Running a container locally using test databases](#running-a-container-locally-using-test-databases)
|
- [Run a container locally using test databases](#run-a-container-locally-using-test-databases)
|
||||||
- [From Docker Hub](#from-docker-hub)
|
- [From Docker Hub](#from-docker-hub)
|
||||||
|
|
||||||
Just another "what is my IP address" service, including geolocation and headers information, written in go with high performance in mind, it uses [gin](https://github.com/gin-gonic/gin) which uses [httprouter](https://github.com/julienschmidt/httprouter) a lightweight high performance HTTP multiplexer.
|
Just another "what is my IP address" service, including geolocation and headers information, written in go with high performance in mind, it uses [gin](https://github.com/gin-gonic/gin) which uses [httprouter](https://github.com/julienschmidt/httprouter) a lightweight high performance HTTP multiplexer.
|
||||||
@ -103,13 +104,15 @@ Usage of ./whatismyip:
|
|||||||
### Run a TLS (HTTP/2) server only
|
### Run a TLS (HTTP/2) server only
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb -bind "" -tls-bind :8081 -tls-crt ./test/server.pem -tls-key ./test/server.key
|
./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb \
|
||||||
|
-bind "" -tls-bind :8081 -tls-crt ./test/server.pem -tls-key ./test/server.key
|
||||||
```
|
```
|
||||||
|
|
||||||
### Run a default TCP server with a custom template and trust a custom header set by an upstream proxy
|
### Run a default TCP server with a custom template and trust a custom header set by an upstream proxy
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb -trusted-header X-Real-IP -template mytemplate.tmpl
|
./whatismyip -geoip2-city ./test/GeoIP2-City-Test.mmdb -geoip2-asn ./test/GeoLite2-ASN-Test.mmdb \
|
||||||
|
-trusted-header X-Real-IP -template mytemplate.tmpl
|
||||||
```
|
```
|
||||||
|
|
||||||
## Download
|
## Download
|
||||||
@ -120,7 +123,7 @@ Download latest version from https://github.com/dcarrillo/whatismyip/releases
|
|||||||
|
|
||||||
An ultra-light (~9MB) image is available.
|
An ultra-light (~9MB) image is available.
|
||||||
|
|
||||||
### Running a container locally using test databases
|
### Run a container locally using test databases
|
||||||
|
|
||||||
`make docker-run`
|
`make docker-run`
|
||||||
|
|
||||||
@ -131,6 +134,6 @@ docker run --tty --interactive --rm \
|
|||||||
-v $PWD/<path to city database>:/tmp/GeoIP2-City-Test.mmdb:ro \
|
-v $PWD/<path to city database>:/tmp/GeoIP2-City-Test.mmdb:ro \
|
||||||
-v $PWD/<path to ASN database>:/tmp/GeoLite2-ASN-Test.mmdb:ro -p 8080:8080 \
|
-v $PWD/<path to ASN database>:/tmp/GeoLite2-ASN-Test.mmdb:ro -p 8080:8080 \
|
||||||
dcarrillo/whatismyip:latest \
|
dcarrillo/whatismyip:latest \
|
||||||
-geoip2-city /tmp/GeoIP2-City-Test.mmdb \
|
-geoip2-city /tmp/GeoIP2-City-Test.mmdb \
|
||||||
-geoip2-asn /tmp/GeoLite2-ASN-Test.mmdb
|
-geoip2-asn /tmp/GeoLite2-ASN-Test.mmdb
|
||||||
```
|
```
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
// Version to be defined on build time
|
// Version to be defined at build time
|
||||||
var Version = "tobedefined"
|
var Version = "tobedefined"
|
||||||
|
@ -7,11 +7,6 @@ import (
|
|||||||
"github.com/oschwald/maxminddb-golang"
|
"github.com/oschwald/maxminddb-golang"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Record is the interface to be implemented for record operations
|
|
||||||
type Record interface {
|
|
||||||
LookUp(ip net.IP)
|
|
||||||
}
|
|
||||||
|
|
||||||
// GeoRecord is the model for City database
|
// GeoRecord is the model for City database
|
||||||
type GeoRecord struct {
|
type GeoRecord struct {
|
||||||
Country struct {
|
Country struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user