diff options
author | Keuin <[email protected]> | 2023-07-01 22:10:22 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2023-07-01 22:10:44 +0800 |
commit | b8d0d0c3b6b2ffe40921aa4c247c101dd0ce958d (patch) | |
tree | c14f512312a6ee2fab6bdaef7cb55dfedbf19262 /danmaku/client.go | |
parent | 8f07f6f4d7e91a9e4b7164a39759907fac5fb8a1 (diff) |
Refactor: rename consts to follow Go idiom. Fix const comment style.
Diffstat (limited to 'danmaku/client.go')
-rw-r--r-- | danmaku/client.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/danmaku/client.go b/danmaku/client.go index 3a1298d..b785e23 100644 --- a/danmaku/client.go +++ b/danmaku/client.go @@ -15,8 +15,8 @@ import ( "nhooyr.io/websocket" ) -// Bilibili uses only binary WebSocket messages -const kBilibiliWebSocketMessageType = websocket.MessageBinary +// BilibiliWebSocketMessageType Bilibili uses only binary WebSocket messages +const BilibiliWebSocketMessageType = websocket.MessageBinary type DanmakuClient struct { ws *websocket.Conn @@ -34,7 +34,7 @@ type wsDatagramIO struct { } func (w *wsDatagramIO) Consume(data []byte) error { - return w.ws.Write(w.ctx, kBilibiliWebSocketMessageType, data) + return w.ws.Write(w.ctx, BilibiliWebSocketMessageType, data) } func (w *wsDatagramIO) Get() (data []byte, err error) { @@ -42,7 +42,7 @@ func (w *wsDatagramIO) Get() (data []byte, err error) { if err != nil { return } - if typ != kBilibiliWebSocketMessageType { + if typ != BilibiliWebSocketMessageType { err = fmt.Errorf("invalid message type: expected a binary WebSocket message, however got %v", typ.String()) } return |