cv

package
v0.13.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: MIT Imports: 29 Imported by: 1

README


目录释义

目录 说明
./ 全局变常量
Const.go 全局常数
Var.go 全局变量

Documentation

Index

Constants

View Source
const (
	WS_OP_HEARTBEAT                  = 2
	WS_OP_HEARTBEAT_REPLY            = 3
	WS_OP_MESSAGE                    = 5
	WS_OP_USER_AUTHENTICATION        = 7
	WS_OP_CONNECT_SUCCESS            = 8
	WS_PACKAGE_HEADER_TOTAL_LENGTH   = 16
	WS_PACKAGE_OFFSET                = 0
	WS_HEADER_OFFSET                 = 4
	WS_VERSION_OFFSET                = 6
	WS_OPERATION_OFFSET              = 8
	WS_SEQUENCE_OFFSET               = 12
	WS_BODY_PROTOCOL_VERSION_NORMAL  = 0
	WS_BODY_PROTOCOL_VERSION_DEFLATE = 2
	WS_BODY_PROTOCOL_VERSION_BROTLI  = 3
	WS_HEADER_DEFAULT_VERSION        = 1
	WS_HEADER_DEFAULT_OPERATION      = 1
	WS_HEADER_DEFAULT_SEQUENCE       = 1
	WS_AUTH_OK                       = 0
	WS_AUTH_TOKEN_ERROR              = -101
)
View Source
const (
	Protover = 3
	Platform = "web"
	Type     = 2
)
View Source
const UA = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.3`

Variables

View Source
var C = new(Common).Init()
View Source
var StreamO = new(sync.Map)

StreamRec fmp4 https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming

Functions

func DefaultHttpCheck added in v0.9.8

func DefaultHttpCheck(c *Common, w http.ResponseWriter, r *http.Request, method ...string) bool

Types

type Common added in v0.5.10

type Common struct {
	PID               int            `json:"pid"`           //进程id
	Version           string         `json:"version"`       //版本
	Uid               int            `json:"-"`             //client uid
	Live              []LiveQn       `json:"-"`             //直播流链接
	Live_qn           int            `json:"liveQn"`        //当前直播流质量
	Live_want_qn      int            `json:"-"`             //期望直播流质量
	Roomid            int            `json:"roomid"`        //房间ID
	Cookie            syncmap.Map    `json:"-"`             //Cookie
	Title             string         `json:"title"`         //直播标题
	Uname             string         `json:"uname"`         //主播名
	UpUid             int            `json:"upUid"`         //主播uid
	Rev               float64        `json:"rev"`           //营收
	Renqi             int            `json:"renqi"`         //人气
	Watched           int            `json:"watched"`       //观看人数
	OnlineNum         int            `json:"onlineNum"`     //在线人数
	GuardNum          int            `json:"guardNum"`      //舰长数
	ParentAreaID      int            `json:"parentAreaID"`  //父分区
	AreaID            int            `json:"areaID"`        //子分区
	Locked            bool           `json:"locked"`        //直播间封禁
	Note              string         `json:"note"`          //分区排行
	Live_Start_Time   time.Time      `json:"liveStartTime"` //直播开始时间
	Liveing           bool           `json:"liveing"`       //是否在直播
	Wearing_FansMedal int            `json:"-"`             //当前佩戴的粉丝牌
	Token             string         `json:"-"`             //弹幕钥
	WSURL             []string       `json:"-"`             //弹幕链接
	LiveBuvidUpdated  time.Time      `json:"-"`             //LIVE_BUVID更新时间
	Stream_url        *url.URL       `json:"-"`             //直播Web服务
	Proxy             string         `json:"-"`             //全局代理
	AcceptQn          map[int]string `json:"-"`             //允许的直播流质量
	Qn                map[int]string `json:"-"`             //全部直播流质量
	// StreamType        StreamType            `json:"streamType"`    //当前直播流类型
	AllStreamType map[string]StreamType            `json:"-"` //直播流类型
	K_v           syncmap.Map                      `json:"-"` //配置文件
	Log           *log.Log_interface               `json:"-"` //日志
	Danmu_Main_mq *mq.Msgq                         `json:"-"` //消息
	ReqPool       *pool.Buf[reqf.Req]              `json:"-"` //请求池
	SerF          *web.WebPath                     `json:"-"` //web服务处理
	SerLimit      *web.Limits                      `json:"-"` //Web服务连接限制
	StartT        time.Time                        `json:"-"` //启动时间
	Cache         syncmap.MapExceeded[string, any] `json:"-"` //缓存
}

func (*Common) Copy added in v0.7.2

func (t *Common) Copy() *Common

func (*Common) DisableLive added in v0.5.11

func (t *Common) DisableLive(host string, reUpTime time.Time)

func (*Common) DisableLiveAuto added in v0.6.1

func (t *Common) DisableLiveAuto(host string)

自动停用机制

func (*Common) Init added in v0.5.11

func (t *Common) Init() *Common

func (*Common) IsOn added in v0.7.2

func (t *Common) IsOn(key string) bool

func (*Common) ValidLive added in v0.5.11

func (t *Common) ValidLive() *LiveQn

type Danmu_Main_mq_item

type Danmu_Main_mq_item struct {
	Class string
	Data  interface{}
}

消息队列

type LiveQn added in v0.5.11

type LiveQn struct {
	Url      string
	ReUpTime time.Time

	Expires int //流到期时间
	// contains filtered or unexported fields
}

func (*LiveQn) Disable added in v0.5.11

func (t *LiveQn) Disable(reUpTime time.Time)

func (*LiveQn) DisableAuto added in v0.6.1

func (t *LiveQn) DisableAuto()

自动停用机制

func (*LiveQn) Host added in v0.5.11

func (t *LiveQn) Host() string

func (*LiveQn) SetUrl added in v0.12.9

func (t *LiveQn) SetUrl(url string)

func (*LiveQn) Valid added in v0.5.11

func (t *LiveQn) Valid() bool

type ResStruct added in v0.6.2

type ResStruct struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data"`
}

Web服务响应格式

func (ResStruct) Write added in v0.6.2

func (t ResStruct) Write(w http.ResponseWriter) []byte

type StreamType added in v0.5.11

type StreamType struct {
	Protocol_name string
	Format_name   string
	Codec_name    string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL