|
|
@@ -702,13 +702,13 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
if host.Version == ws2.VERSION && (host.Proto == ws2.PROTO || host.Proto == ws2.PROTO_STL) {
|
|
|
runProto = ws2.PROTO
|
|
|
if h.cf.PrintMsg {
|
|
|
- log.Println("[Connect]", host.Proto, addr, host.Path, host.Hash)
|
|
|
+ log.Println("[ConnectToServer] connecting:", host.Proto, addr, host.Path, host.Hash)
|
|
|
}
|
|
|
conn, err = ws2.Dial(h.cf, host.Proto, addr, host.Path, host.Hash)
|
|
|
} else if host.Version == tcp2.VERSION && host.Proto == tcp2.PROTO {
|
|
|
runProto = tcp2.PROTO
|
|
|
if h.cf.PrintMsg {
|
|
|
- log.Println("[Connect]", host.Proto, addr, host.Hash)
|
|
|
+ log.Println("[ConnectToServer] connecting:", host.Proto, addr, host.Hash)
|
|
|
}
|
|
|
conn, err = tcp2.Dial(h.cf, addr, host.Hash)
|
|
|
} else {
|
|
|
@@ -716,7 +716,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
}
|
|
|
if done {
|
|
|
if err != nil {
|
|
|
- log.Println("[Dial ERROR]", err)
|
|
|
+ log.Println("[ConnectToServer] dial failed:", err)
|
|
|
}
|
|
|
if conn != nil {
|
|
|
conn.Close()
|
|
|
@@ -730,7 +730,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
case ok := <-taskCh:
|
|
|
cancel()
|
|
|
if !ok || err != nil || conn == nil {
|
|
|
- log.Println("[Client ERROR]", host.Proto, err)
|
|
|
+ log.Println("[ConnectToServer] connect failed:", err)
|
|
|
host.Errors++
|
|
|
host.Updated = time.Now()
|
|
|
if err == nil {
|
|
|
@@ -752,7 +752,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
}
|
|
|
// 发送验证信息
|
|
|
if err := conn.WriteAuthInfo(localChannel, h.authFunc(true, runProto, host.Version, channel, nil)); err != nil {
|
|
|
- log.Println("[WriteAuthInfo ERROR]", err)
|
|
|
+ log.Println("[ConnectToServer] WriteAuthInfo failed:", err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
host.Updated = time.Now()
|
|
|
@@ -761,7 +761,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
// 接收频道信息
|
|
|
proto, version, channel2, auth, err := conn.ReadAuthInfo()
|
|
|
if err != nil {
|
|
|
- log.Println("[ConnectToServer ReadAuthInfo ERROR]", err)
|
|
|
+ log.Println("[ConnectToServer] ReadAuthInfo failed:", err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
host.Updated = time.Now()
|
|
|
@@ -769,7 +769,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
}
|
|
|
// 检查版本和协议是否一致
|
|
|
if version != host.Version || proto != runProto {
|
|
|
- err = fmt.Errorf("[version or protocol wrong ERROR] %d, %s", version, proto)
|
|
|
+ err = fmt.Errorf("[ConnectToServer] version or protocol wrong: %d, %s", version, proto)
|
|
|
log.Println(err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
@@ -778,7 +778,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
}
|
|
|
// 检查频道名称是否匹配
|
|
|
if !strings.Contains(channel2, channel) {
|
|
|
- err = fmt.Errorf("[channel ERROR] want %s, get %s", channel, channel2)
|
|
|
+ err = fmt.Errorf("[ConnectToServer] channel want %s, get %s", channel, channel2)
|
|
|
log.Println(err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
@@ -787,7 +787,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
}
|
|
|
// 检查验证是否合法
|
|
|
if !h.checkAuthFunc(true, proto, version, channel, auth) {
|
|
|
- err = fmt.Errorf("[client checkAuthFunc ERROR] in proto: %s, version: %d, channel: %s, auth: %s", proto, version, channel, string(auth))
|
|
|
+ err = fmt.Errorf("[ConnectToServer] client checkAuthFunc in proto: %s, version: %d, channel: %s, auth: %s", proto, version, channel, string(auth))
|
|
|
log.Println(err)
|
|
|
conn.Close()
|
|
|
host.Errors++
|
|
|
@@ -806,7 +806,7 @@ func (h *Hub) ConnectToServer(channel string, force bool, host *HostInfo, autoRe
|
|
|
if force {
|
|
|
line.Close(true)
|
|
|
} else {
|
|
|
- err = fmt.Errorf("[connectToServer ERROR] channel already connected: %s", channel)
|
|
|
+ err = fmt.Errorf("[connectToServer] channel already connected: %s", channel)
|
|
|
log.Println(err)
|
|
|
return false
|
|
|
}
|
|
|
@@ -872,7 +872,7 @@ func (h *Hub) checkConnect() {
|
|
|
if line.host != nil && line.host.Proxy && now-line.updated.UnixMilli() > int64(h.cf.ProxyTimeout) {
|
|
|
host, err := h.connectHostFunc(line.channel, Direct)
|
|
|
if err != nil {
|
|
|
- log.Println("[proxyTicker connectHostFunc ERROR]", err)
|
|
|
+ log.Println("[proxyTicker connectHostFunc]", err)
|
|
|
return false
|
|
|
}
|
|
|
if host != nil {
|