secure/

directory
v3.0.0-...-7136c61 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2021 License: Apache-2.0

README

Secure

This example demonstrates how to use tls self signed certs with a micro service.

The micro transport has a secure option which will generate a cert on startup. Clients will use insecure skip verify by default.

Contents

  • srv - greeter server with secure transport that generates a tls self signed cert
  • cli - greeter client with secure transport that uses insecure skip verify

Micro Toolkit

The cli example can be used with the micro toolkit for a secure client

Create a tls.go file

package main

import (
	"go-micro.dev/v4/client"
	"go-micro.dev/v4/transport"
)

func init() {
	client.DefaultClient.Init(
		client.Transport(
			transport.NewTransport(transport.Secure(true)),
		),
	)
}

Build the toolkit with the tls.go file

cd github.com/micro/micro
go build -o micro main.go tls.go

Directories

Path Synopsis
srv
proto/hello
Package go_micro_srv_greeter is a generated protocol buffer package.
Package go_micro_srv_greeter is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL