{"id":26158384,"url":"https://github.com/nidhhoggr/gipc","last_synced_at":"2026-04-25T09:07:03.076Z","repository":{"id":240806543,"uuid":"803515179","full_name":"nidhhoggr/gipc","owner":"nidhhoggr","description":"IPC library featuring multi-client support without enabling CGO","archived":false,"fork":false,"pushed_at":"2025-03-01T21:08:07.000Z","size":113,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-12T01:35:02.667Z","etag":null,"topics":["ipc","multiclient","tcp","unix-socket"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nidhhoggr.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":"2024-05-20T21:46:01.000Z","updated_at":"2025-03-01T21:08:02.000Z","dependencies_parsed_at":"2024-05-21T00:15:53.165Z","dependency_job_id":"fa508559-d2e7-4018-a60e-386f505be555","html_url":"https://github.com/nidhhoggr/gipc","commit_stats":null,"previous_names":["joe-at-startupmedia/gipc","nidhhoggr/gipc"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/nidhhoggr/gipc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhhoggr%2Fgipc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhhoggr%2Fgipc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhhoggr%2Fgipc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhhoggr%2Fgipc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nidhhoggr","download_url":"https://codeload.github.com/nidhhoggr/gipc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nidhhoggr%2Fgipc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32256254,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T04:23:17.126Z","status":"ssl_error","status_checked_at":"2026-04-25T04:21:53.360Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ipc","multiclient","tcp","unix-socket"],"created_at":"2025-03-11T10:50:51.605Z","updated_at":"2026-04-25T09:07:03.057Z","avatar_url":"https://github.com/nidhhoggr.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gipc\n\n[![Testing](https://github.com/nidhhoggr/gipc/actions/workflows/testing.yml/badge.svg)](https://github.com/nidhhoggr/gipc/actions/workflows/testing.yml)\n[![codecov](https://codecov.io/gh/nidhhoggr/gipc/graph/badge.svg?token=0G9FP0QN5S)](https://codecov.io/gh/nidhhoggr/gipc)\n[![Go Report Card](https://goreportcard.com/badge/github.com/nidhhoggr/gipc)](https://goreportcard.com/report/github.com/nidhhoggr/gipc)\n\n### Overview\n \nA simple-to-use package that creates a communication channel between two go processes.\n\n\n## Usage\n\nCreate a server with the default configuration and start listening for the client:\n\n```go\ns, err := gipc.StartServer(\u0026ServerConfig{Name:\"\u003cname of connection\u003e\"})\nif err != nil {\n\tlog.Println(err)\n\treturn\n}\n```\nCreate a client and connect to the server:\n\n```go\nc, err := gipc.StartClient(\u0026ClientConfig{Name:\"\u003cname of connection\u003e\"})\nif err != nil {\n\tlog.Println(err)\n\treturn\n}\n```\n\n### Read messages \n\nRead each message sent (blocking):\n\n```go\nfor {\n\n\t//message, err := s.Read() // server\n\tmessage, err := c.Read() // client\n\t\n\tif err == nil {\n\t// handle error\n\t}\n\t\n\t// do something with the received messages\n}\n```\n\nRead each message sent until a specific duration has surpassed. \n\n```go\nfor {\n\n\tmessage, err := c.ReadTimed(5*time.Second)\n\t\n\tif  message == gipc.TimeoutMessage {\n\t\tcontinue\n    }   \n\t\n\tif err == nil \u0026\u0026 c.StatusCode() != gipc.Connecting {\n\t\n\t} \n}\n```\n\n### MultiClient Mode\n\nAllow polling of newly created clients on each iteration until a specific duration has surpassed. \n\n```go\ns, err := gipc.StartServer(\u0026ServerConfig{Name:\"\u003cname of connection\u003e\", MultiClient: true})\n    if err != nil {\n    log.Println(err)\n    return\n}\n\nfor {\n    s.Connections.ReadTimed(5*time.Second, func(srv *ipc.Server, message *ipc.Message, err error) {\n        if  message == gipc.TimeoutMessage {\n            continue\n        }\n        \n        if message.MsgType == -1 \u0026\u0026 message.Status == \"Connected\" {\n        \n        }\n    })\n}\n```\n\n* `Server.Connections.ReadTimed` will block until the slowest ReadTimed callback completes. \n* `Server.Connections.ReadTimedFastest` will unblock after the first ReadTimed callback completes.\n\nWhile `ReadTimedFastest` will result in faster iterations, it will also result in more running goroutines in scenarios where clients requests are not evenly distributed. \n\nTo get a better idea of how these work, run the following examples: \n\nUsing `ReadTimed`:\n```bash\ngo run --race example/multiclient/multiclient.go\n```\n\nUsing `ReadTimedFastest`: \n```bash\nFAST=true go run --race example/multiclient/multiclient.go\n```\n\nNotice that the Server receives messages faster and the process will finish faster\n\n### Message Struct\n\nAll received messages are formatted into the type Message\n\n```go\ntype Message struct {\n\tErr     error  // details of any error\n\tMsgType int    // 0 = reserved , -1 is an internal message (disconnection or error etc), all messages recieved will be \u003e 0\n\tData    []byte // message data received\n\tStatus  string // the status of the connection\n}\n```\n\n### Write a message\n\n\n```go\n\n//err := s.Write(1, []byte(\"\u003cMessage for client\"))\nerr := c.Write(1, []byte(\"\u003cMessage for server\"))\n\nif err == nil {\n// handle error\n}\n```\n\n ## Advanced Configuration\n\nServer options:\n\n```go\nconfig := \u0026gipc.ServerConfig{\n\tName: (string),            // the name of the queue (required)\n\tEncryption: (bool),        // allows encryption to be switched off (bool - default is true)\n\tMaxMsgSize: (int) ,        // the maximum size in bytes of each message ( default is 3145728 / 3Mb)\n\tUnmaskPermissions: (bool), // make the socket writeable for other users (default is false)\n\tMultiMode: (bool),         // allow the server to connect with multiple clients\n}\n```\n\nClient options:\n\n```go\nconfig := \u0026gipc.ClientConfig  {\n\tName: (string),             // the name of the queue needs to match the name of the ServerConfig (required)\n\tEncryption: (bool),         // allows encryption to be switched off (bool - default is true)\n\tTimeout: (time.Duration),   // duration to wait while attempting to connect to the server (default is 0 no timeout)\n\tRetryTimer: (time.Duration),// duration to wait before iterating the dial loop or reconnecting (default is 1 second)\n}\n```\n\nBy default, the `Timeout` value is 0 which allows the dial loop to iterate in perpetuity until a connection to the server is established. \n\nIn scenarios where a perpetually attempting to reconnect is impractical, a `Timeout` value should be provided. When the connection times out, no further retries will be attempted. \n\nWhen a Client is no longer used, ensure that the `.Close()` method is called to prevent unnecessary perpetual connection attempts.\n\n ### Encryption\n\n By default, the connection established will be encrypted, ECDH384 is used for the key exchange and AES 256 GCM is used for the cipher.\n\n Encryption can be switched off by passing in a custom configuration to the server \u0026 client start function:\n\n```go\nEncryption: false\n```\n\n ### Unix Socket Permissions\n\nUnder most configurations, a socket created by a user will by default not be writable by another user, making it impossible for the client and server to communicate if being run by separate users. The permission mask can be dropped during socket creation by passing a custom configuration to the server start function.  **This will make the socket writable for any user.**\n\n```go\nUnmaskPermissions: true\t\n```\n\n## TCP Support\n\nInstead of using Unix domain sockets, you can also use TCP. This provides the benefits from TCP reliability and platform interoperability (i.e. Windows) but also sacrifices performance and cpu/memory.\n\nTo build with TCP support:\n```bash\ngo build -tags network\n```\n\nYou can customize the following using runtime environment variables:\n* `GIPC_NETWORK_HOST`: The address host of which the TCP connection is bound to, by default this is 127.0.0.1\n* `GIPC_NETWORK_PORT`: The address port of which the TCP connection is bound to, by default this is 8100\n\n```bash\nGIPC_NETWORK_HOST=10.0.2.15 GIPC_NETWORK_PORT=7200 go run -tags network\n```\n\n## Debugging\n\n### Environment Variables\n\nYou can specify debug verbosity using the `GIPC_DEBUG` environment variable.\n\n```bash\nGIPC_DEBUG=true make run\n```\n\n`GIPC_DEBUG` accepts the following values:\n* `true`: sets the debug level to debug\n* `debug`: has the same effect as true\n* `info`: sets the debug level to info\n* `warn`: sets the debug level to warn\n* `error`: sets the debug level to error\n\n## Testing\n\nThe package has been tested on Mac and Linux and has extensive test coverage. The following commands will run all the tests and examples with race condition detection enabled.\n\n```bash\nmake test run\n```\n\nYou can change the speed of the tests by providing a value for the `GIPC_WAIT` environment variable. A value `\u003e 5` will specify the amount of milliseconds to wait in between critical intervals whereas a value `\u003c= 5` will resolve to the amount of seconds to wait in between the same. The default value is 10 milliseconds. You can also provide the `IPC_DEBUG=true` environment variable to set the `logrus.Loglevel` to debug mode. The following command will make the tests run in debug mode while waiting 500ms in between critical intervals:\n\n```bash\nGIPC_WAIT=500 GIPC_DEBUG=true make test run\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnidhhoggr%2Fgipc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnidhhoggr%2Fgipc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnidhhoggr%2Fgipc/lists"}