paypizza / grpc-health-check

A minimal, high performance, memory-friendly, safe implementation of the gRPC health checking protocol
Apache License 2.0
4 stars 3 forks source link

Change default address to localhost #2

Closed zhsj closed 3 years ago

zhsj commented 3 years ago

I use this in a container, which unfortunately doesn't have ipv6 address. So I think it's better to set default address to localhost rather than ::1.

/ # ip addr show dev lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
/ # grpc-health-check  --port 9999 --verbose
Opts { address: "[::1]", config: None, port: Some(9999), rpc_timeout: 1500, service_name: None, stream: None, tls_ca_cert: None, tls_client_cert: None, tls_client_key: None, tls_domain_name: None, user_agent: None, verbose: true }
URI: http://[::1]:9999/
Error: grpc_health_check::Error(Transport, tonic::transport::Error(Transport, hyper::Error(Connect, ConnectError("tcp connect error", Os { code: 101, kind: Other, message: "Network unreachable" }))))
/ # grpc-health-check  --port 9999 --verbose --address localhost
Opts { address: "localhost", config: None, port: Some(9999), rpc_timeout: 1500, service_name: None, stream: None, tls_ca_cert: None, tls_client_cert: None, tls_client_key: None, tls_domain_name: None, user_agent: None, verbose: true }
URI: http://localhost:9999/
HealthCheckResponse { status: Serving }