ejoy / goscon Goto Github PK
View Code? Open in Web Editor NEWstable connection
stable connection
goscon/examples/client/main.go
Line 39 in eec3795
因为接着就io.ReadFull(conn, rbuf[:sz])
,会覆盖掉的
你好,我最近也在做DH密钥交换,用的也是云风的C代码,我照搬了一个Go的版本,经过测试两者可以兼容,这样就可以避免掉cgo调用了。
cgo调用的开销还是挺大的,用在这样的小计算上面很不划算。
另外云风原先做的C版本存在生成0值私钥的可能,会进一步引起C程序崩溃或者Go死循环,需要改一下。
我移植的代码在这个仓库里:https://github.com/funny/crypto/tree/master/dh64
功能
流量压缩
包转发:终结连接
可运维
性能指标
功能指标: 断线重连次数、重连平均时间、重连平均重传数据量等
协议网关
解析协议,根据协议转发到不同服务
之前定义的未来计划,什么时候能够开始呢?
client 实现与 server 断线重连即可,为什么要转发到 remote ?
如果 remote 连接断了,怎么办?
https://github.com/ejoy/goscon/blob/master/upstream/upstream.go#L257
// NewConn creates a new connection to target server, pair with remoteConn
func (u *upstreams) NewConn(remoteConn *scp.Conn) (conn net.Conn, err error) {
tserver := remoteConn.TargetServer()
host := u.GetHost(tserver) // TODO: handle name resolve
if host == nil {
err = ErrNoHost
glog.Errorf("get host <%s> failed: %s", tserver, err.Error())
return
}
addr := host.addrs[rand.Intn(len(host.addrs))]
**tcpConn, err := net.DialTCP("tcp", nil, addr)**
if err != nil {
glog.Errorf("connect to <%s> failed: %s", host.Addr, err.Error())
return
}
option := u.option.Load().(*Option)
conn, err = upgradeConn(option.Net, tcpConn, remoteConn)
if err != nil {
conn.Close()
return
}
err = OnAfterConnected(conn, remoteConn)
return
}
有生成环境使用的数据和性能指标吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.