wgezpeer is a Go-based utility for generating WireGuard peer configurations. It takes a CIDR and an endpoint as input arguments and outputs the server and client configuration files needed to establish a WireGuard VPN connection.
- Generates WireGuard server and client configuration files.
- Automatically increments IP addresses within the given CIDR.
- Randomly selects a listening port for the client.
- Uses the WireGuard Go library for key generation and configuration.
- Go 1.22.4 or later
- WireGuard Go library
-
Clone the repository:
git clone https://github.com/alirezasn3/wgezpeer.git cd wgezpeer -
Install dependencies:
go mod tidy
To generate WireGuard configurations, run the following command:
go run main.go <CIDR> <Endpoint>Example:
go run main.go 10.0.0.1/24 12.23.34.45This will output the server and client configuration files.
The main entry point of the application. It handles the following:
- Parsing command-line arguments.
- Validating the CIDR.
- Generating server and client IP addresses.
- Creating WireGuard configurations.
- Printing the configurations to the console.
Contains the IPAddress struct and methods for:
- Parsing an IP address from a string.
- Incrementing the IP address.
- Converting the IP address to a string.
Defines the module and its dependencies.
Contains checksums for module dependencies.
golang.zx2c4.com/wireguard/wgctrlgithub.com/google/go-cmpgithub.com/josharian/nativegithub.com/mdlayher/genetlinkgithub.com/mdlayher/netlinkgithub.com/mdlayher/socketgolang.org/x/cryptogolang.org/x/netgolang.org/x/syncgolang.org/x/sys
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any changes.
For any questions or issues, please open an issue on the GitHub repository.
This README provides a comprehensive overview of the wgezpeer project, including its purpose, usage, and structure. Feel free to modify it to better suit your needs.