https://github.com/copyleftdev/slurp

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.

https://github.com/copyleftdev/slurp

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.3%) to scientific vocabulary

Keywords

load-testing sip telecommunications
Last synced: 5 months ago · JSON representation

Repository

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.

Basic Info
  • Host: GitHub
  • Owner: copyleftdev
  • Language: Go
  • Default Branch: main
  • Homepage:
  • Size: 3.67 MB
Statistics
  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
load-testing sip telecommunications
Created about 1 year ago · Last pushed about 1 year ago
Metadata Files
Readme

readme.md

Slurp

Slurp Diagram

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.


Features

  • Token Bucket Rate Limiting
    Control calls-per-second (CPS) to throttle the load on your SIP infrastructure.

  • Concurrency Management
    Limit the number of simultaneous calls (sessions) to emulate real-world usage.

  • Mock SIP Logic
    Sends mock SIP calls (simulated) with randomized outcomes (for demonstration). Integrate a real SIP library to test production scenarios.

  • Optional SIP REGISTER
    Send a SIP REGISTER message before placing calls if your environment requires registration/authentication.

  • YAML Configuration
    Use the central file configs/config.yaml for defaults, and override with CLI flags or environment variables.

  • Zap Logging
    Structured logging with various log levels (info, error, debug, etc.).

  • Metrics Collection
    Basic stats on total calls, failures, and elapsed time, displayed at the end of each test.

  • Extensible
    Designed with modular packages (internal/load, internal/sip, internal/stats, etc.) for easy customization.


Table of Contents

  1. Prerequisites
  2. Installation
  3. Configuration
  4. Usage
  5. Commands
  6. Examples
  7. Testing the Code
  8. Roadmap
  9. License

Prerequisites

  • Go 1.20+ (older versions may work, but 1.20 or newer is recommended)
  • Git (optional, if you need to clone the repo)

Installation

  1. Clone the repository (or download the source code): bash git clone https://github.com/yourusername/Slurp.git cd Slurp

  2. Install dependencies: bash go mod tidy

  3. Build the binary: bash go build -o Slurp . This produces an executable named Slurp.


Configuration

  • The default configuration file is located at ./configs/config.yaml.
  • Example contents: ```yaml # configs/config.yaml

targeturi: "sip:echo@sip.testserver.com" callspersecond: 5 concurrency: 2 duration: 10 localcontact: "sip:mytestclient@127.0.0.1:5060" registerfirst: false `` - **Environment Variables**: You can override settings by using environment variables with the prefixSlurp. For example: bash export Slurp_TARGET_URI="sip:echo@other.testserver.com" export Slurp_CALLS_PER_SECOND=20 - **CLI Flags**: Values from the config file can be overridden by flags like--target,--calls-per-second`, etc.


Usage

After building, you can run the CLI via:

bash ./Slurp [command] [flags...]


Commands

Test Command

bash ./Slurp test [flags...]

  • Description: Run a SIP load test with token-bucket rate limiting and optional registration.
  • Flags:
    • --target <uri>: SIP target URI (overrides target_uri in config)
    • --calls-per-second <n>: Desired call generation rate (CPS)
    • --concurrency <n>: Max number of simultaneous calls
    • --duration <time>: Test duration (e.g., 10s, 30s, or 0 for infinite until Ctrl+C)
    • --contact <uri>: Local SIP contact
    • --register-first: If set, send a mock REGISTER first

Version Command

bash ./Slurp version

  • Description: Shows the current version of Slurp.

Examples

  1. Use defaults from config.yaml: bash ./Slurp test
  2. Override with flags: bash ./Slurp test \ --target "sip:echo@otherserver.com" \ --calls-per-second 10 \ --concurrency 5 \ --duration 15s \ --register-first
  3. Check version: bash ./Slurp version

