You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.8 KiB
Go
60 lines
1.8 KiB
Go
package bilibili
|
|
|
|
// ws-ops
|
|
const (
|
|
WsOpHeartbeat = 2 // 心跳
|
|
WsOpHeartbeatReply = 3 // 心跳回应
|
|
WsOpMessage = 5 // 弹幕消息等
|
|
WsOpEnterRoom = 7 // 请求进入房间
|
|
WsOpEnterRoomSuccess = 8 // 进房回应
|
|
)
|
|
|
|
// version protocol
|
|
const (
|
|
WsVerPlain = 0
|
|
WsVerInt = 1
|
|
WsVerZlib = 2
|
|
WsVerBrotli = 3
|
|
)
|
|
|
|
type RoomInfo struct {
|
|
RoomId int64 `json:"room_id"` // 房间号(这个才能连接ws)
|
|
ShortId int64 `json:"short_id"` // 短房间号
|
|
Uid int `json:"uid"` // 主播UID
|
|
IsHidden bool `json:"is_hidden"` // 是否隐藏?
|
|
IsLocked bool `json:"is_locked"` // 是否被封
|
|
IsPortrait bool `json:"is_portrait"` // 是否竖屏
|
|
LiveStatus int `json:"live_status"` // 1开播 0可能是未开播
|
|
HiddenTill int64 `json:"hidden_till"` // 隐藏时限 timestamp
|
|
LockTill int64 `json:"lock_till"` // 解禁时间 timestamp
|
|
Encrypted bool `json:"encrypted"` // 是否加密?
|
|
PwdVerified bool `json:"pwd_verified"` // 密码是否验证?
|
|
LiveTime int64 `json:"live_time"` // 开播时间
|
|
RoomShield int `json:"room_shield"` //
|
|
IsSp int `json:"is_sp"` //
|
|
SpecialType int `json:"special_type"` //
|
|
}
|
|
|
|
// WsEntry bilibili websocket 结构 均为大端序 BigEndian
|
|
type WsEntry struct {
|
|
protoVer uint16
|
|
operation uint32
|
|
sequenceId uint32
|
|
data []byte
|
|
}
|
|
|
|
// JoinRoomReq 加入房间消息
|
|
type JoinRoomReq struct {
|
|
ClientVer string `json:"clientver,omitempty"` //key可不存在
|
|
Platform string `json:"platform,default=web"`
|
|
ProtoVer int `json:"protover,default=2"`
|
|
RoomId int64 `json:"roomid"` // 必填
|
|
Uid int64 `json:"uid"`
|
|
Type int `json:"type,default=2"`
|
|
Key string `json:"key"`
|
|
}
|
|
|
|
type CMD struct {
|
|
CMD string `json:"cmd"`
|
|
}
|