4 Star 9 Fork 4

ooclab / otunnel

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
handshake.go 648 Bytes
一键复制 编辑 原始数据 按行查看 历史
ooclab 提交于 2017-09-07 09:46 . use glide
package server
import (
"github.com/Sirupsen/logrus"
"github.com/ooclab/es"
pjson "github.com/ooclab/otunnel/proto/json"
)
func handshake(conn es.Conn) error {
jconn := pjson.NewConn(conn)
if err := handleAuth(jconn); err != nil {
return err
}
return nil
}
func handleAuth(c *pjson.Conn) error {
m, err := c.Recv()
if err != nil {
return err
}
// username := req["username"]
// password := req["password"]
//
// if username != "admin" {
// return errors.New("not admin user")
// }
logrus.Debugf("handle auth, got request: %+v", m)
return c.Send(map[string]interface{}{
"link_id": 123456,
"hello": "world",
})
}
Go
1
https://gitee.com/ooclab/otunnel.git
git@gitee.com:ooclab/otunnel.git
ooclab
otunnel
otunnel
v1.3.1

搜索帮助

53164aa7 5694891 3bd8fe86 5694891