2019-06-03 18:44:43 +01:00
|
|
|
package grpc
|
|
|
|
|
|
|
|
import (
|
|
|
|
"crypto/tls"
|
|
|
|
|
2020-01-30 14:39:00 +03:00
|
|
|
gc "github.com/micro/go-micro/v2/client/grpc"
|
|
|
|
gs "github.com/micro/go-micro/v2/server/grpc"
|
|
|
|
"github.com/micro/go-micro/v2/service"
|
2019-06-03 18:44:43 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
// WithTLS sets the TLS config for the service
|
2019-12-29 21:07:55 +00:00
|
|
|
func WithTLS(t *tls.Config) service.Option {
|
|
|
|
return func(o *service.Options) {
|
2019-06-03 18:44:43 +01:00
|
|
|
o.Client.Init(
|
|
|
|
gc.AuthTLS(t),
|
|
|
|
)
|
|
|
|
o.Server.Init(
|
|
|
|
gs.AuthTLS(t),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|