mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2025-01-09 10:49:35 +08:00
chore: tuic-server support heartbeat command
This commit is contained in:
parent
81e03ec904
commit
df306be1ec
@ -349,7 +349,7 @@ func NewHeartbeat() Heartbeat {
|
||||
}
|
||||
}
|
||||
|
||||
func ReadHeartbeatWithHead(head CommandHead, reader BufferedReader) (c Response, err error) {
|
||||
func ReadHeartbeatWithHead(head CommandHead, reader BufferedReader) (c Heartbeat, err error) {
|
||||
c.CommandHead = head
|
||||
if c.CommandHead.TYPE != HeartbeatType {
|
||||
err = fmt.Errorf("error command type: %s", c.CommandHead.TYPE)
|
||||
@ -357,7 +357,7 @@ func ReadHeartbeatWithHead(head CommandHead, reader BufferedReader) (c Response,
|
||||
return
|
||||
}
|
||||
|
||||
func ReadHeartbeat(reader BufferedReader) (c Response, err error) {
|
||||
func ReadHeartbeat(reader BufferedReader) (c Heartbeat, err error) {
|
||||
head, err := ReadCommandHead(reader)
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -261,6 +261,13 @@ func (s *serverHandler) handleUniStream() (err error) {
|
||||
writeClosed := v.(*atomic.Bool)
|
||||
writeClosed.Store(true)
|
||||
}
|
||||
case HeartbeatType:
|
||||
var heartbeat Heartbeat
|
||||
heartbeat, err = ReadHeartbeatWithHead(commandHead, reader)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
heartbeat.BytesLen()
|
||||
}
|
||||
return
|
||||
}()
|
||||
|
Loading…
x
Reference in New Issue
Block a user