Testing the Code

  • Unit tests live in _test.go files under each package (for example, internal/rng/rng_test.go).
  • Run them with: bash go test ./...
  • The tests include basic coverage for rate limiting, concurrency, stats collection, and mock SIP calls.
  • 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.

Roadmap

  • Integration with Real SIP Library: Replace the mock calls in internal/sip with an actual SIP stack.
  • Distributed/Clustered Testing: Scale across multiple machines or containers.
  • Prometheus Metrics: Export real-time metrics for visualizations (e.g., Grafana).
  • Scenario Scripting: Support advanced call flows beyond a basic INVITE or REGISTER.

Owner

  • Name: Donald Johnson
  • Login: copyleftdev
  • Kind: user
  • Location: Los Angeles

GitHub Events

Total
  • Public event: 1
Last Year
  • Public event: 1

Issues and Pull Requests

Last synced: 12 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

go.mod go
  • github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
  • github.com/fsnotify/fsnotify v1.7.0
  • github.com/hashicorp/hcl v1.0.0
  • github.com/inconshreveable/mousetrap v1.1.0
  • github.com/magiconair/properties v1.8.7
  • github.com/mitchellh/mapstructure v1.5.0
  • github.com/pelletier/go-toml/v2 v2.2.2
  • github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
  • github.com/sagikazarmark/locafero v0.4.0
  • github.com/sagikazarmark/slog-shim v0.1.0
  • github.com/sourcegraph/conc v0.3.0
  • github.com/spf13/afero v1.11.0
  • github.com/spf13/cast v1.6.0
  • github.com/spf13/cobra v1.8.1
  • github.com/spf13/pflag v1.0.5
  • github.com/spf13/viper v1.19.0
  • github.com/stretchr/testify v1.10.0
  • github.com/subosito/gotenv v1.6.0
  • go.uber.org/multierr v1.10.0
  • go.uber.org/zap v1.27.0
  • golang.org/x/exp v0.0.0-20230905200255-921286631fa9
  • golang.org/x/sys v0.18.0
  • golang.org/x/text v0.14.0
  • golang.org/x/time v0.9.0
  • gopkg.in/ini.v1 v1.67.0
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/cpuguy83/go-md2man/v2 v2.0.4
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
  • github.com/fsnotify/fsnotify v1.7.0
  • github.com/hashicorp/hcl v1.0.0
  • github.com/inconshreveable/mousetrap v1.1.0
  • github.com/magiconair/properties v1.8.7
  • github.com/mitchellh/mapstructure v1.5.0
  • github.com/pelletier/go-toml/v2 v2.2.2
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/sagikazarmark/locafero v0.4.0
  • github.com/sagikazarmark/slog-shim v0.1.0
  • github.com/sourcegraph/conc v0.3.0
  • github.com/spf13/afero v1.11.0
  • github.com/spf13/cast v1.6.0
  • github.com/spf13/cobra v1.8.1
  • github.com/spf13/pflag v1.0.5
  • github.com/spf13/viper v1.19.0
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.4.0
  • github.com/stretchr/objx v0.5.0
  • github.com/stretchr/objx v0.5.2
  • github.com/stretchr/testify v1.3.0
  • github.com/stretchr/testify v1.7.1
  • github.com/stretchr/testify v1.8.0
  • github.com/stretchr/testify v1.8.4
  • github.com/stretchr/testify v1.9.0
  • github.com/stretchr/testify v1.10.0
  • github.com/subosito/gotenv v1.6.0
  • go.uber.org/atomic v1.9.0
  • go.uber.org/multierr v1.9.0
  • go.uber.org/multierr v1.10.0
  • go.uber.org/zap v1.27.0
  • golang.org/x/exp v0.0.0-20230905200255-921286631fa9
  • golang.org/x/sys v0.18.0
  • golang.org/x/text v0.14.0
  • golang.org/x/time v0.9.0
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/ini.v1 v1.67.0
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
  • gopkg.in/yaml.v3 v3.0.1