From 8dd91e03f2c1da32a0f828f65337c450aa1a3bd9 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 14 Aug 2023 13:26:54 +0800 Subject: [PATCH] 1 --- prototils.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/prototils.go b/prototils.go index eb700ba..62f51e7 100644 --- a/prototils.go +++ b/prototils.go @@ -5,6 +5,11 @@ import ( "net" ) +type WspCliConn struct { + Conn net.Conn + SocketHandle uint16 +} + type MsgHdr struct { MsgId uint16 SeqId uint32 @@ -67,6 +72,15 @@ type WSProxyPackHead_S struct { ExtLen uint16 } +func (this *WspCliConn) IsValid() bool { + return this.Conn == nil || this.SocketHandle == 0 +} + +func (this *WspCliConn) Reset() bool { + this.Conn = nil + this.SocketHandle == 0 +} + func (this *WSProxyPackHead_C) Read(data []byte, offset int) { this.PackLen = q5.MkUInt16(data[offset + 0], data[offset + 1]) this.MsgId = q5.MkUInt16(data[offset + 2], data[offset + 3])