credentials/alts: Add ServiceOption for server-side ALTS creation (#2009)
* Move handshaker_service_address flag to binaries
This commit is contained in:
@ -33,11 +33,12 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
useTLS = flag.Bool("use_tls", false, "Connection uses TLS if true, else plain TCP")
|
||||
useALTS = flag.Bool("use_alts", false, "Connection uses ALTS if true (this option can only be used on GCP)")
|
||||
certFile = flag.String("tls_cert_file", "", "The TLS cert file")
|
||||
keyFile = flag.String("tls_key_file", "", "The TLS key file")
|
||||
port = flag.Int("port", 10000, "The server port")
|
||||
useTLS = flag.Bool("use_tls", false, "Connection uses TLS if true, else plain TCP")
|
||||
useALTS = flag.Bool("use_alts", false, "Connection uses ALTS if true (this option can only be used on GCP)")
|
||||
altsHSAddr = flag.String("alts_handshaker_service_address", "", "ALTS handshaker gRPC service address")
|
||||
certFile = flag.String("tls_cert_file", "", "The TLS cert file")
|
||||
keyFile = flag.String("tls_key_file", "", "The TLS key file")
|
||||
port = flag.Int("port", 10000, "The server port")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -64,7 +65,11 @@ func main() {
|
||||
}
|
||||
opts = append(opts, grpc.Creds(creds))
|
||||
} else if *useALTS {
|
||||
altsTC := alts.NewServerCreds()
|
||||
altsOpts := alts.DefaultServerOptions()
|
||||
if *altsHSAddr != "" {
|
||||
altsOpts.HandshakerServiceAddress = *altsHSAddr
|
||||
}
|
||||
altsTC := alts.NewServerCreds(altsOpts)
|
||||
opts = append(opts, grpc.Creds(altsTC))
|
||||
}
|
||||
server := grpc.NewServer(opts...)
|
||||
|
Reference in New Issue
Block a user