Flag to override server name when validating TLS cert (#20)

This commit is contained in:
Johannes Kohnen 2018-03-23 01:47:51 +01:00 committed by Joshua Humphries
parent 585cd1bae8
commit f203c2cddf
1 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ var (
`When describing messages, show a JSON template for the message type.`) `When describing messages, show a JSON template for the message type.`)
verbose = flag.Bool("v", false, verbose = flag.Bool("v", false,
`Enable verbose output.`) `Enable verbose output.`)
serverName = flag.String("servername", "", "Override servername when validating TLS certificate.")
) )
func init() { func init() {
@ -233,6 +234,9 @@ func main() {
if err != nil { if err != nil {
fail(err, "Failed to configure transport credentials") fail(err, "Failed to configure transport credentials")
} }
if *serverName != "" {
creds.OverrideServerName(*serverName)
}
} }
cc, err := grpcurl.BlockingDial(ctx, target, creds, opts...) cc, err := grpcurl.BlockingDial(ctx, target, creds, opts...)
if err != nil { if err != nil {