routers

package
v0.0.0-...-a79bcea Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var API = &APIHandler{
	RestartChan: make(chan bool),
}
View Source
var Assets = assets.NewFileSystem(map[string][]string{"/": []string{"www"}, "/www": []string{"crossdomain.xml", "easy-player-fluent.swf", "easy-player.swf", "favicon.ico", "index.html", "login.html"}, "/www/css": []string{"index.935d0838.css", "login.79cfbee2.css"}, "/www/fonts": []string{"element-icons.6f0a7632.ttf", "fontawesome-webfont.674f50d2.eot", "fontawesome-webfont.af7ae505.woff2", "fontawesome-webfont.b06871f2.ttf", "fontawesome-webfont.fee66e71.woff", "glyphicons-halflings-regular.448c34a5.woff2", "glyphicons-halflings-regular.e18bbf61.ttf", "glyphicons-halflings-regular.f4769f9b.eot", "glyphicons-halflings-regular.fa277232.woff"}, "/www/images": []string{"boxed-bg.7799dece.jpg", "fontawesome-webfont.912ec66d.svg", "glyphicons-halflings-regular.89889688.svg"}, "/www/js": []string{"about.97dd1715.js", "dashboard.2de97932.js", "easy-player-lib.min.js", "index.935d0838.js", "jquery-2.2.4.js", "login.79cfbee2.js", "players.b73c4f33.js", "pushers.ece78655.js", "user.e953adc6.js"}}, map[string]*assets.File{
	"/www/js/about.97dd1715.js": &assets.File{
		Path:     "/www/js/about.97dd1715.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assets6d82c218153533fa5cc858d00d438a753c8bc3a6),
	}, "/www/js/login.79cfbee2.js": &assets.File{
		Path:     "/www/js/login.79cfbee2.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258665837200),
		Data:     []byte(_Assets97a0e4e04947679057c2ad77f7a75b1c2a86bf53),
	}, "/www/fonts/fontawesome-webfont.af7ae505.woff2": &assets.File{
		Path:     "/www/fonts/fontawesome-webfont.af7ae505.woff2",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets95da8d7b3c37797c4ca2c9dc5e9362d93676ce4a),
	}, "/www/images": &assets.File{
		Path:     "/www/images",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258601837600),
		Data:     nil,
	}, "/www/fonts/glyphicons-halflings-regular.f4769f9b.eot": &assets.File{
		Path:     "/www/fonts/glyphicons-halflings-regular.f4769f9b.eot",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets9261b1965bfbae412c509ff4e8cb9cbbb79879f1),
	}, "/www/fonts/glyphicons-halflings-regular.fa277232.woff": &assets.File{
		Path:     "/www/fonts/glyphicons-halflings-regular.fa277232.woff",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets8f365249225caa003999d079715f0006a6bbe55d),
	}, "/www": &assets.File{
		Path:     "/www",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258601837600),
		Data:     nil,
	}, "/www/fonts/fontawesome-webfont.b06871f2.ttf": &assets.File{
		Path:     "/www/fonts/fontawesome-webfont.b06871f2.ttf",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assets86bd2ceca6e32d26ce5ea37fce51083faa6efb8a),
	}, "/www/js": &assets.File{
		Path:     "/www/js",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258604863600),
		Data:     nil,
	}, "/www/js/players.b73c4f33.js": &assets.File{
		Path:     "/www/js/players.b73c4f33.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets068d306999547b90692dcf1fad4f6e055f438808),
	}, "/www/login.html": &assets.File{
		Path:     "/www/login.html",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assets7d0b85a40f0d27668c043e081b767528c0dc11fe),
	}, "/www/css": &assets.File{
		Path:     "/www/css",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258599840400),
		Data:     nil,
	}, "/www/fonts": &assets.File{
		Path:     "/www/fonts",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258601837600),
		Data:     nil,
	}, "/www/images/glyphicons-halflings-regular.89889688.svg": &assets.File{
		Path:     "/www/images/glyphicons-halflings-regular.89889688.svg",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258659836900),
		Data:     []byte(_Assets16c8089657c047850b983734c2e6578d59b8f51f),
	}, "/www/js/easy-player-lib.min.js": &assets.File{
		Path:     "/www/js/easy-player-lib.min.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258669837900),
		Data:     []byte(_Assets7e0c7ae7eb3b8e2994f8d9dc69633b2e5c1324cc),
	}, "/www/js/index.935d0838.js": &assets.File{
		Path:     "/www/js/index.935d0838.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258665837200),
		Data:     []byte(_Assets651a210fd1cb7164aaa86b2941793d38c379846b),
	}, "/www/fonts/fontawesome-webfont.fee66e71.woff": &assets.File{
		Path:     "/www/fonts/fontawesome-webfont.fee66e71.woff",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258659836900),
		Data:     []byte(_Assets8929516ed707907e9f7a24a0c150afed7e193b69),
	}, "/www/images/fontawesome-webfont.912ec66d.svg": &assets.File{
		Path:     "/www/images/fontawesome-webfont.912ec66d.svg",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assetse3e49959195a486c397f7c52f5dba419ea5e5352),
	}, "/www/easy-player-fluent.swf": &assets.File{
		Path:     "/www/easy-player-fluent.swf",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assets406d488cee3831288d792ee4e8ef4abe0f631651),
	}, "/www/fonts/fontawesome-webfont.674f50d2.eot": &assets.File{
		Path:     "/www/fonts/fontawesome-webfont.674f50d2.eot",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets7c53e1990a362421c4ac18044cad7ee40293d325),
	}, "/www/fonts/glyphicons-halflings-regular.e18bbf61.ttf": &assets.File{
		Path:     "/www/fonts/glyphicons-halflings-regular.e18bbf61.ttf",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assets2467f73f7dc6bccbcdaeb3f33bbd2505f600e828),
	}, "/www/images/boxed-bg.7799dece.jpg": &assets.File{
		Path:     "/www/images/boxed-bg.7799dece.jpg",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets305284a61e61957d57efa0fc4039295eee4bfb80),
	}, "/www/crossdomain.xml": &assets.File{
		Path:     "/www/crossdomain.xml",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assetsc63e1850861a7866efdc22e5d4577adfa14060e7),
	}, "/www/css/index.935d0838.css": &assets.File{
		Path:     "/www/css/index.935d0838.css",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258646847500),
		Data:     []byte(_Assetseea1ab01262b36e8c15c760fc39d49c42cc8ad6f),
	}, "/www/fonts/glyphicons-halflings-regular.448c34a5.woff2": &assets.File{
		Path:     "/www/fonts/glyphicons-halflings-regular.448c34a5.woff2",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258660839400),
		Data:     []byte(_Assets5d7e3699e8e68a62a2d0452bd1824f7436a93931),
	}, "/www/js/jquery-2.2.4.js": &assets.File{
		Path:     "/www/js/jquery-2.2.4.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258670836800),
		Data:     []byte(_Assetsd637b59f6fa2529557ad275528afa81bd2232593),
	}, "/www/js/user.e953adc6.js": &assets.File{
		Path:     "/www/js/user.e953adc6.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assetsaaaf7497d7ab9ac5ae522b38ea59cadb9233b831),
	}, "/www/easy-player.swf": &assets.File{
		Path:     "/www/easy-player.swf",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assets629f5eeb584d58d201686fc773187035499e55f4),
	}, "/www/fonts/element-icons.6f0a7632.ttf": &assets.File{
		Path:     "/www/fonts/element-icons.6f0a7632.ttf",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assets67e84a8b8b2c8c20f6e7923c600024f17ea54c92),
	}, "/www/js/dashboard.2de97932.js": &assets.File{
		Path:     "/www/js/dashboard.2de97932.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258608838700),
		Data:     []byte(_Assets80f7112dea94b5b1f2ce726ddf7c5e118e0ab886),
	}, "/www/js/pushers.ece78655.js": &assets.File{
		Path:     "/www/js/pushers.ece78655.js",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assetsa74e435dc26e11db44c2408fc47b4f8daa8afdbb),
	}, "/www/css/login.79cfbee2.css": &assets.File{
		Path:     "/www/css/login.79cfbee2.css",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258664837300),
		Data:     []byte(_Assets2a0586cc91f5372c3d3ffd4265204cd3178d8126),
	}, "/www/index.html": &assets.File{
		Path:     "/www/index.html",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assetsa7c85ea9e5e12b41e1b2f6f80dab980b7fe9cd2f),
	}, "/": &assets.File{
		Path:     "/",
		FileMode: 0x800001ff,
		Mtime:    time.Unix(1599904258, 1599904258598838000),
		Data:     nil,
	}, "/www/favicon.ico": &assets.File{
		Path:     "/www/favicon.ico",
		FileMode: 0x1b6,
		Mtime:    time.Unix(1599904258, 1599904258607837400),
		Data:     []byte(_Assetsc5bd643c44958dbe393c0353d519b9494a0ce060),
	}}, "")

