{"id":22529411,"url":"https://github.com/minhtran241/protocol_buffers_go_generate","last_synced_at":"2026-02-27T03:01:07.398Z","repository":{"id":154023405,"uuid":"547000416","full_name":"minhtran241/protocol_buffers_go_generate","owner":"minhtran241","description":"Go bindings for Protocol Buffers instruction","archived":false,"fork":false,"pushed_at":"2022-10-08T13:41:58.000Z","size":382,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T04:26:43.669Z","etag":null,"topics":["go-protobuf","google-protocol-buffers"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minhtran241.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-07T01:41:50.000Z","updated_at":"2025-01-06T01:06:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"07c788d5-907c-4dd4-a895-6489463811cc","html_url":"https://github.com/minhtran241/protocol_buffers_go_generate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/minhtran241/protocol_buffers_go_generate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtran241%2Fprotocol_buffers_go_generate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtran241%2Fprotocol_buffers_go_generate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtran241%2Fprotocol_buffers_go_generate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtran241%2Fprotocol_buffers_go_generate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minhtran241","download_url":"https://codeload.github.com/minhtran241/protocol_buffers_go_generate/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minhtran241%2Fprotocol_buffers_go_generate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29883111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-26T23:51:21.483Z","status":"online","status_checked_at":"2026-02-27T02:00:06.759Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go-protobuf","google-protocol-buffers"],"created_at":"2024-12-07T07:14:39.547Z","updated_at":"2026-02-27T03:01:07.381Z","avatar_url":"https://github.com/minhtran241.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Instruction for Generating Go Protocol Buffers\n\nThe module ([`github.com/golang/protobuf`](https://pkg.go.dev/mod/github.com/golang/protobuf))\ncontains Go bindings for Protocol Buffers.\n\nThe documentation and tutorials by Google can be found at [`Protocol Buffers Go tutorials`](https://developers.google.com/protocol-buffers/docs/gotutorial)\n\n## Package index\n\nSummary of the packages provided by this module:\n\n-   [`proto`](https://pkg.go.dev/github.com/golang/protobuf/proto): Package\n    `proto` provides functions operating on Protocol Buffers messages such as cloning,\n    merging, and checking equality, as well as binary serialization and text\n    serialization.\n\n-   [`protoc-gen-go/plugin`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go/plugin):\n    Package `plugin` is the generated package for\n    `google/protobuf/compiler/plugin.proto`.\n-   [`protoc-gen-go`](https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go):\n    The `protoc-gen-go` binary is a protoc plugin to generate a Go Protocol Buffers package.\n\n## How do we use Protocol Buffers?\n\n-   Protocol Buffers is faster than JSON and has 3 main components that we have to deal with:\n\n    -   Message Descriptors\n\n        -   When using Protocol Buffers we have to define our own messages structure in `.proto` files.\n\n    -   Message Implementations\n\n        -   Messages definitions are not enough to represent and exchange data in any programming language. We have to generate classes/objects to deal with data in the chosen programming language.\n        -   To install the compiler, download packages:\n            -   `go get -u google.golang.org/protobuf`\n            -   `go get -u google.golang.org/protobuf/proto`\n        -   To install the Go protocol buffers plugin:\n            -   `go install google.golang.org/protobuf/cmd/protoc-gen-go@latest`\n        -   To compile:\n            -   `protoc --go_out=. ./protocol/*.proto`\n\n    -   Parsing and Serialization\n\n        -   After defining and creating Protocol Buffers messages, we need to be able to exchange these messages.\n\n## Example Client-Server TCP Connection\n\n### Package index\n\n-   [`flag`](https://pkg.go.dev/flag): Package\n    `flag` implements command-line flag parsing: `-admin client` and `-admin server`\n\n-   [`io/ioutil`](https://pkg.go.dev/io/ioutil):\n    Package `ioutil` implements some I/O utility functions.\n\n-   [`net`](https://pkg.go.dev/net):\n    Package `net` provides a portable interface for network I/O, including TCP/IP, UDP, domain name resolution, and Unix domain sockets. Although the package provides access to low-level networking primitives, most clients will need only the basic interface provided by the Dial, Listen, and Accept functions and the associated Conn and Listener interfaces. The crypto/tls package uses the same interfaces and similar Dial and Listen functions.\n\n### Logic Explanation\n\n-   Send protocol message CML: `go run ./main.go -admin client`\n-   Listen to protocol message CML: `go run ./main.go -admin server`\n-   Server listens on `tcp`, `127.0.0.1:8085`\n-   `sendData()` uses `net.Dial(\"tcp\", \"127.0.0.1:8085\")` to create a TCP connection between the server and the client. Function receives `data []byte` parameter and writes it to the connection it created before\n-   `runClient()` creates a protocol object and uses `proto.Marshal(\u0026object)` to marshal the protocol object before sending it to the connection by calling `sendData()`.\n-   `runServer` uses `net.Listen(\"tcp\", \"127.0.0.1:8085\")` to listen on TCP. Function waits for reading data from the connection by using `ioutil.ReadAll(connection)` and then unmarshal the data received by `proto.Unmarshal(data, object)`\n-   Demo\n\n    \u003cimg src=\"./client_server.png\"\u003e\n\n## Contributor\n\n-   Minh Tran (Me)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhtran241%2Fprotocol_buffers_go_generate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminhtran241%2Fprotocol_buffers_go_generate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminhtran241%2Fprotocol_buffers_go_generate/lists"}