This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "fmt" | |
| "github.com/shirou/gopsutil/v3/cpu" | |
| "golang.org/x/sys/windows" | |
| "google.golang.org/grpc" | |
| pb "grpc_example/gen/protos" | |
| "log" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create-code: | |
| protoc --proto_path=protos protos/* --go_out=gen/ | |
| protoc --proto_path=protos protos/* --go-grpc_out=gen/ | |
| run-server: | |
| go build -o ${CURDIR}/server/server ${CURDIR}/server/server.go | |
| ${CURDIR}/server/server | |
| run-client: | |
| go build -o ${CURDIR}/client/client ${CURDIR}/client/client.go |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| package main; | |
| option go_package = "./protos"; | |
| service HealthService { | |
| rpc GetSystemHealth(HealthRequest) returns (HealthResponse) {} | |
| rpc GetCpuData(stream CpuRequest) returns (stream CpuResponse) {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
| go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| create-code: | |
| protoc --proto_path=protos protos/* --go_out=gen/ | |
| protoc --proto_path=protos protos/* --go-grpc_out=gen/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| package main; | |
| option go_package = "./protos"; | |
| service HealthService { | |
| rpc GetCpuData(stream CpuRequest) returns (stream CpuResponse) {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| package main; | |
| option go_package = "./protos"; | |
| service HelloService { | |
| rpc GetHello(HelloRequest) returns (HelloResponse) {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| syntax = "proto3"; | |
| package main; | |
| option go_package = "./protos"; | |
| service HelloService { | |
| rpc GetHello(HelloRequest) returns (HelloResponse) {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "errors" | |
| "fmt" | |
| "time" | |
| ) | |
| func AmirimOlayYerine(ctx context.Context) error { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "context" | |
| "errors" | |
| "fmt" | |
| "time" | |
| ) | |
| func AmirimOlayYerine(ctx context.Context) error { |