Skip to content

Commit

Permalink
make user-agent configurable (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Takeshi Yoneda authored and ahmetb committed May 27, 2019
1 parent a25fd55 commit d6f7e5e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
var (
flAddr string
flService string
flUserAgent string
flConnTimeout time.Duration
flRPCTimeout time.Duration
flTLS bool
Expand All @@ -61,6 +62,7 @@ func init() {
log.SetFlags(0)
flag.StringVar(&flAddr, "addr", "", "(required) tcp host:port to connect")
flag.StringVar(&flService, "service", "", "service name to check (default: \"\")")
flag.StringVar(&flUserAgent, "user-agent", "grpc_health_probe", "user-agent header value of health check requests")
// timeouts
flag.DurationVar(&flConnTimeout, "connect-timeout", time.Second, "timeout for establishing connection")
flag.DurationVar(&flRPCTimeout, "rpc-timeout", time.Second, "timeout for health check rpc")
Expand Down Expand Up @@ -174,7 +176,7 @@ func main() {
}()

opts := []grpc.DialOption{
grpc.WithUserAgent("grpc_health_probe"),
grpc.WithUserAgent(flUserAgent),
grpc.WithBlock()}
if flTLS {
creds, err := buildCredentials(flTLSNoVerify, flTLSCACert, flTLSClientCert, flTLSClientKey, flTLSServerName)
Expand Down

0 comments on commit d6f7e5e

Please sign in to comment.