Go to file
wyh 48683558dc fixed 2022-07-07 15:50:04 +08:00
data 格式化输出grpc 2022-03-03 10:38:10 +08:00
pb 代码相对完善 2022-01-20 17:06:44 +08:00
protos 代码相对完善 2022-01-20 17:06:44 +08:00
server 格式化输出grpc 2022-03-03 10:38:10 +08:00
service 暂存 2022-03-03 10:34:41 +08:00
.gitignore fixed 2022-01-25 10:50:05 +08:00
README.md 代码相对完善 2022-01-20 17:06:44 +08:00
cert.pem 代码相对完善 2022-01-20 17:06:44 +08:00
go.mod fixed 2022-01-25 10:50:05 +08:00
key.pem 代码相对完善 2022-01-20 17:06:44 +08:00
logger.go fixed 2022-01-25 10:50:05 +08:00
main.go fixed 2022-07-07 15:50:04 +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