github.com/annwntech/go-micro/v2@v2.9.5/service/grpc/options.go (about)

     1  package grpc
     2  
     3  import (
     4  	"crypto/tls"
     5  
     6  	gc "github.com/annwntech/go-micro/v2/client/grpc"
     7  	gs "github.com/annwntech/go-micro/v2/server/grpc"
     8  	"github.com/annwntech/go-micro/v2/service"
     9  )
    10  
    11  // WithTLS sets the TLS config for the service
    12  func WithTLS(t *tls.Config) service.Option {
    13  	return func(o *service.Options) {
    14  		o.Client.Init(
    15  			gc.AuthTLS(t),
    16  		)
    17  		o.Server.Init(
    18  			gs.AuthTLS(t),
    19  		)
    20  	}
    21  }