https://github.com/hatamiarash7/wireguard-config-generator
Generate WireGuard tunnel configs
https://github.com/hatamiarash7/wireguard-config-generator
generator wireguard wireguard-tunnel
Last synced: 3 months ago
JSON representation
Generate WireGuard tunnel configs
- Host: GitHub
- URL: https://github.com/hatamiarash7/wireguard-config-generator
- Owner: hatamiarash7
- Created: 2022-09-25T09:00:43.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-17T16:45:18.000Z (about 2 years ago)
- Last Synced: 2025-04-18T10:23:15.916Z (3 months ago)
- Topics: generator, wireguard, wireguard-tunnel
- Language: Python
- Homepage:
- Size: 56.6 KB
- Stars: 16
- Watchers: 2
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# WireGuard config generator
[](https://www.python.org/) [](https://GitHub.com/hatamiarash7/WireGuard-Config-Generator/releases/) [](https://github.com/hatamiarash7/WireGuard-Config-Generator/actions/workflows/pylint.yml) [](https://github.com/hatamiarash7/WireGuard-Config-Generator/actions/workflows/codeql-analysis.yml)
This simple script will generate tunnel config files for WireGuard.
## How to use
You need to give two file contains your information:
- `endpoints.toml` : Contains the endpoints you want to connect to ( Name, Address ).
- `ip-list.toml` : Contains the IP addresses you want to use.And also give private/other information as a `.env` file.
### endpoints.toml
```toml
Company-Server-1 = "wg-1.domain.xyz:1234"
Company-Server-2 = "wg-2.domain.xyz:1234"
```### ip-list.toml
```toml
[k8s]
DC1 = "1.2.3.4/32"
DC2 = "5.6.7.8.9/32"
DC3 = "1.2.3.4/27"[monitoring]
prometheus = "1.2.3.4/32"
grafana = "5.6.7.8.9/32"[other]
server1 = "1.2.3.4/32"
server2 = "5.6.7.8.9/32"
server3 = "1.2.3.4/27"
```### .env
```env
PRIVATE_KEY=
PUBLIC_KEY=
ADDRESS=
MTU=
PERSISTENT_KEEPALIVE=
```> **Note**: If you need extra data than the above, you should add your variables in `main.py` too.
## Run
To generate config files for all endpoints, run:
```bash
make run
```This script will create file(s) based on the given endpoints. In this example, it will create `Company-Server-1.conf` and `Company-Server-2.conf` files like this:
```ini
[Interface]
PrivateKey =
Address =
MTU =[Peer]
PublicKey =
Endpoint = wg-1.domain.xyz:1234
AllowedIPs = 1.2.3.4/32, 5.6.7.8/32, ...
PersistentKeepalive =
```Now, you can import all generated configs in WireGuard.
---
## Support 💛
[](https://en.cryptobadges.io/donate/bc1qmmh6vt366yzjt3grjxjjqynrrxs3frun8gnxrz) [](https://en.cryptobadges.io/donate/0x0831bD72Ea8904B38Be9D6185Da2f930d6078094)
[](https://ko-fi.com/D1D1WGU9)
## Contributing 🤝
Don't be shy and reach out to us if you want to contribute 😉
1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request## Issues
Each project may have many problems. Contributing to the better development of this project by reporting them. 👍