whatisgithub

What is kcp-go?

xtaci/kcp-go — explained in plain English

Analysis updated 2026-06-26

4,485GoAudience · developerComplexity · 3/5LicenseSetup · moderate

In one sentence

A Go library that adds reliable, ordered delivery and optional encryption on top of UDP, giving lower latency than TCP for games, live video, and other real-time apps.

Mindmap

mindmap
  root((kcp-go))
    What it does
      Reliable UDP delivery
      Lower latency than TCP
      Ordered packets
    Features
      Forward error correction
      Packet encryption
      5000 connections
    Use cases
      Online games
      Live video
      File sync tools
    Tech
      Go
      MIT license
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

What do people build with it?

USE CASE 1

Replace TCP connections in a Go game server to reduce latency while keeping reliable ordered packet delivery.

USE CASE 2

Build a file synchronization tool that transfers data faster than TCP using kcp-go's low-latency UDP protocol.

USE CASE 3

Add packet-level AES or Salsa20 encryption to a UDP data stream without modifying application logic.

What is it built with?

Go

How does it compare?

xtaci/kcp-gonikolaydubina/go-recipesaquasecurity/tracee
Stars4,4854,4854,482
LanguageGoGoGo
Setup difficultymoderateeasymoderate
Complexity3/51/53/5
Audiencedeveloperdeveloperops devops

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min
Use freely for any purpose including commercial products as long as you keep the copyright notice.

So what is it?

kcp-go is a Go library that provides reliable, ordered data delivery over UDP (User Datagram Protocol). UDP is a fast but normally unreliable way to send data across a network. TCP, the alternative, provides reliability but adds latency through its connection setup and acknowledgment mechanisms. kcp-go adds ordering, error checking, and guaranteed delivery on top of UDP while keeping response times lower than TCP allows. The library is designed for situations where speed matters more than bandwidth efficiency, such as online games, live video broadcasts, file synchronization tools, and network acceleration programs. It has been deployed across millions of devices, from low-end home routers to high-end servers. The code is compatible with Go's standard network interfaces, so it can replace a regular TCP connection in existing code without major rewrites. Beyond basic reliable delivery, kcp-go includes forward error correction using Reed-Solomon codes. This technique sends extra redundancy data alongside each message, allowing the receiver to reconstruct lost packets without waiting for a retransmission. The library also supports packet-level encryption with several algorithm options including AES, Blowfish, and Salsa20. Encryption is applied to the complete packet including headers, making it harder to analyze or tamper with traffic in transit. On the performance side, the library handles more than 5,000 concurrent connections on a single commodity server. The README documents the design choices behind this: using contiguous memory slices rather than linked lists for cache efficiency, minimizing calls to the system clock, and drawing memory from a global pool to avoid unnecessary allocations. On Linux, batch send and receive system calls are available to reduce per-packet overhead further. The library is licensed under MIT.

Copy-paste prompts

Prompt 1
Show me how to create a kcp-go server and client in Go that exchange messages reliably over UDP.
Prompt 2
Configure kcp-go to use AES encryption on all packets for a peer-to-peer file transfer application.
Prompt 3
Enable forward error correction with Reed-Solomon codes in kcp-go, how many data and parity shards should I use for a game server?
Prompt 4
Replace a net.Conn TCP connection with kcp-go in an existing Go server with minimal code changes.
Prompt 5
Tune kcp-go parameters to handle 5000 concurrent connections on a single commodity server efficiently.

Frequently asked questions

What is kcp-go?

A Go library that adds reliable, ordered delivery and optional encryption on top of UDP, giving lower latency than TCP for games, live video, and other real-time apps.

What language is kcp-go written in?

Mainly Go. The stack also includes Go.

What license does kcp-go use?

Use freely for any purpose including commercial products as long as you keep the copyright notice.

How hard is kcp-go to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is kcp-go for?

Mainly developer.

Open on GitHub → Ask about another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.