Documentation
¶
Index ¶
- Constants
- Variables
- func ChangeSequenceMode(mode int)
- func GetRealRoomId(roomId int) (int, error)
- type ApiLiveAuth
- type ApiLiveRoomId
- 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" BiliLiveApiUrl = "api.live.bilibili.com" MainWsUrl = "broadcastlv.chat.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 )
View Source
const DefaultPriority = 1 << 0
View Source
const DelayPriority = 1 << 1
View Source
const NoCDNPriority = 1 << 2
Variables ¶
View Source
var Header http.Header
View Source
var HeartBeatReplyCmd = "HEARTBEAT_REPLY"
View Source
var INF = 0x3f3f3f
View Source
var JsonCoder jsonCoder
View Source
var PriorityMode = DefaultPriority
View Source
var RespCodeNotError = errors.New("resp code not 0")
View Source
var UID = int64(1)
Functions ¶
func ChangeSequenceMode ¶ added in v0.4.0
func ChangeSequenceMode(mode int)
func GetRealRoomId ¶ added in v0.4.0
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"`
}
type ApiLiveRoomId ¶ added in v0.4.0
type ApiLiveRoomId struct {
Code int `json:"code"`
Message string `json:"message"`
TTL int `json:"ttl"`
Data struct {
RoomID int `json:"room_id"`
ShortID int `json:"short_id"`
UID int `json:"uid"`
NeedP2P int `json:"need_p2p"`
IsHidden bool `json:"is_hidden"`
IsLocked bool `json:"is_locked"`
IsPortrait bool `json:"is_portrait"`
LiveStatus int `json:"live_status"`
HiddenTill int `json:"hidden_till"`
LockTill int `json:"lock_till"`
Encrypted bool `json:"encrypted"`
PwdVerified bool `json:"pwd_verified"`
LiveTime int `json:"live_time"`
RoomShield int `json:"room_shield"`
IsSp int `json:"is_sp"`
SpecialType int `json:"special_type"`
PlayURL interface{} `json:"play_url"`
AllSpecialTypes []interface{} `json:"all_special_types"`
} `json:"data"`
}
type Client ¶
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.