{"id":13893332,"url":"https://github.com/dilllxd/dynamicserverapi","last_synced_at":"2026-01-14T15:50:30.983Z","repository":{"id":251129223,"uuid":"836480328","full_name":"dilllxd/dynamicserverapi","owner":"dilllxd","description":"DynamicServerAPI is a plugin for the Gate proxy that allows you to dynamically add and remove servers from your proxy!","archived":false,"fork":false,"pushed_at":"2024-11-11T22:56:08.000Z","size":35,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-24T21:33:53.967Z","etag":null,"topics":["gate-extension"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dilllxd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-08-01T00:11:43.000Z","updated_at":"2024-11-14T01:20:52.000Z","dependencies_parsed_at":"2024-11-11T23:26:11.485Z","dependency_job_id":"79dbc974-9282-4b63-8031-faf0a7918958","html_url":"https://github.com/dilllxd/dynamicserverapi","commit_stats":null,"previous_names":["dilllxd/dynamicserverapi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dilllxd/dynamicserverapi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilllxd%2Fdynamicserverapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilllxd%2Fdynamicserverapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilllxd%2Fdynamicserverapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilllxd%2Fdynamicserverapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dilllxd","download_url":"https://codeload.github.com/dilllxd/dynamicserverapi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dilllxd%2Fdynamicserverapi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28425203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["gate-extension"],"created_at":"2024-08-06T18:00:36.826Z","updated_at":"2026-01-14T15:50:30.961Z","avatar_url":"https://github.com/dilllxd.png","language":"Go","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"# DynamicServerAPI for Gate\n\n**DynamicServerAPI** is a plugin for the [Gate](https://gate.minekube.com/) proxy that allows you to dynamically add and remove servers from your proxy!\n\n## Getting Started\n\n### 1. Add the Package\n\nAdd the `dynamicserverapi` package to your Gate project:\n\n```bash\ngo get github.com/dilllxd/dynamicserverapi\n```\n\n### 2. Register the Plugin\n\nInclude the plugin in your `main()` function:\n\n```go\nfunc main() {\n    proxy.Plugins = append(proxy.Plugins,\n        // your plugins\n        dynamicserverapi.Plugin,\n    )\n    gate.Execute()\n}\n```\n\n### 3. Configure the Plugin\n\nAfter starting your server, a new file named `servers.json` will be created. This will include a Authorization token that is randomly generated that you can use to add servers using the REST API. You can also choose to add servers manually using this file format:\n\n```json\n{\n  \"auth_token\": \"your_generated_token\",\n  \"api_port\": 8080,\n  \"api_interface\": \"0.0.0.0\",\n  \"servers\": [\n    {\"name\":\"exampleserver1\",\"address\":\"127.0.0.1:25566\",\"fallback\": true},\n    {\"name\":\"exampleserver2\",\"address\":\"127.0.0.1:25567\",\"fallback\": false}\n  ]\n}\n```\n\n## API Documentation\n\nThe plugin exposes a REST API to manage servers dynamically.\n\n### 1. Add a Server\n\n**Endpoint:** `/addserver`  \n**Method:** `POST`  \n**Description:** Adds a new server to the proxy.\n\n**Request Headers:**\n```\nAuthorization: your_generated_token\n```\n\n**Request Body:**\n```json\n{\n    \"name\": \"serverName\",\n    \"address\": \"serverAddress\",\n    \"fallback\": true\n}\n```\n\n**Example Request:**\n```bash\ncurl -X POST http://localhost:8080/addserver \\\n  -H \"Authorization: your_generated_token\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"name\": \"NewServer\",\n    \"address\": \"127.0.0.1:25565\",\n    \"fallback\": true\n  }'\n\n```\n\n### 2. Remove a Server\n\n**Endpoint:** `/removeserver`  \n**Method:** `POST`  \n**Description:** Removes a server from the proxy. Servers added by the admin (before the plugin initializes) cannot be removed.\n\n**Request Headers:**\n```\nAuthorization: your_generated_token\n```\n\n**Request Body:**\n```json\n{\n    \"name\": \"serverName\"\n}\n```\n\n**Example Request:**\n```bash\ncurl -X POST http://localhost:8080/removeserver \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Authorization: your_generated_token\" \\\n  -d '{\"name\": \"NewServer\"}'\n```\n\n### 3. List Servers\n\n**Endpoint:** `/listservers`  \n**Method:** `GET`  \n**Description:** Lists all servers currently registered with the proxy.\n\n**Request Headers:**\n```\nAuthorization: your_generated_token\n```\n\n**Example Request:**\n```bash\ncurl -X GET http://localhost:8080/listservers \\\n  -H \"Authorization: your_generated_token\"\n```\n\n**Response:**\n```json\n[\n    {\"name\":\"server1\",\"address\":\"localhost:25566\",\"fallback\": true},\n    {\"name\":\"server2\",\"address\":\"localhost:25567\",\"fallback\": false},\n    {\"name\":\"NewServer\",\"address\":\"127.0.0.1:25565\",\"fallback\": true}\n]\n```\n\n## Notes\n\n- **Admin-Added Servers:** Servers that were added to the proxy before the plugin initializes are marked as admin-added. These servers cannot be removed using the REST API to ensure they remain in the proxy unless explicitly managed by the admin.\n- **Authorization Token:** Ensure you keep your `auth_token` secure and update the `servers.json` file if you need to change it.\n- **Server Persistence:** When a server is added through the REST API, it is saved to the `servers.json` file. Upon each server restart, the plugin reads the `servers.json` file and registers all non-admin servers listed. Admin-added servers (those present before the plugin initializes) are preserved but not modified by the plugin.\n- **REST API:** REST API port and address are fully configurable now as of v1.0.0.\n---\n\n## Version History\n\n### v1.0.0 - Initial Release (August 2nd, 2024)\n- Initial release of the DynamicServerAPI plugin.\n- Full functionality to add, remove, and list servers via a REST API.\n\n### v1.0.1 - Minor Release (November 11th, 2024)\n- Added logging to token generation for easier retrieval when a token is generated.\n---\n\nFeel free to reach out if you have any questions or need further assistance with setting up the DynamicServerAPI plugin for Gate.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilllxd%2Fdynamicserverapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdilllxd%2Fdynamicserverapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdilllxd%2Fdynamicserverapi/lists"}