{"id":20009036,"url":"https://github.com/linuxkit/virtsock","last_synced_at":"2025-04-14T15:53:11.187Z","repository":{"id":8652397,"uuid":"58654089","full_name":"linuxkit/virtsock","owner":"linuxkit","description":"Go bindings for virtio and Hyper-V sockets","archived":false,"fork":false,"pushed_at":"2024-10-09T23:05:34.000Z","size":838,"stargazers_count":90,"open_issues_count":3,"forks_count":31,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-07T09:08:16.212Z","etag":null,"topics":["golang","hyper-v","hyperkit","linuxkit","socket","virtio","virtiovsock"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/linuxkit.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":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-05-12T15:32:17.000Z","updated_at":"2025-03-04T11:04:55.000Z","dependencies_parsed_at":"2024-12-14T08:02:05.243Z","dependency_job_id":"1e5a4878-17ca-4456-a3aa-128fabec567a","html_url":"https://github.com/linuxkit/virtsock","commit_stats":{"total_commits":188,"total_committers":13,"mean_commits":"14.461538461538462","dds":"0.22872340425531912","last_synced_commit":"cb6a20cc042270a31acb5de5a2bf942393af4a67"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxkit%2Fvirtsock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxkit%2Fvirtsock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxkit%2Fvirtsock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/linuxkit%2Fvirtsock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/linuxkit","download_url":"https://codeload.github.com/linuxkit/virtsock/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248911377,"owners_count":21182079,"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":["golang","hyper-v","hyperkit","linuxkit","socket","virtio","virtiovsock"],"created_at":"2024-11-13T07:13:51.912Z","updated_at":"2025-04-14T15:53:11.167Z","avatar_url":"https://github.com/linuxkit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nThis repository contains Go bindings and sample code for [Hyper-V sockets](https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/develop/make_mgmt_service) and [virtio sockets](http://stefanha.github.io/virtio/)(VSOCK).\n\n## Organisation\n\n- `pkg/hvsock`: Go binding for Hyper-V sockets\n- `pkg/vsock`: Go binding for virtio VSOCK\n- `cmd/sock_stress`: A stress test program for virtsock\n- `cmd/vsudd`: A unix domain socket to virtsock proxy (used in Docker for Mac/Windows)\n- `scripts`: Miscellaneous scripts\n- `c`: Sample C code (including benchmarks and stress tests)\n- `data`: Data from benchmarks\n\n\n## Building\n\nBy default the Go sample code is build in a container. Simply type `make`.\n\nIf you want to build binaries on a local system use `make build-binaries`.\n\n## Testing\n\nThere are several examples and tests written both in [Go](./cmd) and in [C](./c). The C code is Hyper-V sockets specific while the Go code also works with virtio sockets and [HyperKit](https://github.com/moby/hyperkit). The respective READMEs contain instructions on how to run the tests, but the simplest way is to use [LinuxKit](https://github.com/linuxkit/linuxkit).\n\nAssuming you have LinuxKit installed, the make target `make linuxkit`\nwill build a custom Linux image which can be booted on HyperKit or on\nWindows. The custom Linux image contains the test binaries.\n\n### macOS\n\nBoot the Linux VM:\n```\nlinuxkit run hvtest\n```\nThis should create a directory called `./hvtest-state`.\n\nRun the server in the VM and client on the host:\n```\nlinux$ sock_stress -s vsock -v 1\nmacos$ ./bin/sock_stress.darwin -c vsock://3 -m hyperkit:./hvtest-state -v 1\n```\n\nRun the server on the host and the client inside the VM:\n```\nmacos$ ./bin/sock_stress.darwin -s vsock -m hyperkit:./hvtest-state -v 1\nlinux$ sock_stress -c vsock://2 -v 1\n```\n\n### Windows\n\nOn Windows we currently only support the server to be run inside the\nVM and the host connecting to it. In the future we will support\nrunning the server on the host as well.\n\nFor Linux guests on Windows there are two different implmentations,\none in the LinuxKit 4.9.x kernels and one in 4.14.x upstream\nkernels. They require different protocols to be used. The\n`sock_stress` and `vsudd` programs automatically detect which version\nto use.\n\nBoot the Linux VM (from an elevated powershell):\n```\nlinuxkit run -name hvtest hvtest-efi.iso\n```\n\nRun the server in the VM and client on the host:\n```\nlinux$ sock_stress -v 1 -s hvsock\nwin$ sock_stress -v 1 -c hvsock://\u003cVM ID\u003e\n```\n(where `\u003cVM ID\u003e` is from the output of: `(get-vm hvtest).Id`)\n\nRun the server on the host and the client inside the VM:\n```\nwin$ sock_stress -v 1 -s hvsock\nlinux$ sock_stress -v 1 -c hvsock://parent\n```\n**Note:** This may fail on the client with receiving unexpected EOFs (see below).\n\n\n## Known limitations\n\n- `hvsock`: When running the server on the host with a client in a\n  Linux VM, it looks like unidirectional `shutdown()` is not working\n  properly. There appears to be a race of sort.\n\n- `hvsock`: Hyper-V socket implementations prior to Windows build\n  10586 (aka 1511, aka Threshold 2) was buggy. There may even be\n  issues with build prior to build 14393 (aka 1607, aka Redstone 1).\n  \n- `hvsock`: Earlier versions of this code supported the older Windows\n  builds, but support has now been removed. If you require the older version,\n  please use the `end_10586_tag`.\n\n- `vsock`: There is general host side implementation as the interface\n  is hypervisor specific. The `vsock` package includes some support\n  for connecting with the VSOCK implementation in\n  [Hyperkit](https://github.com/moby/hyperkit), but there is no\n  implementation for, e.g. `qemu`.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxkit%2Fvirtsock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flinuxkit%2Fvirtsock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flinuxkit%2Fvirtsock/lists"}