cv

package
v0.14.16 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 30 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 Commons = new(syncmap.Map)
View Source
var CommonsLoadOrStore = syncmap.LoadOrStoreFunc[Common]{
	Init: func() *Common {
		return C.Copy()
	},
}
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 {
	InIdle            bool           `json:"-"`                //闲置中?
	PID               int            `json:"-"`                //进程id
	Version           string         `json:"-"`                //版本
	Uid               int            `json:"-"`                //client uid
	Live              []*LiveQn      `json:"live"`             //直播流链接
	Live_qn           int            `json:"liveQn"`           //当前直播流质量
	Live_want_qn      int            `json:"-"`                //期望直播流质量
	Roomid            int            `json:"-"`                //房间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:"-"`                //直播开始时间
	Liveing           bool           `json:"liveing"`          //是否在直播
	Wearing_FansMedal int            `json:"WearingFansMedal"` //当前佩戴的粉丝牌
	Token             string         `json:"-"`                //弹幕钥
	WSURL             []string       `json:"-"`                //弹幕链接
	LiveBuvidUpdated  time.Time      `json:"-"`                //LIVE_BUVID更新时间
	Stream_url        *url.URL       `json:"-"`                //直播Web服务
	Proxy             string         `json:"-"`                //全局代理
	SerLocation       int            `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 deprecated added in v0.5.11

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

Deprecated: 存在缺陷

func (*Common) DisableLiveAuto deprecated added in v0.6.1

func (t *Common) DisableLiveAuto(host string) (hadDisable bool)

Deprecated: 存在缺陷

func (*Common) DisableLiveAutoByUuid added in v0.14.6

func (t *Common) DisableLiveAutoByUuid(uuid string) (hadDisable bool)

自动停用机制

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) MarshalJSON added in v0.14.7

func (t *Common) MarshalJSON() ([]byte, error)

func (*Common) ValidLive added in v0.5.11

func (t *Common) ValidLive() *LiveQn

func (*Common) ValidNum added in v0.14.3

func (t *Common) ValidNum() (num int)

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 `json:"-"`
	Uuid         string `json:"-"`
	Codec        string
	ReUpTime     time.Time
	CreateTime   time.Time
	DisableCount int
	Expires      time.Time //流到期时间
}

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() (hadDisable bool)

自动停用机制

func (*LiveQn) Host added in v0.5.11

func (t *LiveQn) Host() string

func (LiveQn) MarshalJSON added in v0.14.6

func (t LiveQn) MarshalJSON() ([]byte, error)

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