    Skip to content

      Navigation Menu

            Sign in Appearance settings
                * Platform
                        + AI CODE CREATION
                            o GitHub Copilot Write better code with AI
                            o GitHub Copilot app Direct agents from issue to merge
                            o MCP Registry Integrate external tools
                        + DEVELOPER WORKFLOWS
                            o Actions Automate any workflow
                            o Codespaces Instant dev environments
                            o Issues Plan and track work
                            o Code Review Manage code changes
                            o Code Quality Enforce quality at merge
                        + APPLICATION SECURITY
                            o GitHub Advanced Security Find and fix vulnerabilities
                            o Code security Secure your code as you build
                            o Secret protection Stop leaks before they start
                        + EXPLORE
                            o Why GitHub
                            o Documentation
                            o Blog
                            o Changelog
                            o Marketplace
                      View all features
                * Solutions
                        + BY COMPANY SIZE
                            o Enterprises
                            o Small and medium teams
                            o Startups
                            o Nonprofits
                        + BY USE CASE
                            o App Modernization
                            o DevSecOps
                            o DevOps
                            o CI/CD
                            o View all use cases
                        + BY INDUSTRY
                            o Healthcare
                            o Financial services
                            o Manufacturing
                            o Government
                            o View all industries
                      View all solutions
                * Resources
                        + EXPLORE BY TOPIC
                            o AI
                            o Software Development
                            o DevOps
                            o Security
                            o View all topics
                        + EXPLORE BY TYPE
                            o Customer stories
                            o Events & webinars
                            o Ebooks & reports
                            o Business insights
                            o GitHub Skills
                        + SUPPORT & SERVICES
                            o Documentation
                            o Customer support
                            o Community forum
                            o Trust center
                            o Partners
                      View all resources
                * Open Source
                        + COMMUNITY
                            o GitHub Sponsors Fund open source developers
                        + PROGRAMS
                            o Security Lab
                            o Maintainer Community
                            o Accelerator
                            o GitHub Stars
                            o Archive Program
                        + REPOSITORIES
                            o Topics
                            o Trending
                            o Collections
                * Enterprise
                        + ENTERPRISE SOLUTIONS
                            o Enterprise platform AI-powered developer platform
                        + AVAILABLE ADD-ONS
                            o GitHub Advanced Security Enterprise-grade security features
                            o Copilot for Business Enterprise-grade AI features
                            o Premium Support Enterprise-grade 24/7 support
              * Pricing
                Type / to search
                Sign in
              Sign up Appearance settings
      You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert

              Uh oh!

              There was an error while loading. Please reload this page.

              WireGuard / wireguard-go Public
              * Notifications You must be signed in to change notification settings
              * Fork 1.6k
                * Star 4.3k
          * Code
          * Pull requests 31
          * Actions
          * Security and quality 0
          * Insights
          Additional navigation options
                  * Code
                  * Pull requests
                  * Actions
                  * Security and quality
                  * Insights
                                              master
                                          Branches Tags
                                            Go to file
                                        Code
                                          Open more actions menu

                                        Folders and files

                                          Name                     Name                       Last commit message    Last commit date
                                            Latest commit        
                                                                 
                                                History          
                                                                 
                                                1,018 Commits    
                                                  1,018 Commits  
                                                  conn                     conn                                                      
                                                  device                   device                                                    
                                                  ipc                      ipc                                                       
                                                  ratelimiter              ratelimiter                                               
                                                  replay                   replay                                                    
                                                  rwcancel                 rwcancel                                                  
                                                  tai64n                   tai64n                                                    
                                                  tests                    tests                                                     
                                                  tun                      tun                                                       
                                                  .gitignore               .gitignore                                                
                                                  LICENSE                  LICENSE                                                   
                                                  Makefile                 Makefile                                                  
                                                  README.md                README.md                                                 
                                                  format_test.go           format_test.go                                            
                                                  go.mod                   go.mod                                                    
                                                  go.sum                   go.sum                                                    
                                                  main.go                  main.go                                                   
                                                  main_windows.go          main_windows.go                                           
                                                  version.go               version.go                                                
                                            View all files       
                                          

                                              Repository files navigation

                                                * 
                                                * README
                                                * MIT license
                                                More items

                                                Go Implementation of WireGuard

                                              This is an implementation of WireGuard in Go.

                                                Usage

                                              Most Linux kernel WireGuard users are used to adding an interface with ip link add wg0 type wireguard. With wireguard-go, instead simply run:

                                                $ wireguard-go wg0

                                              This will create an interface and fork into the background. To remove the interface, use the usual ip link del wg0, or if your system does not support removing interfaces directly, you may instead remove the control socket via rm -f /var/run/wireguard/wg0.sock, which will result in wireguard-go shutting down.

                                              To run wireguard-go without forking to the background, pass -f or --foreground:

                                                $ wireguard-go -f wg0

                                              When an interface is running, you may use wg(8) to configure it, as well as the usual ip(8) and ifconfig(8) commands.

                                              To run with more logging you may set the environment variable LOG_LEVEL=debug.

                                                Platforms

                                                Linux

                                              This will run on Linux; however you should instead use the kernel module, which is faster and better integrated into the OS. See the installation page for instructions.

                                                macOS

                                              This runs on macOS using the utun driver. It does not yet support sticky sockets, and won't support fwmarks because of Darwin limitations. Since the utun driver cannot have arbitrary interface names, you must either use utun[0-9]+ for an explicit interface name or utun to have the kernel select one for you. If you choose utun as the interface name, and the environment variable WG_TUN_NAME_FILE is defined, then the actual name of the interface chosen by the kernel is written to the file specified by that variable.

                                                Windows

                                              This runs on Windows, but you should instead use it from the more fully featured Windows app, which uses this as a module.

                                                FreeBSD

                                              This will run on FreeBSD. It does not yet support sticky sockets. Fwmark is mapped to SO_USER_COOKIE.

                                                OpenBSD

                                              This will run on OpenBSD. It does not yet support sticky sockets. Fwmark is mapped to SO_RTABLE. Since the tun driver cannot have arbitrary interface names, you must either use tun[0-9]+ for an explicit interface name or tun to have the program select one for you. If you choose tun as the interface name, and the environment variable WG_TUN_NAME_FILE is defined, then the actual name of the interface chosen by the kernel is written to the file specified by that variable.

                                                Building

                                              This requires an installation of the latest version of Go.

                                                $ git clone https://git.zx2c4.com/wireguard-go $ cd wireguard-go $ make

                                                License

                                                Copyright (C) 2017-2025 WireGuard LLC. All Rights Reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                                        About

                                        Mirror only. Official repository is at https://git.zx2c4.com/wireguard-go

                                        Resources

                                          Readme
                                          MIT license
                                          Activity
                                          Custom properties

                                        Stars

                                          4.3k stars

                                        Watchers

                                          66 watching

                                        Forks

                                          1.6k forks
                                          Report repository

                                        Releases

                                        Packages

                                        Used by

                                        Contributors

                                        Languages

    Footer

        © 2026 GitHub, Inc.

      Footer navigation

        * Terms
        * Privacy
        * Security
        * Status
        * Community
        * Docs
        * Contact
        * Manage cookies
        * Do not share my personal information
      You can’t perform that action at this time.