Git Product home page Git Product logo

kcp-go's Introduction

kcp-go

GoDoc Powered Build Status Go Report Card Coverage Statusd

A full-featured reliable UDP communication library.

Features

  1. Optimized for Real-Time Strategy Game.
  2. Compatible with skywind3000's C version with modifications.
  3. Cache friendly and Memory optimized design in golang.
  4. A session manager has provided with compatibility for net.Conn and net.Listener.
  5. Support FEC(Forward Error Correction) with Reed-Solomon Codes
  6. Support packet level encryption with AES, TEA.

Conventions

  1. UDP for packet delivery.
  2. conv uint32 in session manager is a random number initiated by client.
  3. KCP doesn't define control messages like SYN/ACK/FIN/RST in TCP, a real world example is to use some multiplexing protocol over session, such as yamux, see kcptun for example.

Examples

Client: full demo

kcpconn, err := kcp.DialWithOptions("192.168.0.1:10000", nil, 10, 3)

Server: full demo

lis, err := kcp.ListenWithOptions(":10000", nil, 10, 3)

Performance

  型号名称:	MacBook Pro
  型号标识符:	MacBookPro12,1
  处理器名称:	Intel Core i5
  处理器速度:	2.7 GHz
  处理器数目:	1
  核总数:	2
  L2 缓存(每个核):	256 KB
  L3 缓存:	3 MB
  内存:	8 GB
$ go test -run Speed
new client 127.0.0.1:61165
total recv: 16777216
time for 16MB rtt with encryption 570.41176ms
&{BytesSent:33554432 BytesReceived:33554432 MaxConn:2 ActiveOpens:1 PassiveOpens:1 CurrEstab:1 InErrs:0 InCsumErrors:0 InSegs:42577 OutSegs:42641 OutBytes:48111336 RetransSegs:92 FastRetransSegs:92 LostSegs:0 RepeatSegs:0 FECRecovered:1 FECErrs:0 FECSegs:8514}
PASS
ok  	github.com/xtaci/kcp-go	0.600s

Links

  1. https://github.com/xtaci/libkcp -- Official client library for iOS/Android(C++11)
  2. https://github.com/skywind3000/kcp -- A Fast and Reliable ARQ Protocol
  3. https://github.com/klauspost/reedsolomon -- Reed-Solomon Erasure Coding in Go

Donation 💵

donate

All donations on this project will be used to support the development of gonet/2.

kcp-go's People

Contributors

xtaci avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.