{"id":26678272,"url":"https://github.com/telexintegrations/network_health_path","last_synced_at":"2025-03-26T05:15:20.860Z","repository":{"id":278973260,"uuid":"937317584","full_name":"telexintegrations/Network_Health_Path","owner":"telexintegrations","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-22T21:46:45.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-22T22:25:39.232Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://network-health-path.vercel.app","language":"Python","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/telexintegrations.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":"2025-02-22T21:03:30.000Z","updated_at":"2025-02-22T21:47:49.000Z","dependencies_parsed_at":"2025-02-22T22:25:56.431Z","dependency_job_id":"5d6b7dab-0b69-4ef5-8620-508af63b1caf","html_url":"https://github.com/telexintegrations/Network_Health_Path","commit_stats":null,"previous_names":["telexintegrations/network_health_path"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FNetwork_Health_Path","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FNetwork_Health_Path/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FNetwork_Health_Path/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/telexintegrations%2FNetwork_Health_Path/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/telexintegrations","download_url":"https://codeload.github.com/telexintegrations/Network_Health_Path/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245591533,"owners_count":20640692,"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":[],"created_at":"2025-03-26T05:15:20.016Z","updated_at":"2025-03-26T05:15:20.851Z","avatar_url":"https://github.com/telexintegrations.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Network Path Health API\r\n\r\n## Overview\r\nThis API performs network diagnostics by checking for packet loss along the route to a target URL using `pathping` (Windows) or `mtr` (Linux/macOS). The results are then sent to a specified return URL for further processing.\r\n\r\n## Features\r\n- Runs network diagnostics in the background\r\n- Supports both Windows (`pathping`) and Linux/macOS (`mtr`)\r\n- Detects packet loss at different hops along the network route\r\n- Sends results to a webhook (return URL)\r\n- Uses FastAPI for API routing\r\n\r\n## Installation\r\n\r\n### Prerequisites\r\nEnsure you have the following installed:\r\n- Python 3.8+\r\n- FastAPI\r\n- httpx\r\n\r\n### Steps\r\n1. Clone the repository:\r\n   ```sh\r\n   git clone \u003crepo-url\u003e\r\n   cd \u003crepo-folder\u003e\r\n   ```\r\n2. Install dependencies:\r\n   ```sh\r\n   pip install -r requirements.txt\r\n   ```\r\n3. Run the FastAPI server:\r\n   ```sh\r\n   uvicorn main:app --host 0.0.0.0 --port 8000\r\n   ```\r\n\r\n## API Endpoints\r\n\r\n### 1. Check Network Health\r\n**Endpoint:**\r\n```\r\nPOST /network-health\r\n```\r\n\r\n**Payload:**\r\n```json\r\n{\r\n  \"channel_id\": \"12345\",\r\n  \"return_url\": \"https://yourwebhook.com/receive\",\r\n  \"settings\": [\r\n    { \"label\": \"target_url\", \"type\": \"string\", \"required\": true, \"default\": \"www.example.com\" }\r\n  ]\r\n}\r\n```\r\n\r\n**Response:**\r\n```json\r\n{\r\n  \"status\": \"accepted\"\r\n}\r\n```\r\n\r\n## How It Works\r\n1. The API receives a request with a target URL.\r\n2. It runs `pathping` (Windows) or `mtr` (Linux/macOS) to diagnose packet loss.\r\n3. The function parses the output to detect packet loss per hop.\r\n4. The results are sent to the provided `return_url` as a webhook.\r\n\r\n## Example Output\r\n- **No Packet Loss:**\r\n  ```\r\n  No packet loss detected to www.example.com.\r\n  ```\r\n- **With Packet Loss:**\r\n  ```\r\n  ⚠️ 20% packet loss detected at 192.168.1.1 while reaching www.example.com.\r\n  ```\r\n\r\n## Adding an Image\r\n![WhatsApp Image 2025-02-22 at 22 14 58_327ce2b7](https://github.com/user-attachments/assets/e56fe7c2-7b4b-4a29-9de9-48d7d0c8babb)\r\n\r\n\r\n## License\r\nThis project is licensed under the MIT License.\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fnetwork_health_path","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftelexintegrations%2Fnetwork_health_path","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftelexintegrations%2Fnetwork_health_path/lists"}