53 Commits

Author SHA1 Message Date
Shizun Ge
8e1251ab4f Merge pull request #47 from shizunge/dependabot/github_actions/docker/build-push-action-4.0.0
Bump docker/build-push-action from 3.3.0 to 4.0.0
2023-02-11 01:29:57 -08:00
Shizun Ge
193c34d325 Merge pull request #46 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.4.0
Bump docker/setup-buildx-action from 2.3.0 to 2.4.0
2023-02-11 01:29:47 -08:00
Shizun Ge
8aeed47955 cleanup unnecessary codes 2023-02-11 01:24:59 -08:00
Shizun Ge
374c2b74ad report unknow location for local ip 2023-02-11 01:06:16 -08:00
Shizun Ge
c50302622e hard coded country to coordinates. update copyright date. 2023-02-11 00:53:31 -08:00
Shizun Ge
144e58aa7a fix using country db. We cannot get coordinates from the country now. 2023-02-10 22:46:45 -08:00
Shizun Ge
81ab381551 use geohash of the country if city is not available. 2023-02-10 22:26:31 -08:00
Shizun Ge
d9202cfca6 remove freegeoip.live as a provider 2023-02-10 22:22:32 -08:00
Shizun Ge
7c55c713a0 update go version to 1.20 2023-02-10 22:10:02 -08:00
dependabot[bot]
5bb568e6e5 Bump docker/build-push-action from 3.3.0 to 4.0.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.3.0 to 4.0.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.3.0...v4.0.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 08:03:47 +00:00
dependabot[bot]
1ff33d19b7 Bump docker/setup-buildx-action from 2.3.0 to 2.4.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.3.0 to 2.4.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.3.0...v2.4.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-06 08:03:42 +00:00
Shizun Ge
41d0618fa2 fix loading variables on time changes 2023-02-01 22:44:57 -08:00
Shizun Ge
0750caa4e9 Merge pull request #44 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.3.0
Bump docker/setup-buildx-action from 2.2.1 to 2.3.0
2023-01-31 23:37:24 -08:00
dependabot[bot]
ebabfd3790 Bump docker/setup-buildx-action from 2.2.1 to 2.3.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.2.1 to 2.3.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.2.1...v2.3.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-30 08:04:56 +00:00
Shizun Ge
fdf9842025 dashboard updates variables on time range change. 2023-01-29 20:59:43 -08:00
Shizun Ge
2773554b0a Merge pull request #43 from shizunge/dependabot/github_actions/docker/build-push-action-3.3.0
Bump docker/build-push-action from 3.2.0 to 3.3.0
2023-01-19 00:05:32 -08:00
dependabot[bot]
288c04f5e8 Bump docker/build-push-action from 3.2.0 to 3.3.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-01-16 08:04:23 +00:00
Shizun Ge
2fb8972eb3 Merge pull request #37 from shizunge/dependabot/go_modules/github.com/prometheus/client_golang-1.14.0
Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0
2022-12-21 00:43:52 -08:00
dependabot[bot]
43cf7695f1 Bump github.com/prometheus/client_golang from 1.13.0 to 1.14.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-11-14 08:05:26 +00:00
Shizun Ge
ae2f8c4baf update screen shot path 2022-10-29 21:36:12 -07:00
Shizun Ge
642ee0513e Merge pull request #35 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.2.1
Bump docker/setup-buildx-action from 2.1.0 to 2.2.1
2022-10-29 21:34:45 -07:00
dependabot[bot]
7f6b6718e1 Bump docker/setup-buildx-action from 2.1.0 to 2.2.1
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.1.0 to 2.2.1.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.1.0...v2.2.1)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-24 08:27:09 +00:00
Shizun Ge
7f0f69d7b5 fix the workflow name 2022-10-12 19:10:41 -07:00
Shizun Ge
b90cdfc2a1 change tag to development 2022-10-12 19:04:21 -07:00
Shizun Ge
e8f7a1b0bb keep only amd64, arm64 and armv7 builds 2022-10-12 18:57:42 -07:00
Shizun Ge
7d78f5161e do not update description on development builds 2022-10-12 18:50:11 -07:00
Shizun Ge
46e5a624be use distroless as base 2022-10-12 18:46:37 -07:00
Shizun Ge
5e4c3bb21a build docker image on push to main 2022-10-12 18:43:43 -07:00
Shizun Ge
75d7307134 Merge pull request #32 from shizunge/dependabot/github_actions/docker/login-action-2.1.0
Bump docker/login-action from 2.0.0 to 2.1.0
2022-10-12 17:41:28 -07:00
Shizun Ge
ece420b56b Merge pull request #33 from shizunge/dependabot/github_actions/docker/build-push-action-3.2.0
Bump docker/build-push-action from 3.1.1 to 3.2.0
2022-10-12 17:41:19 -07:00
Shizun Ge
c87861b4d6 Merge pull request #34 from shizunge/dependabot/github_actions/docker/setup-buildx-action-2.1.0
Bump docker/setup-buildx-action from 2.0.0 to 2.1.0
2022-10-12 17:41:08 -07:00
dependabot[bot]
69ea717d13 Bump docker/setup-buildx-action from 2.0.0 to 2.1.0
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:53 +00:00
dependabot[bot]
ff87416602 Bump docker/build-push-action from 3.1.1 to 3.2.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.1...v3.2.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:50 +00:00
dependabot[bot]
231518cb79 Bump docker/login-action from 2.0.0 to 2.1.0
Bumps [docker/login-action](https://github.com/docker/login-action) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/docker/login-action/releases)
- [Commits](https://github.com/docker/login-action/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: docker/login-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-13 00:39:44 +00:00
Shizun Ge
0950175e43 Merge pull request #31 from shizunge/prometheus
update Docker build base
2022-10-10 20:21:55 -07:00
Shizun Ge
d7c0c2ed79 Merge branch 'master' into prometheus 2022-10-10 20:08:58 -07:00
Shizun Ge
e8d7ae0889 update Docker build base 2022-10-10 20:06:59 -07:00
Shizun Ge
9aa7040976 Merge pull request #30 from shizunge/dependabot/go_modules/github.com/pierrre/geohash-1.1.0
Bump github.com/pierrre/geohash from 1.0.0 to 1.1.0
2022-09-24 13:44:46 -07:00
dependabot[bot]
5d6b1cdfe2 Bump github.com/pierrre/geohash from 1.0.0 to 1.1.0
Bumps [github.com/pierrre/geohash](https://github.com/pierrre/geohash) from 1.0.0 to 1.1.0.
- [Release notes](https://github.com/pierrre/geohash/releases)
- [Commits](https://github.com/pierrre/geohash/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: github.com/pierrre/geohash
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-22 08:23:14 +00:00
Shizun Ge
feadcf47e9 Merge pull request #29 from shizunge/dependabot/go_modules/github.com/oschwald/geoip2-golang-1.8.0
Bump github.com/oschwald/geoip2-golang from 1.7.0 to 1.8.0
2022-08-09 12:20:33 -07:00
dependabot[bot]
13a22dce68 Bump github.com/oschwald/geoip2-golang from 1.7.0 to 1.8.0
Bumps [github.com/oschwald/geoip2-golang](https://github.com/oschwald/geoip2-golang) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/oschwald/geoip2-golang/releases)
- [Commits](https://github.com/oschwald/geoip2-golang/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/oschwald/geoip2-golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-09 17:39:18 +00:00
Shizun Ge
b91fe8ab0c Merge pull request #28 from shizunge/dependabot/go_modules/github.com/prometheus/client_golang-1.13.0
Bump github.com/prometheus/client_golang from 1.12.2 to 1.13.0
2022-08-09 10:38:41 -07:00
Shizun Ge
1d868a27a8 Merge pull request #27 from shizunge/dependabot/github_actions/docker/build-push-action-3.1.1
Bump docker/build-push-action from 3.1.0 to 3.1.1
2022-08-09 10:38:33 -07:00
dependabot[bot]
17aa4a6a89 Bump github.com/prometheus/client_golang from 1.12.2 to 1.13.0
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.12.2 to 1.13.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prometheus/client_golang/compare/v1.12.2...v1.13.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 08:24:43 +00:00
dependabot[bot]
7a3b02b445 Bump docker/build-push-action from 3.1.0 to 3.1.1
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.1.0...v3.1.1)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-08 08:24:37 +00:00
Shizun Ge
492db60e81 Merge pull request #25 from shizunge/dependabot/github_actions/docker/build-push-action-3.1.0
Bump docker/build-push-action from 3.0.0 to 3.1.0
2022-07-25 17:25:49 -07:00
Shizun Ge
5bc042c0a5 Merge pull request #26 from shizunge/prometheus
Prometheus
2022-07-25 17:25:30 -07:00
dependabot[bot]
32c599c3a5 Bump docker/build-push-action from 3.0.0 to 3.1.0
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v3.0.0...v3.1.0)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-25 08:18:54 +00:00
Shizun Ge
5f597b596b move the example to docker-simple folder 2022-07-17 21:13:36 -07:00
Shizun Ge
09833807a8 Add GitHub and Grafana links to the dashboard 2022-07-17 21:07:47 -07:00
Shizun Ge
fad9a4cded allow bind prometheus to a different interface than the ssh one. 2022-07-11 18:41:57 -07:00
Shizun Ge
55c96bb2c7 Merge pull request #24 from shizunge/offline
set location to unknown when city is not available.
2022-07-10 22:47:53 -07:00
Shizun Ge
0bb4f046ca set location to unknown when city is not available. 2022-07-10 22:47:05 -07:00
15 changed files with 530 additions and 163 deletions

View File

@@ -0,0 +1,56 @@
name: Build docker image and push to docker hub on push
on:
push:
branches:
- main
env:
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
jobs:
build_and_push:
name: Build and push Docker image
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Extract tag string
id: git
shell: bash
run: |
RELEASE_VERSION="dev-$(date +%s)"
echo "::set-output name=image_tag::${RELEASE_VERSION}"
echo "Action image_tag=${RELEASE_VERSION}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.4.0
- name: Login to docker hub
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v4.0.0
with:
platforms: ${{ env.PLATFORMS }}
push: true
tags: |
${{ github.repository }}:${{ steps.git.outputs.image_tag }}
${{ github.repository }}:development
ghcr.io/${{ github.repository }}:${{ steps.git.outputs.image_tag }}
ghcr.io/${{ github.repository }}:development

View File

@@ -5,7 +5,7 @@ on:
types: # This configuration does not affect the page_build event above
- created
env:
PLATFORMS: "linux/amd64,linux/386,linux/arm64,linux/arm/v7,linux/arm/v6,linux/s390x"
PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
jobs:
build_and_push:
@@ -27,23 +27,23 @@ jobs:
uses: docker/setup-qemu-action@v2
- name: Install buildx
uses: docker/setup-buildx-action@v2.0.0
uses: docker/setup-buildx-action@v2.4.0
- name: Login to docker hub
uses: docker/login-action@v2.0.0
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2.0.0
uses: docker/login-action@v2.1.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- name: Build and push ${{ github.repository }}:${{ steps.git.outputs.image_tag }}
uses: docker/build-push-action@v3.0.0
uses: docker/build-push-action@v4.0.0
with:
platforms: ${{ env.PLATFORMS }}
push: true

View File

@@ -1,19 +1,20 @@
FROM golang:alpine AS build
FROM golang AS build
ADD . /go/src/app
WORKDIR /go/src/app
RUN mkdir /endlessh
ADD . /endlessh
WORKDIR /endlessh
RUN go mod tidy
RUN go build -o endlessh .
FROM alpine:latest
FROM gcr.io/distroless/base
LABEL org.opencontainers.image.title=endlessh-go
LABEL org.opencontainers.image.description="Endlessh: an SSH tarpit"
LABEL org.opencontainers.image.vendor="Shizun Ge"
LABEL org.opencontainers.image.licenses=GPLv3
COPY --from=build /go/src/app/endlessh /usr/bin/endlessh
COPY --from=build /endlessh/endlessh /endlessh
EXPOSE 2222 2112
USER nobody
ENTRYPOINT ["/usr/bin/endlessh"]
ENTRYPOINT ["/endlessh"]
CMD ["-logtostderr", "-v=1"]

View File

@@ -2,7 +2,7 @@
A golang implementation of [endlessh](https://nullprogram.com/blog/2019/03/22/) exporting Prometheus metrics, visualized by a Grafana dashboard.
![screenshot](https://github.com/shizunge/endlessh-go/raw/master/dashboard/screenshot.png)
![screenshot](https://github.com/shizunge/endlessh-go/raw/main/dashboard/screenshot.png)
## Introduction
@@ -52,7 +52,7 @@ Usage of ./endlessh-go
-geoip_supplier string
Supplier to obtain Geohash of IPs. Possible values are "off", "ip-api", "freegeoip", "max-mind-db" (default "off")
-host string
Listening address (default "0.0.0.0")
SSH listening address (default "0.0.0.0")
-interval_ms int
Message millisecond delay (default 1000)
-line_length int
@@ -68,9 +68,11 @@ Usage of ./endlessh-go
-max_mind_db string
Path to the MaxMind DB file.
-port string
Listening port (default "2222")
SSH listening port (default "2222")
-prometheus_entry string
Entry point for prometheus (default "metrics")
-prometheus_host string
The address for prometheus (default "0.0.0.0")
-prometheus_port string
The port for prometheus (default "2112")
-stderrthreshold value
@@ -98,7 +100,7 @@ The metrics is off by default, you can turn it via the CLI argument `-enable_pro
It listens to port `2112` and entry point is `/metrics` by default. The port and entry point can be changed via CLI arguments.
The endlessh-go server stores the geohash of attackers as a label on `endlessh_client_open_count`, which is also off by default. You can turn it on via the CLI argument `-geoip_supplier`. The endlessh-go uses service from either [ip-api](https://ip-api.com/) or [freegeoip](https://freegeoip.live/), which may enforce a query rate and limit commercial use. Visit their website for their terms and policies.
The endlessh-go server stores the geohash of attackers as a label on `endlessh_client_open_count`, which is also off by default. You can turn it on via the CLI argument `-geoip_supplier`. The endlessh-go uses service from [ip-api](https://ip-api.com/), which may enforce a query rate and limit commercial use. Visit their website for their terms and policies.
You could also use an offline GeoIP database from [MaxMind](https://www.maxmind.com) by setting `-geoip_supplier` to *max-mind-db* and `-max_mind_db` to the path of the database file.

264
coordinates/country.go Normal file
View File

@@ -0,0 +1,264 @@
// Copyright (C) 2023 Shizun Ge
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
package coordinates
// Map country's ISO to their capital's latitude and longitude.
// Country's ISO see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
type Location struct {
Latitude float64
Longitude float64
}
var Country = map[string]Location{
"AD": {42.5, 1.5},
"AE": {24.4511, 54.3969},
"AF": {34.5328, 69.1658},
"AG": {17.1211, -61.8447},
"AI": {18.2167, -63.05},
"AL": {41.33, 19.82},
"AM": {40.1814, 44.5144},
"AO": {-8.8383, 13.2344},
"AR": {-34.5997, -58.3819},
"AS": {-14.274, -170.7046},
"AT": {48.2083, 16.3725},
"AU": {-35.2931, 149.1269},
"AW": {12.5186, -70.0358},
"AZ": {40.3667, 49.8352},
"BA": {43.8563, 18.4132},
"BB": {13.0975, -59.6167},
"BD": {23.7289, 90.3944},
"BE": {50.8353, 4.3314},
"BF": {12.3686, -1.5275},
"BG": {42.6979, 23.3217},
"BH": {26.225, 50.5775},
"BI": {-3.3825, 29.3611},
"BJ": {6.402, 2.518},
"BL": {17.8958, -62.8508},
"BM": {32.2942, -64.7839},
"BN": {4.9167, 114.9167},
"BO": {-16.4942, -68.1475},
"BR": {-15.7939, -47.8828},
"BS": {25.0667, -77.3333},
"BT": {27.4833, 89.6333},
"BW": {-24.6569, 25.9086},
"BY": {53.9022, 27.5618},
"BZ": {17.25, -88.7675},
"CA": {45.4247, -75.695},
"CD": {-4.3317, 15.3139},
"CF": {4.3732, 18.5628},
"CG": {-4.2667, 15.2833},
"CH": {46.948, 7.4474},
"CI": {5.3364, -4.0267},
"CK": {-21.207, -159.771},
"CL": {-33.45, -70.6667},
"CM": {3.8578, 11.5181},
"CN": {39.904, 116.4075},
"CO": {4.6126, -74.0705},
"CR": {9.9333, -84.0833},
"CU": {23.1367, -82.3589},
"CV": {14.9177, -23.5092},
"CW": {12.108, -68.935},
"CX": {-10.4167, 105.7167},
"CY": {35.1725, 33.365},
"CZ": {50.0833, 14.4167},
"DE": {52.5167, 13.3833},
"DJ": {11.595, 43.1481},
"DK": {55.6805, 12.5615},
"DM": {15.3, -61.3833},
"DO": {18.4764, -69.8933},
"DZ": {36.7764, 3.0586},
"EC": {-0.22, -78.5125},
"EE": {59.4372, 24.745},
"EG": {30.0444, 31.2358},
"ER": {15.3333, 38.9167},
"ES": {40.4167, -3.7167},
"ET": {9.0272, 38.7369},
"FI": {60.1756, 24.9342},
"FJ": {-18.1333, 178.4333},
"FK": {-51.7, -57.85},
"FM": {6.9178, 158.185},
"FO": {62, -6.7833},
"FR": {48.8566, 2.3522},
"GA": {0.3901, 9.4544},
"GB": {51.5072, -0.1275},
"GD": {12.0444, -61.7417},
"GE": {41.7225, 44.7925},
"GF": {4.933, -52.33},
"GH": {5.6037, -0.187},
"GI": {36.1324, -5.3781},
"GL": {64.175, -51.7333},
"GM": {13.4531, -16.5775},
"GN": {9.538, -13.6773},
"GP": {16.0104, -61.7055},
"GQ": {3.7521, 8.7737},
"GR": {37.9842, 23.7281},
"GS": {-54.2833, -36.5},
"GT": {14.6099, -90.5252},
"GU": {13.4745, 144.7504},
"GW": {11.8592, -15.5956},
"GY": {6.7833, -58.1667},
"HK": {22.3069, 114.1831},
"HN": {14.0942, -87.2067},
"HR": {45.8131, 15.9772},
"HT": {18.5425, -72.3386},
"HU": {47.4983, 19.0408},
"ID": {-6.2146, 106.8451},
"IE": {53.3497, -6.2603},
"IL": {31.7833, 35.2167},
"IM": {54.15, -4.4819},
"IN": {28.6139, 77.209},
"IQ": {33.35, 44.4167},
"IR": {35.7, 51.4167},
"IS": {64.1475, -21.935},
"IT": {41.8931, 12.4828},
"JE": {49.1858, -2.11},
"JM": {17.9714, -76.7931},
"JO": {31.95, 35.9333},
"JP": {35.6839, 139.7744},
"KE": {-1.2864, 36.8172},
"KG": {42.8667, 74.5667},
"KH": {11.5696, 104.921},
"KI": {1.3382, 173.0176},
"KM": {-11.7036, 43.2536},
"KN": {17.2983, -62.7342},
"KP": {39.03, 125.73},
"KR": {37.56, 126.99},
"KW": {29.375, 47.98},
"KY": {19.2866, -81.3744},
"KZ": {51.1333, 71.4333},
"LA": {17.9667, 102.6},
"LB": {33.8869, 35.5131},
"LC": {14.0167, -60.9833},
"LI": {47.1397, 9.5219},
"LK": {6.9, 79.9164},
"LR": {6.3106, -10.8047},
"LS": {-29.31, 27.48},
"LT": {54.6833, 25.2833},
"LU": {49.6106, 6.1328},
"LV": {56.9475, 24.1069},
"LY": {32.8752, 13.1875},
"MA": {26.0928, -10.6089},
"MC": {43.7396, 7.4069},
"MD": {47.0228, 28.8353},
"ME": {42.4397, 19.2661},
"MF": {18.0706, -63.0847},
"MG": {-18.9386, 47.5214},
"MH": {7.0918, 171.3802},
"MK": {41.9833, 21.4333},
"ML": {12.6458, -7.9922},
"MM": {16.795, 96.16},
"MN": {47.9214, 106.9055},
"MP": {15.2137, 145.7546},
"MQ": {14.6104, -61.08},
"MR": {18.0858, -15.9785},
"MS": {16.7928, -62.2106},
"MT": {35.8978, 14.5125},
"MU": {-20.1667, 57.5},
"MV": {4.175, 73.5083},
"MW": {-13.9833, 33.7833},
"MX": {19.4333, -99.1333},
"MY": {3.1478, 101.6953},
"MZ": {-25.9153, 32.5764},
"NA": {-22.57, 17.0836},
"NC": {-22.2625, 166.4443},
"NE": {13.5086, 2.1111},
"NF": {-29.0569, 167.9617},
"NG": {9.0556, 7.4914},
"NI": {12.15, -86.2667},
"NL": {52.08, 4.31},
"NO": {59.9111, 10.7528},
"NP": {27.7167, 85.3667},
"NR": {-0.5477, 166.9209},
"NU": {-19.056, -169.921},
"NZ": {-41.2889, 174.7772},
"OM": {23.6139, 58.5922},
"PA": {9, -79.5},
"PE": {-12.06, -77.0375},
"PF": {-17.5334, -149.5667},
"PG": {-9.4789, 147.1494},
"PH": {14.6, 120.9833},
"PK": {33.6989, 73.0369},
"PL": {52.23, 21.0111},
"PM": {46.7811, -56.1764},
"PN": {-25.0667, -130.0833},
"PR": {18.4037, -66.0636},
"PT": {38.708, -9.139},
"PW": {7.5006, 134.6242},
"PY": {-25.3, -57.6333},
"QA": {25.3, 51.5333},
"RE": {-20.8789, 55.4481},
"RO": {44.4, 26.0833},
"RS": {44.8167, 20.4667},
"RU": {55.7558, 37.6178},
"RW": {-1.9536, 30.0606},
"SA": {24.65, 46.71},
"SB": {-9.4333, 159.95},
"SC": {-4.6236, 55.4544},
"SD": {15.6031, 32.5265},
"SE": {59.3294, 18.0686},
"SG": {1.3, 103.8},
"SH": {-15.9251, -5.7179},
"SI": {46.05, 14.5167},
"SK": {48.1447, 17.1128},
"SL": {8.4833, -13.2331},
"SM": {43.932, 12.4484},
"SN": {14.7319, -17.4572},
"SO": {2.0408, 45.3425},
"SR": {5.8667, -55.1667},
"SS": {4.85, 31.6},
"ST": {0.3333, 6.7333},
"SV": {13.6989, -89.1914},
"SX": {18.0256, -63.0492},
"SY": {33.5131, 36.2919},
"SZ": {-26.3208, 31.1617},
"TC": {21.4664, -71.136},
"TD": {12.11, 15.05},
"TG": {6.1319, 1.2228},
"TH": {13.75, 100.5167},
"TJ": {38.5731, 68.7864},
"TL": {-8.5536, 125.5783},
"TM": {37.95, 58.3833},
"TN": {36.8008, 10.18},
"TO": {-21.1347, -175.2083},
"TR": {39.93, 32.85},
"TT": {10.6667, -61.5167},
"TV": {-8.5243, 179.1942},
"TZ": {-6.8, 39.2833},
"UA": {50.45, 30.5236},
"UG": {0.3136, 32.5811},
"US": {38.9047, -77.0163},
"UY": {-34.8667, -56.1667},
"UZ": {41.3, 69.2667},
"VA": {41.9033, 12.4534},
"VC": {13.1667, -61.2333},
"VE": {10.5, -66.9333},
"VG": {18.4167, -64.6167},
"VI": {18.3419, -64.9332},
"VN": {21.0245, 105.8412},
"VU": {-17.7333, 168.3167},
"WF": {-13.2825, -176.1736},
"WS": {-13.8333, -171.8333},
"XG": {31.5069, 34.456},
"XK": {42.6633, 21.1622},
"XR": {78.2167, 15.6333},
"XW": {31.7764, 35.2269},
"YE": {15.35, 44.2},
"YT": {-12.7871, 45.275},
"ZA": {-25.7464, 28.1881},
"ZM": {-15.4167, 28.2833},
"ZW": {-17.8292, 31.0522},
}

View File

@@ -9,7 +9,7 @@
"pluginName": "Prometheus"
}
],
"__elements": [],
"__elements": {},
"__requires": [
{
"type": "panel",
@@ -21,7 +21,7 @@
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "8.3.6"
"version": "9.3.6"
},
{
"type": "panel",
@@ -58,7 +58,10 @@
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
@@ -73,14 +76,38 @@
}
]
},
"description": "Dashboard for endlessh (add option All to job and host)",
"editable": true,
"description": "Dashboard for endlessh (Update variables on time range changes)",
"editable": false,
"fiscalYearStartMonth": 0,
"gnetId": 15156,
"graphTooltip": 0,
"id": null,
"iteration": 1645482521172,
"links": [],
"links": [
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "GitHub",
"tooltip": "GitHub",
"type": "link",
"url": "https://github.com/shizunge/endlessh-go"
},
{
"asDropdown": false,
"icon": "external link",
"includeVars": false,
"keepTime": false,
"tags": [],
"targetBlank": true,
"title": "Grafana",
"tooltip": "Grafana Dashboard",
"type": "link",
"url": "https://grafana.com/grafana/dashboards/15156"
}
],
"liveNow": false,
"panels": [
{
@@ -128,7 +155,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -252,7 +279,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -377,7 +404,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -440,7 +467,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -553,7 +580,7 @@
"text": {},
"textMode": "value"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -697,7 +724,7 @@
"text": {},
"textMode": "auto"
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -726,6 +753,8 @@
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
@@ -777,15 +806,21 @@
"options": {
"legend": {
"calcs": [],
"displayMode": "hidden",
"placement": "bottom"
"displayMode": "list",
"placement": "bottom",
"showLegend": false
},
"tooltip": {
"mode": "single"
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "datasource",
"uid": "-- Dashboard --"
},
"panelId": 20,
"refId": "A"
}
@@ -826,6 +861,7 @@
"legend": {
"displayMode": "table",
"placement": "right",
"showLegend": true,
"values": [
"value",
"percent"
@@ -840,7 +876,8 @@
"values": false
},
"tooltip": {
"mode": "single"
"mode": "single",
"sort": "none"
}
},
"targets": [
@@ -936,6 +973,13 @@
"color": {
"mode": "continuous-GrYlRd"
},
"custom": {
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
@@ -967,6 +1011,7 @@
"mouseWheelZoom": false,
"showAttribution": false,
"showDebug": false,
"showMeasure": false,
"showScale": false,
"showZoom": true
},
@@ -1012,14 +1057,18 @@
"type": "markers"
}
],
"tooltip": {
"mode": "details"
},
"view": {
"allLayers": true,
"id": "zero",
"lat": 0,
"lon": 0,
"zoom": 1
}
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -1114,6 +1163,7 @@
"align": "auto",
"displayMode": "auto",
"filterable": true,
"inspect": false,
"minWidth": 50
},
"links": [],
@@ -1205,7 +1255,7 @@
}
]
},
"pluginVersion": "8.3.6",
"pluginVersion": "9.3.6",
"targets": [
{
"datasource": {
@@ -1396,7 +1446,7 @@
}
],
"refresh": "",
"schemaVersion": 34,
"schemaVersion": 37,
"style": "dark",
"tags": [
"prometheus"
@@ -1421,7 +1471,7 @@
"query": "label_values(endlessh_client_open_count_total, job)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
@@ -1445,7 +1495,7 @@
"query": "label_values(endlessh_client_open_count_total{job=~\"$job\"}, instance)",
"refId": "StandardVariableQuery"
},
"refresh": 1,
"refresh": 2,
"regex": "",
"skipUrlSync": false,
"sort": 1,
@@ -1461,6 +1511,6 @@
"timezone": "",
"title": "Endlessh",
"uid": "ATIxYkO7k",
"version": 7,
"version": 10,
"weekStart": ""
}

View File

@@ -1,24 +1,6 @@
# Examples
## docker compose
## docker-simple
This is an example how to setup endlessh-go, Prometheus, and Grafana using [docker compose](https://docs.docker.com/compose/). The reference of the compose file can be found [here](https://docs.docker.com/compose/compose-file/).
An example how to setup endlessh-go, Prometheus, and Grafana using [docker compose](https://docs.docker.com/compose/).
*prometheus.yml* is used as a [Prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/).
*grafana-datasource.yml* is used to provision a data source for Grafana to ease the setup, though Grafana data source can also be setup manually.
To start the stack, in the *examples* folder, run:
```
sudo docker-compose up -d
```
This example exposes the following ports. Except the SSH port, you should not expose other ports to public without protections (not included in this example) in production.
* **2222**: The SSH port. You may test endlessh-go by running `ssh -p 2222 localhost`. Your SSH client should hang. View the log of endlessh-go by running `sudo docker logs endlessh`.
* **2112**: The Prometheus metrics exported by endlessh-go. Go to [http://localhost:2112/metrics](http://localhost:2112/metrics) in your web browser to view the metrics.
* **9090**: Prometheus web interface. Go to [http://localhost:9090](http://localhost:9090) in your web browser for Prometheus. You can check whether the target of endlessh-go is up (Click Status, then Targets).
* **3000**: Grafana. Go to [http://localhost:3000](http://localhost:3000) in your web browser for Grafana. Use username *examples* and password *examples* to login.
In this example, we do not provision a dashboard for Grafana. You need to manually load the endlessh-go dashboard, by either importing it from the Grafana.com using ID [15156](https://grafana.com/grafana/dashboards/15156), or pasting the dashboard JSON text to the text area. See the [Grafana documentation](https://grafana.com/docs/grafana/latest/dashboards/export-import/) about import. Then select *Prometheus* as the data source.

View File

@@ -0,0 +1,22 @@
## docker compose
This is an example how to setup endlessh-go, Prometheus, and Grafana using [docker compose](https://docs.docker.com/compose/). The reference of the compose file can be found [here](https://docs.docker.com/compose/compose-file/).
*prometheus.yml* is used as a [Prometheus configuration](https://prometheus.io/docs/prometheus/latest/configuration/configuration/).
*grafana-datasource.yml* is used to provision a data source for Grafana to ease the setup, though Grafana data source can also be setup manually.
To start the stack, in the *examples* folder, run:
```
sudo docker-compose up -d
```
This example exposes the following ports. Except the SSH port, you should not expose other ports to public without protections (not included in this example) in production.
* **2222**: The SSH port. You may test endlessh-go by running `ssh -p 2222 localhost`. Your SSH client should hang. View the log of endlessh-go by running `sudo docker logs endlessh`.
* **2112**: The Prometheus metrics exported by endlessh-go. Go to [http://localhost:2112/metrics](http://localhost:2112/metrics) in your web browser to view the metrics.
* **9090**: Prometheus web interface. Go to [http://localhost:9090](http://localhost:9090) in your web browser for Prometheus. You can check whether the target of endlessh-go is up (Click Status, then Targets).
* **3000**: Grafana. Go to [http://localhost:3000](http://localhost:3000) in your web browser for Grafana. Use username *examples* and password *examples* to login.
In this example, we do not provision a dashboard for Grafana. You need to manually load the endlessh-go dashboard, by either importing it from the Grafana.com using ID [15156](https://grafana.com/grafana/dashboards/15156), or pasting the dashboard JSON text to the text area. See the [Grafana documentation](https://grafana.com/docs/grafana/latest/dashboards/export-import/) about import. Then select *Prometheus* as the data source.

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2021 Shizun Ge
// Copyright (C) 2021-2023 Shizun Ge
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -24,6 +24,8 @@ import (
"net/http"
"strings"
"endlessh-go/coordinates"
"github.com/oschwald/geoip2-golang"
"github.com/pierrre/geohash"
)
@@ -32,55 +34,25 @@ var (
maxMindDbFileName *string
)
type freegeoip struct {
Ip string `json:"ip"`
CountryCode string `json:"country_code"`
CountryName string `json:"country_name"`
RegionCode string `json:"region_code"`
RegionName string `json:"region_name"`
City string `json:"city"`
Zipcode string `json:"zipcode"`
Latitude float64 `json:"latitude"`
Longitude float64 `json:"longitude"`
MetroCode int `json:"metro_code"`
AreaCode int `json:"area_code"`
}
func geohashAndLocationFromFreegeoip(address string) (string, string, string, error) {
var geo freegeoip
response, err := http.Get("https://freegeoip.live/json/" + address)
if err != nil {
return "s000", "Unknown", "Unknown", err
}
defer response.Body.Close()
body, err := ioutil.ReadAll(response.Body)
if err != nil {
return "s000", "Unknown", "Unknown", err
}
err = json.Unmarshal(body, &geo)
if err != nil {
return "s000", "Unknown", "Unknown", err
}
func composeLocation(country string, region string, city string) string {
var locations []string
for _, s := range []string{geo.CountryName, geo.RegionName, geo.City} {
for _, s := range []string{country, region, city} {
if strings.TrimSpace(s) != "" {
locations = append(locations, s)
}
}
location := strings.Join(locations, ", ")
if location == "" {
location = "Unknown"
return "Unknown"
}
country := geo.CountryName
if country == "" {
country = "Unknown"
}
gh := geohash.EncodeAuto(geo.Latitude, geo.Longitude)
return location
}
return gh, country, location, nil
func composeCountry(country string) string {
if country == "" {
return "Unknown"
}
return country
}
type ipapi struct {
@@ -119,21 +91,9 @@ func geohashAndLocationFromIpapi(address string) (string, string, string, error)
return "s000", "Unknown", "Unknown", fmt.Errorf("failed to query %v via ip-api: status: %v, message: %v", address, geo.Status, geo.Message)
}
var locations []string
for _, s := range []string{geo.CountryName, geo.RegionName, geo.City} {
if strings.TrimSpace(s) != "" {
locations = append(locations, s)
}
}
location := strings.Join(locations, ", ")
if location == "" {
location = "Unknown"
}
country := geo.CountryName
if country == "" {
country = "Unknown"
}
gh := geohash.EncodeAuto(geo.Latitude, geo.Longitude)
country := composeCountry(geo.CountryName)
location := composeLocation(geo.CountryName, geo.RegionName, geo.City)
return gh, country, location, nil
}
@@ -146,13 +106,32 @@ func geohashAndLocationFromMaxMindDb(address string) (string, string, string, er
defer db.Close()
// If you are using strings that may be invalid, check that ip is not nil
ip := net.ParseIP(address)
record, err := db.City(ip)
cityRecord, err := db.City(ip)
if err != nil {
return "s000", "Unknown", "Unknown", err
}
gh := geohash.EncodeAuto(record.Location.Latitude, record.Location.Longitude)
country := record.Country.Names["en"]
location := record.City.Names["en"]
countryName := cityRecord.Country.Names["en"]
cityName := cityRecord.City.Names["en"]
latitude := cityRecord.Location.Latitude
longitude := cityRecord.Location.Longitude
iso := cityRecord.Country.IsoCode
if latitude == 0 && longitude == 0 {
// In case of using Country DB, city is not available.
loc, ok := coordinates.Country[iso]
if ok {
latitude = loc.Latitude
longitude = loc.Longitude
} else {
if iso != "" {
// For debugging, adding the iso to the country name.
countryName = countryName + " (" + iso + ")"
}
}
}
gh := geohash.EncodeAuto(latitude, longitude)
country := composeCountry(countryName)
location := composeLocation(countryName, "", cityName)
return gh, country, location, nil
}
@@ -162,8 +141,6 @@ func geohashAndLocation(address string, geoipSupplier string) (string, string, s
return "s000", "Geohash off", "Geohash off", nil
case "ip-api":
return geohashAndLocationFromIpapi(address)
case "freegeoip":
return geohashAndLocationFromFreegeoip(address)
case "max-mind-db":
return geohashAndLocationFromMaxMindDb(address)
default:

20
go.mod
View File

@@ -1,12 +1,12 @@
module endlessh-go
go 1.18
go 1.20
require (
github.com/golang/glog v1.0.0
github.com/oschwald/geoip2-golang v1.7.0
github.com/pierrre/geohash v1.0.0
github.com/prometheus/client_golang v1.12.2
github.com/oschwald/geoip2-golang v1.8.0
github.com/pierrre/geohash v1.1.0
github.com/prometheus/client_golang v1.14.0
)
require (
@@ -14,10 +14,10 @@ require (
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/oschwald/maxminddb-golang v1.9.0 // indirect
github.com/prometheus/client_model v0.2.0 // indirect
github.com/prometheus/common v0.32.1 // indirect
github.com/prometheus/procfs v0.7.3 // indirect
golang.org/x/sys v0.0.0-20220325203850-36772127a21f // indirect
google.golang.org/protobuf v1.26.0 // indirect
github.com/oschwald/maxminddb-golang v1.10.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

61
go.sum
View File

@@ -34,9 +34,7 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/Codefor/geohash v0.0.0-20140723084247-1b41c28e3a9d h1:iG9B49Q218F/XxXNRM7k/vWf7MKmLIS8AcJV9cGN4nA=
github.com/Codefor/geohash v0.0.0-20140723084247-1b41c28e3a9d/go.mod h1:RVnhzAX71far8Kc3TQeA0k/dcaEKUnTDSOyet/JCmGI=
github.com/TomiHiltunen/geohash-golang v0.0.0-20150112065804-b3e4e625abfb h1:wumPkzt4zaxO4rHPBrjDK8iZMR41C1qs7njNqlacwQg=
github.com/TomiHiltunen/geohash-golang v0.0.0-20150112065804-b3e4e625abfb/go.mod h1:QiYsIBRQEO+Z4Rz7GoI+dsHVneZNONvhczuA+llOZNM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -47,7 +45,6 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
github.com/broady/gogeohash v0.0.0-20120525094510-7b2c40d64042 h1:iEdmkrNMLXbM7ecffOAtZJQOQUTE4iMonxrb5opUgE4=
github.com/broady/gogeohash v0.0.0-20120525094510-7b2c40d64042/go.mod h1:f1L9YvXvlt9JTa+A17trQjSMM6bV40f+tHjB+Pi+Fqk=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
@@ -58,22 +55,24 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/fanixk/geohash v0.0.0-20150324002647-c1f9b5fa157a h1:Fyfh/dsHFrC6nkX7H7+nFdTd1wROlX/FxEIWVpKYf1U=
github.com/fanixk/geohash v0.0.0-20150324002647-c1f9b5fa157a/go.mod h1:UgNw+PTmmGN8rV7RvjvnBMsoTU8ZXXnaT3hYsDTBlgQ=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
@@ -116,8 +115,8 @@ github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
@@ -152,8 +151,7 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mmcloughlin/geohash v0.9.0 h1:FihR004p/aE1Sju6gcVq5OLDqGcMnpBY+8moBqIsVOs=
github.com/mmcloughlin/geohash v0.9.0/go.mod h1:oNZxQo5yWJh0eMQEP/8hwQuVx9Z9tjwFUqcTB1SmG0c=
github.com/mmcloughlin/geohash v0.10.0 h1:9w1HchfDfdeLc+jFEf/04D27KP7E2QmpDu52wPbJWRE=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
@@ -161,40 +159,44 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/oschwald/geoip2-golang v1.7.0 h1:JW1r5AKi+vv2ujSxjKthySK3jo8w8oKWPyXsw+Qs/S8=
github.com/oschwald/geoip2-golang v1.7.0/go.mod h1:mdI/C7iK7NVMcIDDtf4bCKMJ7r0o7UwGeCo9eiitCMQ=
github.com/oschwald/maxminddb-golang v1.9.0 h1:tIk4nv6VT9OiPyrnDAfJS1s1xKDQMZOsGojab6EjC1Y=
github.com/oschwald/maxminddb-golang v1.9.0/go.mod h1:TK+s/Z2oZq0rSl4PSeAEoP0bgm82Cp5HyvYbt8K3zLY=
github.com/pierrre/compare v1.0.2 h1:k4IUsHgh+dbcAOIWCfxVa/7G6STjADH2qmhomv+1quc=
github.com/pierrre/compare v1.0.2/go.mod h1:8UvyRHH+9HS8Pczdd2z5x/wvv67krDwVxoOndaIIDVU=
github.com/pierrre/geohash v1.0.0 h1:f/zfjdV4rVofTCz1FhP07T+EMQAvcMM2ioGZVt+zqjI=
github.com/pierrre/geohash v1.0.0/go.mod h1:atytaeVa21hj5F6kMebHYPf8JbIrGxK2FSzN2ajKXms=
github.com/oschwald/geoip2-golang v1.8.0 h1:KfjYB8ojCEn/QLqsDU0AzrJ3R5Qa9vFlx3z6SLNcKTs=
github.com/oschwald/geoip2-golang v1.8.0/go.mod h1:R7bRvYjOeaoenAp9sKRS8GX5bJWcZ0laWO5+DauEktw=
github.com/oschwald/maxminddb-golang v1.10.0 h1:Xp1u0ZhqkSuopaKmk1WwHtjF0H9Hd9181uj2MQ5Vndg=
github.com/oschwald/maxminddb-golang v1.10.0/go.mod h1:Y2ELenReaLAZ0b400URyGwvYxHV1dLIxBuyOsyYjHK0=
github.com/pierrre/compare v1.1.0 h1:57z388tk9GXcyLnLXh1pMRdCQrfUH056x9dyNCCZZtg=
github.com/pierrre/geohash v1.1.0 h1:AeTekkssK2HV3le9vya4cVFIPMx60bVIHaTvC+/5vyc=
github.com/pierrre/geohash v1.1.0/go.mod h1:QQAU8mXr7WIhJJqL2uAvhJHrMeH/jLeETutCqY/fDeU=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M=
github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0=
github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34=
github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo=
github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc=
github.com/prometheus/common v0.32.1 h1:hWIdL3N2HoUx3B8j3YN9mWor0qhY/NlEKZEaXxuIRh4=
github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/common v0.37.0 h1:ccBbHCgIiT9uSoFY0vX8H3zsNR5eLt17/RQLUvn8pXE=
github.com/prometheus/common v0.37.0/go.mod h1:phzohg0JFMnBEFGxTDbfu3QyL5GI8gTQJFhYO5B3mfA=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
@@ -204,8 +206,8 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8 h1:I4DY8wLxJXCrMYzDM6lKCGc3IQwJX0PlTLsd3nQqI3c=
github.com/the42/cartconvert v0.0.0-20131203171324-aae784c392b8/go.mod h1:fWO/msnJVhHqN1yX6OBoxSyfj7TEj1hHiL8bJSQsK30=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -279,12 +281,15 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -329,17 +334,20 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9 h1:XfKQ4OlFl8okEOr5UvAqFRVj8pY/4yfcXrddB8qAbU0=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f h1:TrmogKRsSOxRMJbLYGrB4SBbW+LJcEllYBLME5Zk5pU=
golang.org/x/sys v0.0.0-20220325203850-36772127a21f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418 h1:9vYwv7OjYaky/tlAeD7C4oC9EsPTlaFl1H2jS++V+ME=
golang.org/x/sys v0.0.0-20220804214406-8e32c043e418/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -386,7 +394,6 @@ golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE=
google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M=
@@ -462,8 +469,9 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -475,6 +483,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=

20
main.go
View File

@@ -1,4 +1,4 @@
// Copyright (C) 2021 Shizun Ge
// Copyright (C) 2021-2023 Shizun Ge
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -44,7 +44,7 @@ var (
clientSeconds *prometheus.CounterVec
)
func initPrometheus(connHost, prometheusPort, prometheusEntry string) {
func initPrometheus(prometheusHost, prometheusPort, prometheusEntry string) {
totalClients = prometheus.NewCounterFunc(
prometheus.CounterOpts{
Name: "endlessh_client_open_count_total",
@@ -99,8 +99,8 @@ func initPrometheus(connHost, prometheusPort, prometheusEntry string) {
prometheus.MustRegister(clientSeconds)
http.Handle("/"+prometheusEntry, promhttp.Handler())
go func() {
glog.Infof("Starting Prometheus on %v:%v, entry point is /%v", connHost, prometheusPort, prometheusEntry)
http.ListenAndServe(connHost+":"+prometheusPort, nil)
glog.Infof("Starting Prometheus on %v:%v, entry point is /%v", prometheusHost, prometheusPort, prometheusEntry)
http.ListenAndServe(prometheusHost+":"+prometheusPort, nil)
}()
}
@@ -109,12 +109,13 @@ func main() {
bannerMaxLength := flag.Int64("line_length", 32, "Maximum banner line length")
maxClients := flag.Int64("max_clients", 4096, "Maximum number of clients")
connType := flag.String("conn_type", "tcp", "Connection type. Possible values are tcp, tcp4, tcp6")
connHost := flag.String("host", "0.0.0.0", "Listening address")
connPort := flag.String("port", "2222", "Listening port")
connHost := flag.String("host", "0.0.0.0", "SSH listening address")
connPort := flag.String("port", "2222", "SSH listening port")
prometheusEnabled := flag.Bool("enable_prometheus", false, "Enable prometheus")
prometheusHost := flag.String("prometheus_host", "0.0.0.0", "The address for prometheus")
prometheusPort := flag.String("prometheus_port", "2112", "The port for prometheus")
prometheusEntry := flag.String("prometheus_entry", "metrics", "Entry point for prometheus")
geoipSupplier := flag.String("geoip_supplier", "off", "Supplier to obtain Geohash of IPs. Possible values are \"off\", \"ip-api\", \"freegeoip\", \"max-mind-db\"")
geoipSupplier := flag.String("geoip_supplier", "off", "Supplier to obtain Geohash of IPs. Possible values are \"off\", \"ip-api\", \"max-mind-db\"")
maxMindDbFileName = flag.String("max_mind_db", "", "Path to the MaxMind DB file.")
flag.Usage = func() {
@@ -123,8 +124,11 @@ func main() {
}
flag.Parse()
if *connType == "tcp6" && *prometheusHost == "0.0.0.0" {
*prometheusHost = "[::]"
}
if *prometheusEnabled {
initPrometheus(*connHost, *prometheusPort, *prometheusEntry)
initPrometheus(*prometheusHost, *prometheusPort, *prometheusEntry)
}
rand.Seed(time.Now().UnixNano())