routers

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: GPL-3.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BuildVersion  = "v1.0"
	BuildDateTime = "2022-06-01"
	AgentName     = "OneDSS Client"
)
View Source
var API = &APIHandler{
	RestartChan: make(chan bool),
}
View Source
var Router *gin.Engine

Functions

func Errors

func Errors() gin.HandlerFunc

func Init

func Init() (err error)

func NeedLogin

func NeedLogin() gin.HandlerFunc

Types

type APIHandler

type APIHandler struct {
	RestartChan chan bool
}

func (*APIHandler) AlarmEvent

func (h *APIHandler) AlarmEvent(c *gin.Context)

*

  • @api {get} /api/v1/event/receive 接收推送事件
  • @apiGroup event
  • @apiName AlarmEvent
  • @apiSuccess (200) {String} code 返回码
  • @apiSuccess (200) {String} msg 描述信息

func (*APIHandler) AlarmPicture added in v1.0.3

func (h *APIHandler) AlarmPicture(c *gin.Context)

func (*APIHandler) AlarmRecord added in v1.0.3

func (h *APIHandler) AlarmRecord(c *gin.Context)

func (*APIHandler) DefaultLoginInfo

func (h *APIHandler) DefaultLoginInfo(c *gin.Context)

func (*APIHandler) GetProcessInfo added in v1.0.3

func (h *APIHandler) GetProcessInfo(c *gin.Context)

func (*APIHandler) GetServerInfo

func (h *APIHandler) GetServerInfo(c *gin.Context)

*

  • @api {get} /getserverinfo 获取平台运行信息
  • @apiGroup sys
  • @apiName GetServerInfo
  • @apiSuccess (200) {String} Hardware 硬件信息
  • @apiSuccess (200) {String} RunningTime 运行时间
  • @apiSuccess (200) {String} StartUpTime 启动时间
  • @apiSuccess (200) {String} Server 软件信息

func (*APIHandler) Login

func (h *APIHandler) Login(c *gin.Context)

*

  • @api {get} /login 登录
  • @apiGroup sys
  • @apiName Login
  • @apiParam {String} username 用户名
  • @apiParam {String} password 密码(经过md5加密,32位长度,不带中划线,不区分大小写)
  • @apiSuccessExample 成功
  • HTTP/1.1 200 OK
  • Set-Cookie: token=s%3ArkyMbQE0M.5AKAOXbW8c7iP%2BOo0venPkCYiEiPK9FY31mB6AlFQak;//用着后续接口调用的 token

func (*APIHandler) Logout

func (h *APIHandler) Logout(c *gin.Context)

*

  • @api {get} /logout 登出
  • @apiGroup sys
  • @apiName Logout
  • @apiUse simpleSuccess

func (*APIHandler) ModifyPassword

func (h *APIHandler) ModifyPassword(c *gin.Context)

func (*APIHandler) Players

func (h *APIHandler) Players(c *gin.Context)

*

  • @api {get} /api/v1/players 获取拉流列表
  • @apiGroup stats
  • @apiName Players
  • @apiParam {Number} [start] 分页开始,从零开始
  • @apiParam {Number} [limit] 分页大小
  • @apiParam {String} sort 排序字段
  • @apiParam {String=ascending,descending} [order] 排序顺序
  • @apiParam {String} [q] 查询参数
  • @apiSuccess (200) {Number} total 总数
  • @apiSuccess (200) {Array} rows 推流列表
  • @apiSuccess (200) {String} rows.id
  • @apiSuccess (200) {String} rows.path
  • @apiSuccess (200) {String} rows.transType 传输模式
  • @apiSuccess (200) {Number} rows.inBytes 入口流量
  • @apiSuccess (200) {Number} rows.outBytes 出口流量
  • @apiSuccess (200) {String} rows.startAt 开始时间

func (*APIHandler) Pushers

func (h *APIHandler) Pushers(c *gin.Context)

*

  • @api {get} /api/v1/pushers 获取推流列表
  • @apiGroup stats
  • @apiName Pushers
  • @apiParam {Number} [start] 分页开始,从零开始
  • @apiParam {Number} [limit] 分页大小
  • @apiParam {String} sort 排序字段
  • @apiParam {String=ascending,descending} [order] 排序顺序
  • @apiParam {String} [q] 查询参数
  • @apiSuccess (200) {Number} total 总数
  • @apiSuccess (200) {Array} rows 推流列表
  • @apiSuccess (200) {String} rows.id
  • @apiSuccess (200) {String} rows.path
  • @apiSuccess (200) {String} rows.transType 传输模式
  • @apiSuccess (200) {Number} rows.inBytes 入口流量
  • @apiSuccess (200) {Number} rows.outBytes 出口流量
  • @apiSuccess (200) {String} rows.startAt 开始时间
  • @apiSuccess (200) {Number} rows.onlines 在线人数

func (*APIHandler) RecordFiles

