{"id":20310887,"url":"https://github.com/progrium/go-streamkit","last_synced_at":"2025-04-11T16:03:35.515Z","repository":{"id":66709098,"uuid":"51279731","full_name":"progrium/go-streamkit","owner":"progrium","description":"High level stream plumbing API in Go","archived":false,"fork":false,"pushed_at":"2016-02-08T05:16:39.000Z","size":16,"stargazers_count":9,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T12:06:33.822Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/progrium.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-02-08T04:48:15.000Z","updated_at":"2025-02-17T16:04:34.000Z","dependencies_parsed_at":"2023-04-28T19:53:33.441Z","dependency_job_id":null,"html_url":"https://github.com/progrium/go-streamkit","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/progrium%2Fgo-streamkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgo-streamkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgo-streamkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgo-streamkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/progrium","download_url":"https://codeload.github.com/progrium/go-streamkit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248438442,"owners_count":21103409,"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-11-14T17:34:54.086Z","updated_at":"2025-04-11T16:03:35.485Z","avatar_url":"https://github.com/progrium.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Streamkit\n\nStreamkit is an application communications library built on top of the SSH protocol stack. It gives you secure pipes over TCP and between processes that tunnel bi-directional data streams or message frames. It also works efficiently in-process.\n\nThis project is still in proof of concept phase. You can see an example of it in the `example` directory, but also [localtunnel](https://github.com/progrium/localtunnel) was rewritten to use Streamkit (when it was called Duplex).\n\n## API\n\nThe API has gone through many changes but this is currently what it looks like in rough form, written as Go interfaces.\n\n\ttype Peer interface {\n\t\t// Options\n\t\tSetOption(option int, value interface{}) error\n\t\tGetOption(option int) interface{}\n\n\t\t// Connections\n\t\tConnect(endpoint string) error\n\t\tDisconnect(endpoint string) error\n\t\tBind(endpoint string) error\n\t\tUnbind(endpoint string) error\n\n\t\t// Remote Peers\n\t\tPeers() []string\n\t\tDrop(peer string) error\n\t\tNextPeer() string\n\n\t\t// Channels\n\t\tAccept() (ChannelMeta, Channel)\n\t\tOpen(peer, service string, headers []string) (Channel, error)\n\n\t\t// Cleanup\n\t\tShutdown() error\n\t}\n\n\ttype ChannelMeta interface {\n\t\t// Name of service, if any\n\t\tService() string\n\n\t\t// Headers, often key=vaue\n\t\tHeaders() []string\n\n\t\t// Trailers, or \"close headers\"\n\t\t// Available once closed.\n\t\tTrailers() []string\n\n\t\t// Name of peers\n\t\tLocalPeer() string\n\t\tRemotePeer() string\n\t}\n\n\ttype Channel interface {\n\t\t// Send and receive\n\t\tWrite(data []byte) (int, error)\n\t\tRead(data []byte) (int, error)\n\n\t\t// Frames\n\t\tWriteFrame(frame []byte) error\n\t\tReadFrame() ([]byte, error)\n\n\t\t// Errors\n\t\tWriteError(frame []byte) error\n\t\tReadError() ([]byte, error)\n\n\t\t// EOF, Trailers, Close\n\t\tCloseWrite() error\n\t\tWriteTrailers(trailers []string) error\n\t\tClose() error\n\n\t\t// Channels of Channels\n\t\tOpen(service string, headers []string) (Channel, error)\n\t\tAccept() (ChannelMeta, Channel)\n\n\t\t// Attach to real sockets for gateways/proxies\n\t\tJoin(rwc io.ReadWriteCloser)\n\n\t\t// Reference to ChannelMeta\n\t\tMeta() ChannelMeta\n\t}\n\n\n## Architecture\n\n#### Peers and Channels\n\nThe main primitives in Streamkit are Peers and Channels. Peers are like advanced sockets that can connect and be connected to. They most closely resemble ZeroMQ sockets. Behind the scenes they are both an SSH server and client up to the SSH Connection Layer. There's no terminals or shelling out here, we just use the lower level protocols that give us encrypted, bi-directional, multiplexed streams. These streams are exposed as Channels.\n\nChannels are much closer to a regular socket connection, but are tunneled through the secure connections between Peers. Unlike regular TCP connections, Channels come with some metadata, including their intended service and key-value headers. The Channel API has basic send/recv calls, but also calls for sending and receiving message frames. It also utilizes what SSH would use for stderr to send error frames.\n\nFrames are just length prefixed payloads of bytes. Frames can go in either direction. This is a solid foundation for any application protocol. What's more, you can send Channels over Channels. Just think about that.\n\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Fgo-streamkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogrium%2Fgo-streamkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Fgo-streamkit/lists"}