gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/service/grpc/options.go (about)

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