func (h *APIHandler) RecordFiles(c *gin.Context)

*

  • @api {get} /api/v1/record/files 获取所有录像文件
  • @apiGroup record
  • @apiName RecordFiles
  • @apiParam {Number} folder 录像文件所在的文件夹
  • @apiParam {Number} [start] 分页开始,从零开始
  • @apiParam {Number} [limit] 分页大小
  • @apiParam {String} sort 排序字段
  • @apiParam {String=ascending,descending} [order] 排序顺序
  • @apiParam {String} [q] 查询参数
  • @apiSuccess (200) {Number} total 总数
  • @apiSuccess (200) {Array} rows 文件列表
  • @apiSuccess (200) {String} rows.duration 格式化好的录像时长
  • @apiSuccess (200) {Number} rows.durationMillis 录像时长,毫秒为单位
  • @apiSuccess (200) {String} rows.path 录像文件的相对路径,录像文件为m3u8格式,将其放到video标签中便可直接播放。其绝对路径为:http[s]://host:port/record/path

func (*APIHandler) RecordFolders

func (h *APIHandler) RecordFolders(c *gin.Context)

*

  • @api {get} /api/v1/record/folders 获取所有录像文件夹
  • @apiGroup record
  • @apiName RecordFolders
  • @apiParam {Number} [start] 分页开始,从零开始
  • @apiParam {Number} [limit] 分页大小
  • @apiParam {String} sort 排序字段
  • @apiParam {String=ascending,descending} [order] 排序顺序
  • @apiParam {String} [q] 查询参数
  • @apiSuccess (200) {Number} total 总数
  • @apiSuccess (200) {Array} rows 文件夹列表
  • @apiSuccess (200) {String} rows.folder 录像文件夹名称

func (*APIHandler) Restart

func (h *APIHandler) Restart(c *gin.Context)

*

  • @api {get} /restart 重启服务
  • @apiGroup sys
  • @apiName Restart
  • @apiUse simpleSuccess

func (*APIHandler) StreamStart

func (h *APIHandler) StreamStart(c *gin.Context)

StreamStart *

  • @api {get} /api/v1/stream/start 启动拉转推
  • @apiGroup stream
  • @apiName StreamStart
  • @apiParam {String} url RTSP源地址
  • @apiParam {String} [customPath] 转推时的推送PATH
  • @apiParam {String} [udpHostPort] 转推时的推送UDP的主机和端口,中间以冒号间隔
  • @apiParam {String=TCP,UDP} [transType=TCP] 拉流传输模式
  • @apiParam {Number} [idleTimeout] 拉流时的超时时间
  • @apiParam {Number} [heartbeatInterval] 拉流时的心跳间隔,毫秒为单位。如果心跳间隔不为0,那拉流时会向源地址以该间隔发送OPTION请求用来心跳保活
  • @apiSuccess (200) {String} ID 拉流的ID。后续可以通过该ID来停止拉流

func (*APIHandler) StreamStop

func (h *APIHandler) StreamStop(c *gin.Context)

StreamStop *

  • @api {get} /api/v1/stream/stop 停止推流
  • @apiGroup stream
  • @apiName StreamStop
  • @apiParam {String} id 拉流的ID
  • @apiUse simpleSuccess

func (*APIHandler) UserInfo

func (h *APIHandler) UserInfo(c *gin.Context)

*

  • @api {get} /userinfo 获取当前登录用户信息
  • @apiGroup sys
  • @apiName UserInfo
  • @apiUse userInfo

type AlarmEvent added in v1.0.3

type AlarmEvent struct {
	AlarmId      string `json:"alarmId" binding:"required"`
	DeviceSerial string `json:"deviceSerial"`
	ChannelNo    int    `json:"channelNo"`
	AlarmTime    int    `json:"alarmTime"`
	AlarmType    int    `json:"alarmType"`
	RecState     int    `json:"recState"`
	Jpg          string `json:"jpg"`
}

type CountData

type CountData struct {
	Time  utils.DateTime `json:"time"`
	Total uint           `json:"总数"`
}

type DiskData

type DiskData struct {
	Disk  string `json:"disk"`
	Total uint64 `json:"total"`
	Used  uint64 `json:"used"`
}

type PercentData

type PercentData struct {
	Time utils.DateTime `json:"time"`
	Used float64        `json:"使用"`
}

type StreamStartRequest

type StreamStartRequest struct {
	URL               string `form:"url" binding:"required"`
	CustomPath        string `form:"customPath"`
	UdpHostPort       string `form:"udpHostPort"`
	TransType         string `form:"transType"`
	IdleTimeout       int    `form:"idleTimeout"`
	HeartbeatInterval int    `form:"heartbeatInterval"`
}

type StreamStopRequest

type StreamStopRequest struct {
	ID string `form:"id" binding:"required"`
}

Jump to

Keyboard shortcuts

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