github.com/micro/go-micro/examples@v0.0.0-20210105173217-bf4ab679e18b/secure/README.md (about) 1 # Secure 2 3 This example demonstrates how to use tls self signed certs with a micro service. 4 5 The micro transport has a secure option which will generate a cert on startup. Clients will use 6 insecure skip verify by default. 7 8 ## Contents 9 10 - srv - greeter server with secure transport that generates a tls self signed cert 11 - cli - greeter client with secure transport that uses insecure skip verify 12 13 ## Micro Toolkit 14 15 The cli example can be used with the micro toolkit for a secure client 16 17 Create a tls.go file 18 19 ``` 20 package main 21 22 import ( 23 "github.com/micro/go-micro/v2/client" 24 "github.com/micro/go-micro/v2/transport" 25 ) 26 27 func init() { 28 client.DefaultClient.Init( 29 client.Transport( 30 transport.NewTransport(transport.Secure(true)), 31 ), 32 ) 33 } 34 ``` 35 36 Build the toolkit with the tls.go file 37 38 ``` 39 cd github.com/micro/micro 40 go build -o micro main.go tls.go 41 ```