这里有新鲜出炉的精品教程,程序狗速度看过来!
Teleport2.0 实现了一个全新的Golang TCP Socket框架,它通用、高效、灵活!可被用于Peer-Peer对等通信、RPC、长连接网关、微服务、推送服务,游戏服务等领域。
teleport-server-peer
AB Testing 1: [Mac 4CPU 8GB] [single-process single-conn] teleport: QPS 37550
AB Testing 2: [Mac 4CPU 8GB] [single-process single-conn] teleport/socket: QPS 55419
- Peer - > Connection - > Socket - > Session - > Context
- HeaderLength | HeaderCodecId | Header | BodyLength | BodyCodecId | Body
注意:
- type Packet struct { // HeaderCodec header codec name HeaderCodec string `json:"header_codec"` // BodyCodec body codec name BodyCodec string `json:"body_codec"` // header content Header *Header `json:"header"` // body content Body interface{} `json:"body"` // header length HeaderLength int64 `json:"header_length"` // body length BodyLength int64 `json:"body_length"` // HeaderLength + BodyLength Length int64 `json:"length"` }
- type Header struct { // Packet id Id string // Service type Type int32 // Service URI Uri string // Body encoding type Gzip int32 // As reply, it indicates the service status code StatusCode int32 // As reply, it indicates the service status text Status string }
项目地址:https://github.com/henrylee2cn/teleport
授权协议:Apache2.0
来源: http://www.phperz.com/article/17/0828/344933.html