Documentation
¶
Index ¶
- Constants
- Variables
- type ApiLiveAuth
- type Client
- type MsgHandler
- func (msgHandler *MsgHandler) CmdBrotliProtoDecoder(wsHeader *WsHeader, msg []byte) []byte
- func (msgHandler *MsgHandler) CmdHandler(wsHeader *WsHeader, msg []byte)
- func (msgHandler *MsgHandler) CmdZlibProtoDecoder(wsHeader *WsHeader, msg []byte) []byte
- func (msgHandler *MsgHandler) MsgHandler(msg []byte)
- type WsAuthBody
- type WsAuthMessage
- type WsAuthReplyBody
- type WsAuthReplyMessage
- type WsCmdBrotliMessage
- type WsCmdMessage
- type WsHeader
- type WsHeartBeatMessage
- type WsHeartBeatReply
Constants ¶
View Source
const ( UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" BiliUrl = "www.bilibili.com" BiliLiveApiUrl = "api.live.bilibili.com" )
View Source
const ( AuthProto = 1 HeartBeatProto = 1 CmdZlibProto = 2 CmdBrotliProto = 3 )
View Source
const ( OpError = 1 OpHeartBeat = 2 OpHeartBeatReply = 3 OpCmd = 5 OpAuth = 7 OpAuthReply = 8 )
Variables ¶
View Source
var JsonCoder jsonCoder
View Source
var RespCodeNotError = errors.New("resp code not 0")
Functions ¶
This section is empty.
Types ¶
type ApiLiveAuth ¶
type ApiLiveAuth struct {
Code int `json:"code"`
Message string `json:"message"`
TTL int `json:"ttl"`
Data struct {
Group string `json:"group"`
BusinessID int `json:"business_id"`
RefreshRowFactor float64 `json:"refresh_row_factor"`
RefreshRate int `json:"refresh_rate"`
MaxDelay int `json:"max_delay"`
Token string `json:"token"`
HostList []struct {
Host string `json:"host"`
Port int `json:"port"`
WssPort int `json:"wss_port"`
WsPort int `json:"ws_port"`
} `json:"host_list"`
} `json:"data"`
}
func GetLiveRoomAuth ¶
func GetLiveRoomAuth(roomId int) (ApiLiveAuth, error)
type MsgHandler ¶
func (*MsgHandler) CmdBrotliProtoDecoder ¶
func (msgHandler *MsgHandler) CmdBrotliProtoDecoder(wsHeader *WsHeader, msg []byte) []byte
func (*MsgHandler) CmdHandler ¶
func (msgHandler *MsgHandler) CmdHandler(wsHeader *WsHeader, msg []byte)
func (*MsgHandler) CmdZlibProtoDecoder ¶
func (msgHandler *MsgHandler) CmdZlibProtoDecoder(wsHeader *WsHeader, msg []byte) []byte
func (*MsgHandler) MsgHandler ¶
func (msgHandler *MsgHandler) MsgHandler(msg []byte)
type WsAuthBody ¶
type WsAuthMessage ¶
type WsAuthMessage struct {
WsHeader WsHeader
Body WsAuthBody
}
func (*WsAuthMessage) GetPackage ¶
func (wsAuth *WsAuthMessage) GetPackage() []byte
type WsAuthReplyBody ¶
type WsAuthReplyBody struct {
Code int `json:"code"`
}
type WsAuthReplyMessage ¶
type WsAuthReplyMessage struct {
WsHeader WsHeader
Body WsAuthReplyBody
}
func (*WsAuthReplyMessage) SetPackage ¶
func (wsAuthReplyMessage *WsAuthReplyMessage) SetPackage(header WsHeader, msg []byte)
type WsCmdBrotliMessage ¶
type WsCmdBrotliMessage struct {
WsHeader WsHeader
Body []WsCmdMessage
}
type WsCmdMessage ¶
func (*WsCmdMessage) SetPackage ¶
func (wsCmdMessage *WsCmdMessage) SetPackage(header WsHeader, msg []byte)
type WsHeader ¶
type WsHeader struct {
PackageLen uint32
HeaderLen uint16
ProtoVer uint16
OpCode uint32
Sequence uint32
}
func WsHeaderDecoder ¶
func (*WsHeader) HeaderEncoder ¶
type WsHeartBeatMessage ¶
func (*WsHeartBeatMessage) GetPackage ¶
func (wsHeartBeat *WsHeartBeatMessage) GetPackage() []byte
type WsHeartBeatReply ¶
func (*WsHeartBeatReply) SetPackage ¶
func (wsHeartBeatReply *WsHeartBeatReply) SetPackage(header WsHeader, msg []byte)
Click to show internal directories.
Click to hide internal directories.