{"id":25911382,"url":"https://github.com/copyleftdev/slurp","last_synced_at":"2025-03-03T09:17:23.199Z","repository":{"id":271822262,"uuid":"914670810","full_name":"copyleftdev/slurp","owner":"copyleftdev","description":"A token-bucket-based SIP load-testing tool written in Go. This project provides a CLI for generating SIP-like traffic at a controlled rate and concurrency level, optionally simulating SIP calls and registration sequences.","archived":false,"fork":false,"pushed_at":"2025-01-10T04:37:47.000Z","size":3846,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T05:29:08.866Z","etag":null,"topics":["load-testing","sip","telecommunications"],"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/copyleftdev.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-01-10T04:14:12.000Z","updated_at":"2025-01-10T04:38:54.000Z","dependencies_parsed_at":"2025-01-10T05:39:43.753Z","dependency_job_id":null,"html_url":"https://github.com/copyleftdev/slurp","commit_stats":null,"previous_names":["copyleftdev/sipload"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fslurp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fslurp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fslurp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/copyleftdev%2Fslurp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/copyleftdev","download_url":"https://codeload.github.com/copyleftdev/slurp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241637277,"owners_count":19994946,"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":["load-testing","sip","telecommunications"],"created_at":"2025-03-03T09:17:22.657Z","updated_at":"2025-03-03T09:17:23.178Z","avatar_url":"https://github.com/copyleftdev.png","language":"Go","readme":"# Slurp\n\n![Slurp Diagram](sipload.png)\n\nA token-bucket-based SIP load-testing tool written in Go.  \nThis project provides a CLI for generating SIP-like traffic at a controlled rate and concurrency level, optionally simulating SIP calls and registration sequences.\n\n---\n\n## Features\n\n- **Token Bucket Rate Limiting**  \n  Control calls-per-second (CPS) to throttle the load on your SIP infrastructure.\n\n- **Concurrency Management**  \n  Limit the number of simultaneous calls (sessions) to emulate real-world usage.\n\n- **Mock SIP Logic**  \n  Sends mock SIP calls (simulated) with randomized outcomes (for demonstration). Integrate a real SIP library to test production scenarios.\n\n- **Optional SIP REGISTER**  \n  Send a SIP REGISTER message before placing calls if your environment requires registration/authentication.\n\n- **YAML Configuration**  \n  Use the central file `configs/config.yaml` for defaults, and override with CLI flags or environment variables.\n\n- **Zap Logging**  \n  Structured logging with various log levels (info, error, debug, etc.).\n\n- **Metrics Collection**  \n  Basic stats on total calls, failures, and elapsed time, displayed at the end of each test.\n\n- **Extensible**  \n  Designed with modular packages (`internal/load`, `internal/sip`, `internal/stats`, etc.) for easy customization.\n\n---\n\n## Table of Contents\n\n1. [Prerequisites](#prerequisites)  \n2. [Installation](#installation)  \n3. [Configuration](#configuration)  \n4. [Usage](#usage)  \n5. [Commands](#commands)  \n   - [test](#test-command)  \n   - [version](#version-command)  \n6. [Examples](#examples)  \n7. [Testing the Code](#testing-the-code)  \n8. [Roadmap](#roadmap)  \n9. [License](#license)  \n\n---\n\n## Prerequisites\n\n- **Go 1.20+** (older versions may work, but 1.20 or newer is recommended)\n- **Git** (optional, if you need to clone the repo)\n\n## Installation\n\n1. **Clone the repository** (or download the source code):\n   ```bash\n   git clone https://github.com/yourusername/Slurp.git\n   cd Slurp\n   ```\n\n2. **Install dependencies**:\n   ```bash\n   go mod tidy\n   ```\n\n3. **Build the binary**:\n   ```bash\n   go build -o Slurp .\n   ```\n   This produces an executable named **`Slurp`**.\n\n---\n\n## Configuration\n\n- The default configuration file is located at `./configs/config.yaml`.  \n- Example contents:\n  ```yaml\n  # configs/config.yaml\n\n  target_uri: \"sip:echo@sip.testserver.com\"\n  calls_per_second: 5\n  concurrency: 2\n  duration: 10\n  local_contact: \"sip:mytestclient@127.0.0.1:5060\"\n  register_first: false\n  ```\n- **Environment Variables**:  \n  You can override settings by using environment variables with the prefix `Slurp_`. For example:\n  ```bash\n  export Slurp_TARGET_URI=\"sip:echo@other.testserver.com\"\n  export Slurp_CALLS_PER_SECOND=20\n  ```\n- **CLI Flags**:  \n  Values from the config file can be overridden by flags like `--target`, `--calls-per-second`, etc.\n\n---\n\n## Usage\n\nAfter building, you can run the CLI via:\n\n```bash\n./Slurp [command] [flags...]\n```\n\n---\n\n## Commands\n\n### Test Command\n\n```bash\n./Slurp test [flags...]\n```\n\n- **Description**: Run a SIP load test with token-bucket rate limiting and optional registration.  \n- **Flags**:  \n  - `--target \u003curi\u003e`: SIP target URI (overrides `target_uri` in config)  \n  - `--calls-per-second \u003cn\u003e`: Desired call generation rate (CPS)  \n  - `--concurrency \u003cn\u003e`: Max number of simultaneous calls  \n  - `--duration \u003ctime\u003e`: Test duration (e.g., `10s`, `30s`, or `0` for infinite until Ctrl+C)  \n  - `--contact \u003curi\u003e`: Local SIP contact  \n  - `--register-first`: If set, send a mock REGISTER first  \n\n### Version Command\n\n```bash\n./Slurp version\n```\n\n- **Description**: Shows the current version of **Slurp**.\n\n---\n\n## Examples\n\n1. **Use defaults from config.yaml**:\n   ```bash\n   ./Slurp test\n   ```\n2. **Override with flags**:\n   ```bash\n   ./Slurp test \\\n     --target \"sip:echo@otherserver.com\" \\\n     --calls-per-second 10 \\\n     --concurrency 5 \\\n     --duration 15s \\\n     --register-first\n   ```\n3. **Check version**:\n   ```bash\n   ./Slurp version\n   ```\n\n---\n\n## Testing the Code\n\n- **Unit tests** live in `_test.go` files under each package (for example, `internal/rng/rng_test.go`).  \n- Run them with:\n  ```bash\n  go test ./...\n  ```\n- The tests include basic coverage for rate limiting, concurrency, stats collection, and mock SIP calls.  \n- Note: The mock SIP logic might fail randomly. In a real environment, you’d integrate a true SIP library or mock out the random failure for deterministic tests.\n\n---\n\n## Roadmap\n\n- **Integration with Real SIP Library**: Replace the mock calls in `internal/sip` with an actual SIP stack.  \n- **Distributed/Clustered Testing**: Scale across multiple machines or containers.  \n- **Prometheus Metrics**: Export real-time metrics for visualizations (e.g., Grafana).  \n- **Scenario Scripting**: Support advanced call flows beyond a basic `INVITE` or `REGISTER`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopyleftdev%2Fslurp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcopyleftdev%2Fslurp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcopyleftdev%2Fslurp/lists"}