explaingit

tylertreat/comcast

10,509GoAudience · developerComplexity · 2/5Setup · easy

TLDR

A command-line tool that deliberately degrades your network connection to simulate real-world conditions like packet loss, added latency, and bandwidth caps so you can test how your app handles them.

Mindmap

mindmap
  root((repo))
    What it Does
      Degrades network on demand
      Restores with stop flag
      Wraps OS network tools
    Conditions to Simulate
      Added latency
      Bandwidth cap
      Packet loss
    OS Support
      Linux via iptables
      macOS via pfctl
    Use Cases
      Test app resilience
      Reproduce flaky bugs
      Verify retry logic
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Simulate a 3G mobile connection to test how your web app loads under slow conditions before shipping.

USE CASE 2

Add 200ms of latency and 5% packet loss to all traffic on your dev machine to reproduce flaky network bugs.

USE CASE 3

Limit bandwidth to a specific port to test how your API client handles slow or stalled responses.

USE CASE 4

Run comcast --stop after testing to instantly restore normal network behavior without rebooting.

Tech stack

Goiptablestcipfwpfctl

Getting it running

Difficulty · easy Time to first run · 5min

Requires root or sudo on Linux to modify iptables and tc rules.

In plain English

Comcast is a command-line tool for deliberately degrading your network connection in controlled ways so you can test how your software behaves under poor conditions. The name is a joke referencing the ISP, not an affiliation with it. The idea is that network failures are not always dramatic outages, more often they are slow connections, occasional dropped packets, or added latency, and these subtle problems are worth testing for. The tool works by wrapping the network control utilities that already exist on your operating system. On Linux it uses iptables and tc, which are built-in tools for managing network traffic rules. On macOS and BSD systems it uses ipfw or pfctl, depending on the OS version. Comcast just provides a simpler command to configure those tools without having to write the commands by hand. You run it from the terminal, passing flags for the conditions you want to simulate. You can set added latency in milliseconds, cap the bandwidth in kilobits per second, and specify a percentage of packets to randomly drop. You can also narrow the conditions to specific IP addresses, protocols (TCP, UDP, ICMP), or port numbers, so only traffic to a particular service is affected. Running comcast --stop removes the rules and restores normal network behavior. The README includes a reference table of real-world network profiles with suggested values for conditions like 3G mobile, DSL, dial-up, WiFi, and even Starlink, so you can replicate recognizable scenarios rather than guessing at numbers. The project is written in Go and installable with a single go install command. For users who prefer not to run a wrapper script, the README also shows the underlying iptables and ipfw commands directly, so you can run them yourself.

Copy-paste prompts

Prompt 1
I want to test my app under 3G mobile network conditions. Give me the comcast CLI commands to set the right latency, bandwidth cap, and packet loss values based on the real-world profiles in the README.
Prompt 2
Using comcast, write a test script that simulates a slow DSL connection for 30 seconds, runs my integration test suite, then restores normal network behavior.
Prompt 3
I only want to degrade traffic to a specific IP and port using comcast. Show me the flags for targeting a single service without affecting the rest of my dev machine.
Prompt 4
My app is flaky under packet loss. Walk me through using comcast to reproduce the problem, then help me add retry logic to the API client to handle it.
Prompt 5
Show me the underlying iptables commands that comcast uses to add 100ms latency and 10% packet drop on Linux, so I can run them directly without the wrapper.
Open on GitHub → Explain another repo

← tylertreat on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.