|
|
@@ -588,12 +588,12 @@ func (h *Hub) BindForServer(info *HostInfo) (err error) {
|
|
|
conn.Close()
|
|
|
return
|
|
|
}
|
|
|
- if !h.checkAuthFunc(proto, version, channel, auth) {
|
|
|
+ if !h.checkAuthFunc(false, proto, version, channel, auth) {
|
|
|
conn.Close()
|
|
|
return
|
|
|
}
|
|
|
// 发送频道信息
|
|
|
- if err := conn.WriteAuthInfo(h.channel, h.authFunc(proto, version, channel, auth)); err != nil {
|
|
|
+ if err := conn.WriteAuthInfo(h.channel, h.authFunc(false, proto, version, channel, auth)); err != nil {
|
|
|
log.Println("[WriteAuthInfo ERROR]", err)
|
|
|
conn.Close()
|
|
|
return
|
|
|
@@ -704,7 +704,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo) (err e
|
|
|
localChannel = localChannel + "?proxy=" + host.Host
|
|
|
}
|
|
|
// 发送验证信息
|
|
|
- if err := conn.WriteAuthInfo(localChannel, h.authFunc(runProto, host.Version, channel, nil)); err != nil {
|
|
|
+ if err := conn.WriteAuthInfo(localChannel, h.authFunc(true, runProto, host.Version, channel, nil)); err != nil {
|
|
|
log.Println("[WriteAuthInfo ERROR]", err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
@@ -739,7 +739,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo) (err e
|
|
|
return err
|
|
|
}
|
|
|
// 检查验证是否合法
|
|
|
- if !h.checkAuthFunc(proto, version, channel, auth) {
|
|
|
+ if !h.checkAuthFunc(true, proto, version, channel, auth) {
|
|
|
err = fmt.Errorf("[checkAuthFunc ERROR] in proto: %s, version: %d, channel: %s, auth: %s", proto, version, channel, string(auth))
|
|
|
log.Println(err)
|
|
|
conn.Close()
|
|
|
@@ -849,7 +849,7 @@ func (h *Hub) checkConnect() {
|
|
|
func NewHub(
|
|
|
cf *config.Config,
|
|
|
channel string,
|
|
|
- // 客户端需要用的函数 (服务端可空)
|
|
|
+ // 客户端需要用的函数,提供连接的主机信息 (服务端可空)
|
|
|
connectHostFunc ConnectHostFunc,
|
|
|
// 验证函数,获取认证信息,用于发送给对方
|
|
|
authFunc AuthFunc,
|