{"id":16105792,"url":"https://github.com/devlights/go-unix-domain-socket-example","last_synced_at":"2025-03-18T08:31:56.676Z","repository":{"id":57656012,"uuid":"289563401","full_name":"devlights/go-unix-domain-socket-example","owner":"devlights","description":"Unix domain socket (UDS) examples by golang","archived":false,"fork":false,"pushed_at":"2022-07-28T03:04:10.000Z","size":11,"stargazers_count":20,"open_issues_count":0,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-28T08:28:25.539Z","etag":null,"topics":["chromebook","go","golang","linux","socket","uds","unix-domain-socket"],"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/devlights.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}},"created_at":"2020-08-22T20:38:37.000Z","updated_at":"2024-11-04T17:29:28.000Z","dependencies_parsed_at":"2022-08-25T06:50:17.681Z","dependency_job_id":null,"html_url":"https://github.com/devlights/go-unix-domain-socket-example","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-unix-domain-socket-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-unix-domain-socket-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-unix-domain-socket-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devlights%2Fgo-unix-domain-socket-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devlights","download_url":"https://codeload.github.com/devlights/go-unix-domain-socket-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910749,"owners_count":20367545,"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":["chromebook","go","golang","linux","socket","uds","unix-domain-socket"],"created_at":"2024-10-09T19:10:38.625Z","updated_at":"2025-03-18T08:31:56.366Z","avatar_url":"https://github.com/devlights.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-unix-domain-socket-example\nUnix domain socket (UDS) example by golang\n\n## How to Run\n\n### Using [go-task](https://taskfile.dev/)\n\n```sh\n$ task --list\n* run-basic:            run basic example\n* run-readwrite:        run readwrite example\n* run-readwrite2:       run readwrite2 example\n* run-usinggob:         run usinggob example\n\n$ task [run-basic|run-readwrite|run-readwrite2|run-usinggob]\n```\n\n### basic\n\nOpen two terminals. the one is following:\n\n```sh\n$ cd cmd/basic/server\n$ go run .\n```\n\nand another terminal is following:\n\n```sh\n$ cd cmd/basic/client\n$ go run .\n```\n\n### read \u0026 write per connection\n\nOpen two terminals. the one is following:\n\n```sh\n$ cd cmd/readwrite/server\n$ go run .\n```\n\nand another terminal is following:\n\n```sh\n$ cd cmd/readwrite/client\n$ go run .\n```\n\n### N read \u0026 write on one connection\n\nOpen two terminals. the one is following:\n\n```sh\n$ cd cmd/readwrite2/server\n$ go run .\n```\n\nand another terminal is following:\n\n```sh\n$ cd cmd/readwrite2/client\n$ go run .\n```\n\n### Using encoding/gob package\n\nOpen two terminals. the one is following:\n\n```sh\n$ cd cmd/usinggob/server\n$ go run .\n```\n\nand another terminal is following:\n\n```sh\n$ cd cmd/usinggob/client\n$ go run .\n```\n\n## Monitor a local unix domain socket\n\nuse socat. install it if not exists.\n\n```sh\n$ sudo apt install -y socat\n```\n\nand launch server program then input following commands.\n\n```sh\n$ mv /tmp/echo.sock /tmp/echo.sock.original\n$ socat -t100 -x -v UNIX-LISTEN:/tmp/echo.sock,mode=777,reuseaddr,fork UNIX-CONNECT:/tmp/echo.sock.original\n```\n\n### REFERENCES\n\n[Can I monitor a local unix domain socket like tcpdump?](https://superuser.com/questions/484671/can-i-monitor-a-local-unix-domain-socket-like-tcpdump)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-unix-domain-socket-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevlights%2Fgo-unix-domain-socket-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevlights%2Fgo-unix-domain-socket-example/lists"}