Assets returns go-assets FileSystem

View Source
var BuildDateTime = ""
View Source
var BuildVersion = "v9.0"
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

NeedLogin 登录认证

Types

type APIHandler

type APIHandler struct {
	RestartChan chan bool
}

func (*APIHandler) DefaultLoginInfo

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

func (*APIHandler) GetServerInfo

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

*

  • @api {get} /api/v1/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} /api/v1/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} /api/v1/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.streamId
  • @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} /api/v1/restart 重启服务
  • @apiGroup sys
  • @apiName Restart
  • @apiUse simpleSuccess

func (*APIHandler) StreamAdd

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

*

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

func (*APIHandler) StreamDel

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

*

  • @api {get} /api/v1/stream/del 删除推流
  • @apiGroup stream
  • @apiName StreamDel
  • @apiParam {String} id 拉流的ID
  • @apiUse simpleSuccess

func (*APIHandler) StreamStart

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

*

  • @api {get} /api/v1/stream/start 启动推流
  • @apiGroup stream
  • @apiName StreamStart
  • @apiParam {String} id 拉流的ID
  • @apiUse simpleSuccess

func (*APIHandler) StreamStartAll

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

*

  • @api {post} /api/v1/stream/startAll 批量启动推流
  • @apiGroup stream
  • @apiName StreamStartAll
  • @apiParam {String} ids 拉流的IDs
  • @apiUse simpleSuccess

func (*APIHandler) StreamStop

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

*

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

func (*APIHandler) StreamStopAll

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

*

  • @api {post} /api/v1/stream/stopAll 批量停止推流
  • @apiGroup stream
  • @apiName StreamStop
  • @apiParam {String} ids 拉流的IDs
  • @apiUse simpleSuccess

func (*APIHandler) UserInfo

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

*

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

type CountData

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

type DiskData

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

type PercentData

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

Jump to

Keyboard shortcuts

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