From 061fbe60cf6df91cf7874145d07b4c291c848e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Sat, 13 Feb 2021 00:01:56 +0100 Subject: [PATCH] switch WebRTC to BigEndian. --- internal/webrtc/handler.go | 10 +++++----- internal/webrtc/send.go | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/webrtc/handler.go b/internal/webrtc/handler.go index 50d0be71..acf336b2 100644 --- a/internal/webrtc/handler.go +++ b/internal/webrtc/handler.go @@ -47,7 +47,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error { return err } - if err := binary.Read(bytes.NewBuffer(hbytes), binary.LittleEndian, header); err != nil { + if err := binary.Read(bytes.NewBuffer(hbytes), binary.BigEndian, header); err != nil { return err } @@ -56,14 +56,14 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error { switch header.Event { case OP_MOVE: payload := &PayloadMove{} - if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { return err } manager.desktop.Move(int(payload.X), int(payload.Y)) case OP_SCROLL: payload := &PayloadScroll{} - if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { return err } @@ -76,7 +76,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error { manager.desktop.Scroll(int(payload.X), int(payload.Y)) case OP_KEY_DOWN: payload := &PayloadKey{} - if err := binary.Read(buffer, binary.LittleEndian, payload); err != nil { + if err := binary.Read(buffer, binary.BigEndian, payload); err != nil { return err } @@ -99,7 +99,7 @@ func (manager *WebRTCManagerCtx) handle(msg webrtc.DataChannelMessage) error { } case OP_KEY_UP: payload := &PayloadKey{} - err := binary.Read(buffer, binary.LittleEndian, payload) + err := binary.Read(buffer, binary.BigEndian, payload) if err != nil { return err } diff --git a/internal/webrtc/send.go b/internal/webrtc/send.go index 8da30083..cd2fa64b 100644 --- a/internal/webrtc/send.go +++ b/internal/webrtc/send.go @@ -43,7 +43,7 @@ func (webrtc_peer *WebRTCPeerCtx) SendCursorPosition(x, y int) error { } buffer := &bytes.Buffer{} - if err := binary.Write(buffer, binary.LittleEndian, data); err != nil { + if err := binary.Write(buffer, binary.BigEndian, data); err != nil { return err } @@ -73,11 +73,11 @@ func (webrtc_peer *WebRTCPeerCtx) SendCursorImage(cur *types.CursorImage) error buffer := &bytes.Buffer{} - if err := binary.Write(buffer, binary.LittleEndian, data); err != nil { + if err := binary.Write(buffer, binary.BigEndian, data); err != nil { return err } - if err := binary.Write(buffer, binary.LittleEndian, img); err != nil { + if err := binary.Write(buffer, binary.BigEndian, img); err != nil { return err }