【feat】添加tcp指令下发

This commit is contained in:
XM-GO
2023-09-27 17:30:11 +08:00
parent 9eff841b81
commit 0dc58c0d18
19 changed files with 481 additions and 83 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"github.com/emicklei/go-restful/v3"
"io"
"log"
"net"
"net/http"
"pandax/iothub/hook_message_work"
@@ -41,6 +42,7 @@ func InitHttpHook(addr string, hs *hook_message_work.HookService) {
switch state {
case http.StateHijacked, http.StateClosed:
etoken, _ := activeConnections.Load(conn.RemoteAddr())
log.Println("关闭http连接")
data := netbase.CreateConnectionInfo(message.DisConnectMes, "http", conn.RemoteAddr().String(), conn.RemoteAddr().String(), etoken.(*tool.DeviceAuth))
service.HookService.MessageCh <- data
activeConnections.Delete(conn.RemoteAddr())