{"id":15393864,"url":"https://github.com/mitchellh/go-grpc-net-conn","last_synced_at":"2026-03-16T09:03:57.652Z","repository":{"id":57523585,"uuid":"253650720","full_name":"mitchellh/go-grpc-net-conn","owner":"mitchellh","description":"Turn any gRPC stream into a Go `net.Conn` implementation.","archived":false,"fork":false,"pushed_at":"2023-03-08T16:17:56.000Z","size":22,"stargazers_count":84,"open_issues_count":0,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-09T20:12:28.434Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/mitchellh.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":"2020-04-07T00:50:18.000Z","updated_at":"2024-12-13T22:17:34.000Z","dependencies_parsed_at":"2024-06-18T15:24:15.092Z","dependency_job_id":"8a20dfb9-ad93-4a08-a210-15f08e99cde4","html_url":"https://github.com/mitchellh/go-grpc-net-conn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-grpc-net-conn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-grpc-net-conn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-grpc-net-conn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mitchellh%2Fgo-grpc-net-conn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mitchellh","download_url":"https://codeload.github.com/mitchellh/go-grpc-net-conn/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103872,"owners_count":21048245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-01T15:20:37.148Z","updated_at":"2026-03-16T09:03:57.614Z","avatar_url":"https://github.com/mitchellh.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# go-grpc-net-conn [![Godoc](https://godoc.org/github.com/mitchellh/go-grpc-net-conn?status.svg)](https://godoc.org/github.com/mitchellh/go-grpc-net-conn)\n\ngo-grpc-net-conn is a Go library that creates a `net.Conn` implementation\non top of gRPC streams. If the stream is bidirectional (both the request and\nresponse of an RPC is a stream) then the `net.Conn` is a\n[full-duplex connection](https://en.wikipedia.org/wiki/Duplex_(telecommunications)#Full_duplex).\n\n## Installation\n\nStandard `go get`:\n\n```\n$ go get github.com/mitchellh/go-grpc-net-conn\n```\n\n## Usage \u0026 Example\n\nFor usage and examples see the [Godoc](http://godoc.org/github.com/mitchellh/go-grpc-net-conn).\n\nA brief example is shown below. Note that the only minor complexity is\npopulating the required fields for the `Conn` structure. This package needs\nto know how to encode and decode the byte slices onto your expected protobuf\nmessage types.\n\nImagine a protobuf service that looks like the following:\n\n```proto\nsyntax = \"proto3\";\n\npackage example;\n\nservice ExampleService {\n  rpc Stream(stream Bytes) returns (stream Bytes);\n}\n\nmessage Bytes {\n  bytes data = 1;\n}\n```\n\nYou can use this in the following way:\n\n```go\n// Call our streaming endpoint\nresp, err := client.Stream(context.Background())\n\n// We need to create a callback so the conn knows how to decode/encode\n// arbitrary byte slices for our proto type.\nfieldFunc := func(msg proto.Message) *[]byte {\n\treturn \u0026msg.(*example.Bytes).Data\n}\n\n// Wrap our conn around the response.\nconn := \u0026grpc_net_conn.Conn{\n\tStream: resp,\n\tRequest: \u0026example.Bytes{},\n\tResponse: \u0026example.Bytes{},\n\tEncode: SimpleEncoder(fieldFunc),\n\tDecode: SimpleDecoder(fieldFunc),\n}\n\n// conn implements net.Conn so use it as you would!\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fgo-grpc-net-conn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmitchellh%2Fgo-grpc-net-conn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmitchellh%2Fgo-grpc-net-conn/lists"}