{"id":31543724,"url":"https://github.com/reddec/wg-hub","last_synced_at":"2026-05-18T04:34:32.184Z","repository":{"id":317060884,"uuid":"1065837110","full_name":"reddec/wg-hub","owner":"reddec","description":"No-brainer, dumb simple HTTP(S) REST API for WireGuard.","archived":false,"fork":false,"pushed_at":"2025-09-28T14:29:25.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-28T16:29:15.959Z","etag":null,"topics":["rest-api","wireguard","wireguard-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reddec.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-28T14:26:36.000Z","updated_at":"2025-09-28T16:07:46.000Z","dependencies_parsed_at":"2025-09-28T16:29:18.317Z","dependency_job_id":"464eea19-53aa-4c53-8944-42b051c26bae","html_url":"https://github.com/reddec/wg-hub","commit_stats":null,"previous_names":["reddec/wg-hub"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/reddec/wg-hub","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fwg-hub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fwg-hub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fwg-hub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fwg-hub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reddec","download_url":"https://codeload.github.com/reddec/wg-hub/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reddec%2Fwg-hub/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278315190,"owners_count":25966774,"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","status":"online","status_checked_at":"2025-10-04T02:00:05.491Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["rest-api","wireguard","wireguard-api"],"created_at":"2025-10-04T12:42:07.642Z","updated_at":"2025-10-04T12:42:13.914Z","avatar_url":"https://github.com/reddec.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# wg-hub\n\nNo-brainer, dumb simple HTTP(S) REST API for WireGuard.\n\n- 0 (zero) external code dependencies\n- requires `wg` tools and (unless `ephemeral` enable) `wg-quick`\n- Focuses on linux\n- Single binary\n- TLS (optional) and access key (optional) protection\n\n\u003e Note: currently it doesn't create a new WireGuard interface if it doesn't exist.\n\n## Requirements\n\n- Linux system with WireGuard support\n- `wg` command-line tools installed\n- `wg-quick` (unless running in ephemeral mode)\n- Go 1.21+ (for building from source)\n\n## Installation\n\n### From Releases\n\n- Download the latest release from [Releases](https://github.com/reddec/trusted-cgi/releases/latest)\n- Unpack the archive\n- Move the binary to your `$PATH`\n\n### From Source\n\n```bash\ngit clone \u003crepository-url\u003e\ncd wg-hub\ngo build -o wg-hub main.go\n```\n\n### Running\n\nMake sure your WireGuard interface is up and configured:\n\n```bash\n# Create and configure your WireGuard interface\nsudo wg-quick up wg0\n\n# Run wg-hub\nsudo ./wg-hub -interface wg0\n```\n\n**Note:** Root privileges are typically required to modify WireGuard configurations.\n\n## Usage\n\nSupports command flags and environment variables.\n\n```bash\nwg-hub [options]\n```\n\n### Command-line flags:\n\n- `-bind` - Binding address (default: `:8080`) `[$WG_HUB_HTTP_BIND]`\n- `-access-token` - Protect HTTP requests with Authorization header `[$WG_HUB_TTP_ACCESS_TOKEN]`\n- `-interface` - WireGuard interface name (default: `wg0`) `[$WG_HUB_INTERFACE]`\n- `-tls-enabled` - Enable HTTPS (default: `false`) `[$WG_HUB_TLS_ENABLED]`\n- `-tls-cert` - TLS certificate file path `[$WG_HUB_TLS_CERT]`\n- `-tls-key` - TLS private key file path `[$WG_HUB_TLS_KEY]`\n- `-ephemeral` - Do not save config on changes, eliminates wg-quick dependency (default: `false`) `[$WG_HUB_EPHEMERAL]`\n\n### Examples:\n\n```bash\n# Basic usage\nwg-hub\n\n# With custom port and interface\nwg-hub -bind :9090 -interface wg1\n\n# With TLS enabled\nwg-hub -tls-enabled -tls-cert /path/to/cert.pem -tls-key /path/to/key.pem\n\n# With access token protection\nwg-hub -access-token \"your-secret-token\"\n\n# Ephemeral mode (no config persistence)\nwg-hub -ephemeral\n\n# Using environment variables\nWG_HUB_HTTP_BIND=:9090 WG_HUB_INTERFACE=wg1 wg-hub\n```\n\n## API\n\nIt's literally just few endpoints.\n\n### Endpoints\n\n#### `GET /`\n\nGet current WireGuard network information including all peers.\n\n**Response:**\n\n```json\n{\n  \"interface\": \"wg0\",\n  \"listen_port\": 51831,\n  \"public_key\": \"base64-encoded-public-key\",\n  \"fw_mark\": \"off\",\n  \"peers\": [\n    {\n      \"public_key\": \"base64-encoded-public-key\",\n      \"endpoint\": \"ip:port\",\n      \"allowed_ips\": [\n        \"10.0.0.2/32\"\n      ],\n      \"latest_handshake\": \"2023-01-01T12:00:00Z\",\n      \"transfer_rx\": 1024,\n      \"transfer_tx\": 2048\n    }\n  ]\n}\n```\n\n#### `POST /peers`\n\nCreate a new WireGuard peer.\n\n**Request body:**\n\n```json\n{\n  \"allowed_ips\": [\n    \"10.0.0.2/32\"\n  ],\n  \"endpoint\": \"192.168.1.100:51820\",\n  \"keepalive\": 25,\n  \"keys\": {\n    \"private_key\": \"base64-encoded-private-key\",\n    \"public_key\": \"base64-encoded-public-key\"\n  }\n}\n```\n\n**Required fields:**\n\n- `allowed_ips` - Array of CIDR blocks this peer is allowed to use\n\n**Optional fields:**\n\n- `endpoint` - Peer's endpoint address\n- `keepalive` - Keep-alive interval in seconds\n- `keys` - Key pair (if not provided, will be auto-generated)\n\n**Response:**\nReturns the created peer configuration including generated keys (if any).\n\n#### `POST /peers/{peer}`\n\nUpdate an existing peer configuration.\n\n**URL Parameters:**\n\n- `peer` - Base64-encoded public key of the peer\n\n**Request body:**\n\n```json\n{\n  \"allowed_ips\": [\n    \"10.0.0.2/32\"\n  ],\n  \"endpoint\": \"192.168.1.100:51820\",\n  \"keepalive\": 25\n}\n```\n\n**Response:** `204 No Content`\n\n#### `DELETE /peers/{peer}`\n\nRemove a peer from the WireGuard configuration.\n\n**URL Parameters:**\n\n- `peer` - Base64-encoded public key of the peer\n\n**Response:** `204 No Content`\n\n### Authentication\n\nIf an access token is configured, include it in the `Authorization` header:\n\n```\nAuthorization: your-access-token\n```\n\n### Example Usage\n\n```bash\n# Get network info\ncurl http://localhost:8080/\n\n# Create a new peer\ncurl -X POST http://localhost:8080/peers \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"allowed_ips\": [\"10.0.0.2/32\"]}'\n\n# Update a peer\ncurl -X POST http://localhost:8080/peers/C8F+FKk3hgR0z0lWOjbPcJ9skNNmEqjukAOqekiHmkM= \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"allowed_ips\": [\"10.0.0.2/32\"], \"endpoint\": \"192.168.1.100:51820\"}'\n\n# Delete a peer\ncurl -X DELETE http://localhost:8080/peers/C8F+FKk3hgR0z0lWOjbPcJ9skNNmEqjukAOqekiHmkM=\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddec%2Fwg-hub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freddec%2Fwg-hub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freddec%2Fwg-hub/lists"}