Go to file
wyh b2e7135ad5 代码相对完善 2022-01-20 17:06:44 +08:00
pb 代码相对完善 2022-01-20 17:06:44 +08:00
protos 代码相对完善 2022-01-20 17:06:44 +08:00
service 代码相对完善 2022-01-20 17:06:44 +08:00
.gitignore 代码相对完善 2022-01-20 17:06:44 +08:00
README.md 代码相对完善 2022-01-20 17:06:44 +08:00
cert.pem 代码相对完善 2022-01-20 17:06:44 +08:00
data.go 代码相对完善 2022-01-20 17:06:44 +08:00
go.mod 代码相对完善 2022-01-20 17:06:44 +08:00
key.pem 代码相对完善 2022-01-20 17:06:44 +08:00
main.go 代码相对完善 2022-01-20 17:06:44 +08:00
openssl.cnf 代码相对完善 2022-01-20 17:06:44 +08:00

README.md

grpc-server

  • 获取组件

  • go get -u google.golang.org/grpc

  • 生成 pb 文件

  • protoc --proto_path=./protos ./protos/*.proto --go_out=plugins=grpc:./pb

  • 生成 ssl 证书

  • cmd: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj /CN=localhost

  • go1.15 之后需使用临时配置 添加扩展 SAN

  • 临时配置 openssl.cnf 并使用

  • -config 指定配置文件

  • -extensions v3_req 扩展

  • cmd: openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj /CN=localhost -config ./openssl.cnf -extensions v3_req