From 9ca4057915140bd7eaa98f3dca10902cc1187cac Mon Sep 17 00:00:00 2001 From: Shizun Ge Date: Fri, 24 Jul 2026 19:24:57 -0700 Subject: [PATCH] Rename prometheus_enable and healthcheck_enable flags to prometheus_enabled and healthcheck_enabled --- Dockerfile | 2 +- README.md | 10 +++++----- endlessh_integration_test.go | 4 ++-- examples/docker-simple/docker-compose.yml | 2 +- examples/kustomize-simple/deployment.yaml | 2 +- main.go | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6fda926..767ca76 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ CMD ["/endlessh", "-healthcheck"] USER nobody ENTRYPOINT ["/endlessh"] -CMD ["-logtostderr", "-v=1", "-healthcheck_enable"] +CMD ["-logtostderr", "-v=1", "-healthcheck_enabled"] diff --git a/README.md b/README.md index 555e68e..c25be9f 100644 --- a/README.md +++ b/README.md @@ -55,12 +55,12 @@ Usage of ./endlessh-go -conn_type string Connection type. Possible values are tcp, tcp4, tcp6 (default "tcp") -enable_prometheus - Enable prometheus (deprecated, use prometheus_enable) + Enable prometheus (deprecated, use prometheus_enabled) -geoip_supplier string Supplier to obtain Geohash of IPs. Possible values are "off", "ip-api", "max-mind-db" (default "off") -healthcheck Perform healthcheck and exit. GET healthcheck_host:healthcheck_port/health and exit 1 if status is not ok or timeout is exceeded. - -healthcheck_enable + -healthcheck_enabled Enable healthcheck -healthcheck_host string The address for healthcheck. (default "127.0.0.1") @@ -90,7 +90,7 @@ Usage of ./endlessh-go SSH listening port. You may provide multiple -port flags to listen to multiple ports. (default "2222") -prometheus_clean_unseen_seconds int Remove series if the IP is not seen for the given time. Set to 0 to disable. (default 0) - -prometheus_enable + -prometheus_enabled Enable prometheus -prometheus_entry string Entry point for prometheus (default "metrics") @@ -123,7 +123,7 @@ Endlessh-go exports the following Prometheus metrics. | endlessh_client_open_count | count | Number of connections of clients.
Labels:
| | endlessh_client_trapped_time_seconds | count | Seconds a client spends on endlessh.
Labels:
| -The metrics is off by default, you can turn it via the CLI argument `-prometheus_enable`. +The metrics is off by default, you can turn it via the CLI argument `-prometheus_enabled`. It listens to port `2112` and entry point is `/metrics` by default. The port and entry point can be changed via CLI arguments. @@ -133,7 +133,7 @@ You could also use an offline GeoIP database from [MaxMind](https://www.maxmind. ## Healthcheck -The endlessh-go server exposes an HTTP health endpoint when the `-healthcheck_enable` flag is set. By default it listens on `127.0.0.1:51000` at `/health` and returns a JSON like this: +The endlessh-go server exposes an HTTP health endpoint when the `-healthcheck_enabled` flag is set. By default it listens on `127.0.0.1:51000` at `/health` and returns a JSON like this: ```json { diff --git a/endlessh_integration_test.go b/endlessh_integration_test.go index 80f2cc4..11c703c 100644 --- a/endlessh_integration_test.go +++ b/endlessh_integration_test.go @@ -263,7 +263,7 @@ func TestEndlesshIntegration_PrometheusMetrics(t *testing.T) { cmd := exec.Command( "go", "run", "main.go", "-port=0", - "-prometheus_enable", + "-prometheus_enabled", "-prometheus_port=0", "-interval_ms=100", "-logtostderr", "-v=1", @@ -329,7 +329,7 @@ func TestEndlesshIntegration_Healthcheck(t *testing.T) { cmd := exec.Command( "go", "run", "main.go", "-port=0", - "-healthcheck_enable", + "-healthcheck_enabled", "-healthcheck_port=0", "-interval_ms=100", "-logtostderr", "-v=1", diff --git a/examples/docker-simple/docker-compose.yml b/examples/docker-simple/docker-compose.yml index 17b997f..ca32cc2 100644 --- a/examples/docker-simple/docker-compose.yml +++ b/examples/docker-simple/docker-compose.yml @@ -8,7 +8,7 @@ services: - -interval_ms=1000 - -logtostderr - -v=1 - - -prometheus_enable + - -prometheus_enabled - -geoip_supplier=ip-api networks: - example_network diff --git a/examples/kustomize-simple/deployment.yaml b/examples/kustomize-simple/deployment.yaml index a8af852..4eea0a1 100644 --- a/examples/kustomize-simple/deployment.yaml +++ b/examples/kustomize-simple/deployment.yaml @@ -14,7 +14,7 @@ spec: - -interval_ms=1000 - -logtostderr - -v=1 - - -prometheus_enable + - -prometheus_enabled - -geoip_supplier=ip-api - -host=[::] - -prometheus_host=[::] diff --git a/main.go b/main.go index 1519b18..581bf5d 100644 --- a/main.go +++ b/main.go @@ -144,8 +144,8 @@ func main() { proxyProtocolReadHeaderTimeout := flag.Int("proxy_protocol_read_header_timeout_ms", 200, "Timeout for reading the PROXY protocol header in milliseconds. If the connection does not send a valid PROXY protocol header in this time, the header is ignored.") // Prometheus metrics flags - prometheusEnabledOld := flag.Bool("enable_prometheus", false, "Enable prometheus (deprecated, use prometheus_enable)") - prometheusEnabledNew := flag.Bool("prometheus_enable", false, "Enable prometheus") + prometheusEnabledOld := flag.Bool("enable_prometheus", false, "Enable prometheus (deprecated, use prometheus_enabled)") + prometheusEnabledNew := flag.Bool("prometheus_enabled", 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") @@ -156,7 +156,7 @@ func main() { maxMindDbFileName := flag.String("max_mind_db", "", "Path to the MaxMind DB file.") // Healthcheck flags - healthcheckEnabled := flag.Bool("healthcheck_enable", false, "Enable healthcheck") + healthcheckEnabled := flag.Bool("healthcheck_enabled", false, "Enable healthcheck") healthcheckHost := flag.String("healthcheck_host", health.DefaultHost, "The address for healthcheck.") healthcheckPort := flag.String("healthcheck_port", health.DefaultPort, "HTTP port for healthcheck; Serves JSON with status and uptime at /health.") healthcheck := flag.Bool("healthcheck", false, "Perform healthcheck and exit. GET healthcheck_host:healthcheck_port/health and exit 1 if status is not ok or timeout is exceeded.") @@ -172,7 +172,7 @@ func main() { prometheusEnabled := *prometheusEnabledNew prometheusEnableSet := false flag.Visit(func(f *flag.Flag) { - if f.Name == "prometheus_enable" { + if f.Name == "prometheus_enabled" { prometheusEnableSet = true } })