{"id":18770778,"url":"https://github.com/rasa/wintun","last_synced_at":"2025-07-19T16:36:29.290Z","repository":{"id":149687790,"uuid":"177531908","full_name":"rasa/wintun","owner":"rasa","description":"Mirror of https://git.zx2c4.com/wintun","archived":false,"fork":false,"pushed_at":"2019-03-28T15:01:17.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-29T07:42:28.654Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/rasa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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":"2019-03-25T07:00:36.000Z","updated_at":"2019-03-28T15:01:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"7dc899fa-5b86-4420-9d6b-4dd786b864c4","html_url":"https://github.com/rasa/wintun","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/rasa%2Fwintun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasa%2Fwintun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasa%2Fwintun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rasa%2Fwintun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rasa","download_url":"https://codeload.github.com/rasa/wintun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239677854,"owners_count":19679144,"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-07T19:21:26.175Z","updated_at":"2025-02-19T14:36:03.963Z","avatar_url":"https://github.com/rasa.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wintun Network Adapter\n### TUN Device Driver for Windows\n\nThis is a layer 3 TUN driver for Windows 7, 8, 8.1, and 10. Originally created for [WireGuard](https://www.wireguard.com/), it is intended to be useful to a wide variety of projects that require layer 3 tunneling devices with implementations primarily in userspace.\n\n## Build Requirements\n\n- [Visual Studio 2017](https://visualstudio.microsoft.com/downloads/)\n- [Windows Driver Kit for Windows 10](https://docs.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk)\n\n\n## Digital Signing\n\nDigital signing is integral part of the build process. By default, the driver will be test-signed using a certificate that the WDK should automatically generate. To subsequently load the driver, you will need to put your computer into test mode by executing as Administrator `bcdedit /set testsigning on`.\n\nIf you possess an EV certificate for kernel mode code signing you should switch TUN driver digital signing from test-signing to production-signing by authoring your `wintun.vcxproj.user` file to look something like this:\n\n```xml\n\u003c?xml version=\"1.0\" encoding=\"utf-8\"?\u003e\n\u003cProject ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"\u003e\n  \u003cPropertyGroup\u003e\n    \u003cSignMode\u003eProductionSign\u003c/SignMode\u003e\n    \u003cCrossCertificateFile\u003e$(WDKContentRoot)CrossCertificates\\DigiCert_High_Assurance_EV_Root_CA.crt\u003c/CrossCertificateFile\u003e\n    \u003cProductionCertificate\u003eCN=WireGuard LLC, O=WireGuard LLC, L=Boulder, S=Colorado, C=US, SERIALNUMBER=4227913, OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.2=Ohio, OID.1.3.6.1.4.1.311.60.2.1.3=US | DF98E075A012ED8C86FBCF14854B8F9555CB3D45\u003c/ProductionCertificate\u003e\n  \u003c/PropertyGroup\u003e\n\u003c/Project\u003e\n```\n\nModify the `\u003cCrossCertificateFile\u003e` to contain the full path to the cross-signing certificate of CA that issued your certificate. You should be able to find its `.crt` file in `C:\\Program Files (x86)\\Windows Kits\\10\\CrossCertificates`. Note that the `$(WDKContentRoot)` expands to `C:\\Program Files (x86)\\Windows Kits\\10\\`.\n\nIf you already have `wintun.vcxproj.user` file, just add the `\u003cPropertyGroup\u003e` section.\n\n## Usage\n\nAfter loading the driver and creating a network interface the typical way using [SetupAPI](https://docs.microsoft.com/en-us/windows-hardware/drivers/install/setupapi), open `\\\\.\\Device\\WINTUN%d` as Local System, where `%d` is the [LUID](https://docs.microsoft.com/en-us/windows/desktop/api/ifdef/ns-ifdef-_net_luid_lh) index (`NetLuidIndex` member) of the network device. You may then [`ReadFile`](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-readfile) and [`WriteFile`](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-writefile) bundles of packets of the following format:\n\n```\n+------------------------------+\n| size_0                       |\n|   4 bytes, native endian     |\n+------------------------------+\n|                              |\n| padding                      |\n|   12 bytes, all zero         |\n|                              |\n+------------------------------+\n|                              |\n| packet_0                     |\n|   size_0 bytes               |\n|                              |\n~                              ~\n|                              |\n+------------------------------+\n| padding                      |\n|   16-((4+size_0)\u002615) bytes,  |\n|   all zero                   |\n+------------------------------+\n| size_1                       |\n|   4 bytes, native endian     |\n+------------------------------+\n|                              |\n| padding                      |\n|   12 bytes, all zero         |\n|                              |\n+------------------------------+\n|                              |\n| packet_1                     |\n|   size_1 bytes               |\n|                              |\n~                              ~\n```\n\nEach packet segment should contain a layer 3 IPv4 or IPv6 packet. Up to 256 packets may be read or written during each call to `ReadFile` or `WriteFile`.\n\nIt is advisable to use [overlapped I/O](https://docs.microsoft.com/en-us/windows/desktop/sync/synchronization-and-overlapped-input-and-output) for this. If using blocking I/O instead, it may be desirable to open separate handles for reading and writing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasa%2Fwintun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frasa%2Fwintun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frasa%2Fwintun/lists"}