{"id":21546468,"url":"https://github.com/frkn-dev/wgctrl","last_synced_at":"2025-10-07T00:34:05.134Z","repository":{"id":104176325,"uuid":"581264081","full_name":"frkn-dev/wgctrl","owner":"frkn-dev","description":"Control for WireGuard cluster","archived":false,"fork":false,"pushed_at":"2024-01-11T19:29:36.000Z","size":186,"stargazers_count":19,"open_issues_count":6,"forks_count":4,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-06-30T20:42:57.179Z","etag":null,"topics":["api","clojure","fuckrkn-vpn","vpn","wireguard","wireguard-api"],"latest_commit_sha":null,"homepage":"","language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frkn-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-22T17:53:04.000Z","updated_at":"2024-06-09T17:19:23.000Z","dependencies_parsed_at":"2024-01-11T23:52:10.827Z","dependency_job_id":"8b2a811b-f040-4a6a-8110-b299eb47c6ce","html_url":"https://github.com/frkn-dev/wgctrl","commit_stats":null,"previous_names":["frkn-dev/wgctrl","nezavisimost/wgctrl"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frkn-dev/wgctrl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frkn-dev%2Fwgctrl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frkn-dev%2Fwgctrl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frkn-dev%2Fwgctrl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frkn-dev%2Fwgctrl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frkn-dev","download_url":"https://codeload.github.com/frkn-dev/wgctrl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frkn-dev%2Fwgctrl/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266152254,"owners_count":23884474,"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":["api","clojure","fuckrkn-vpn","vpn","wireguard","wireguard-api"],"created_at":"2024-11-24T06:12:14.872Z","updated_at":"2025-10-07T00:34:00.091Z","avatar_url":"https://github.com/frkn-dev.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WGCTRL: WireGuard API Service\n\nThe Service provides an API for controlling **WireGuard** servers.\nIt allows you to manage WireGuard nodes and automatically\nbalance peers by nodes according locations and load.\n\n## Prerequisites\n\nBefore you can use the Wireguard API service, you will need to have the following installed on your system:\n\n- [Clojure](https://clojure.org/)\n- [Leiningen](https://leiningen.org/) \n- [Wireguard](https://www.wireguard.com/)\n\nThe Service API explores SSH to command WG Nodes\n\n## Installation\n\nTo install the Wireguard API service, clone the repository and install the dependencies:\n\n```bash\ngit clone https://github.com/nezavisimost/wgctrl.git\ncd wgctrl\nlein repl \n```\n\nThe service by default listening 8080 (HTTP API) and 7888 (nRepl) ports\n\n## Usage\n\nYou can then use the API by sending HTTP requests to the service. The API supports the following endpoints:\n\n    GET /peer?location=XX: Creates new peer\n    GET /locations: List of all locations \n    GET /stat: Statistic by node, amount of peers\n    \nFor example, to list all Wireguard Nodes locations, \nyou can send a GET request to `http://localhost:8080/locations`\n\n### Responses \n\nThe API has next responses:\n\n- ``/peer?location=XX``   \nThe response is a map for WG configuration \n```json \n{\n  \"interface\": {\n    \"address\": \"10.7.0.16/24\",\n    \"key\": \"wCAndMWDHZpOT138xxxxxx8BBLqoXhqj649+WitT5y7F8=\",\n    \"dns\": \"1.1.1.1, 1.0.0.1\"\n  },\n  \"peer\": {\n    \"pubkey\": \"DXn0oXV5/5fCtgKlxxxxxqKkECX/wibquJYX6/9wCASM=\",\n    \"psk\": \"BRjawrMPOwMzShGHxtfMj8g5rfcPzUzqLs1wpifmp+c=\",\n    \"allowed_ips\": \"0.0.0.0/0\",\n    \"endpoint\": \"94.176.X.Y:51820\"\n  }\n}\n```\n\n- ``/stat``\n\n```json\n{\n  \"uuid\": \"75aca2c7-50c9-400a-9001-a0951210fbf1\",\n  \"nodes\": [\n    {\n      \"node\": \"79d2843f-15b2-4484-8612-c570a8bdfe24\",\n      \"hostname\": \"dev1.vpn.dev\",\n      \"stat\": [\n        {\n          \"name\": \"wg0\",\n          \"peers\": 15\n        }\n      ]\n    }\n  ]\n}     \n```\n\n- ``/locations`` \n\n```json\n[\n    {\n      \"code\": \"dev\",\n      \"name\": \"🏴‍☠️ Development\"\n    }\n]\n\n```\n### Errors\n\nErrors looks loke JSON formatted message, http code is 200, but error code inside the JSON message.\nNote: \"message\" is the real error message from System. \n\n```json\n{\n  \"code\": 10,\n  \"err\": \"Can't create peer\",\n  \"message\": \"Node or Interface for test not found\"\n}\n```\n\n\n## Node prepare \n\nOn the wg-node you should have next packages installed and configured:\n\n- WireGuard \n- Babashka \n- SSH \n\nFirst prepare node: \n\n```bash \ncd wgctrl\nssh user@server 'bb'  \u003c scripts/node-register.bb\n```\n\nThe script will create ~/.wg-node edn-formatted file with system information about the node\n\nExample `~/.wg-node`: \n\n```bash\n{:uuid \"79d2843f-15b2-4484-8612-c570a8bdfe24\", :hostname \"dev1.vpn.dev\", :default-interface \"ens3\", :interfaces [{:name \"wg0\", :subnet {:inet \"10.7.0.1/24,\", :inet6 \"fddd:2c4:2c4:2c4::1/64\"}, :port \"51820\", :public-key \"DXn0oXV5/5fCtgKlf9VjqKkECX/wibquJYX6/9wCASM=\", :endpoint {:inet \"94.176.X.Y\", :inet6 \"2a02:7b40:5eb0:eedc::1\"}}]}\n```\n\n# Contributing\n\nWe welcome contributions to the Wireguard API service! If you have an idea for a new feature or have found a bug, please open an [**Issue**](https://github.com/nezavisimost/wgctrl/issues) or a [**Pull Request**](https://github.com/nezavisimost/wgctrl/pulls) on the [**GitHub repository**](https://github.com/nezavisimost/wgctrl).\n\n# License\n\nThe **WireGuard API** service is licensed under the GPL-V3 License.\n\n# Acknowledgements\n- [**2pizza**](https://github.com/the2pizza)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrkn-dev%2Fwgctrl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrkn-dev%2Fwgctrl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrkn-dev%2Fwgctrl/lists"}