mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
update cdn api server.
This commit is contained in:
parent
b85e667991
commit
b5b5202ed2
1 changed files with 16 additions and 1 deletions
|
@ -449,6 +449,7 @@ class CdnNode:
|
||||||
data["heartbeat"] = self.heartbeat
|
data["heartbeat"] = self.heartbeat
|
||||||
data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat))
|
data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat))
|
||||||
data["clients"] = self.clients
|
data["clients"] = self.clients
|
||||||
|
data["summaries"] = "http://%s:1985/api/v1/summaries"%(self.ip)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
@ -481,7 +482,7 @@ class RESTNodes(object):
|
||||||
for node in self.__nodes:
|
for node in self.__nodes:
|
||||||
if node.id == target_node.id:
|
if node.id == target_node.id:
|
||||||
continue
|
continue
|
||||||
if node.public_ip == target_node.public_ip:
|
if node.public_ip == target_node.public_ip and node.srs_status == "running":
|
||||||
peers.append(node)
|
peers.append(node)
|
||||||
return peers
|
return peers
|
||||||
|
|
||||||
|
@ -537,6 +538,19 @@ class RESTNodes(object):
|
||||||
#return html
|
#return html
|
||||||
raise cherrypy.HTTPRedirect(html)
|
raise cherrypy.HTTPRedirect(html)
|
||||||
return rtmp_url
|
return rtmp_url
|
||||||
|
elif type == "gslb":
|
||||||
|
return json.dumps({"code":Error.success, "data": {
|
||||||
|
"edge":server, "client":ip,
|
||||||
|
"peers":self.__json_dump_nodes(peers),
|
||||||
|
"streams": {
|
||||||
|
"hls-cztv-html": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/rtmp_cztv01-sd",
|
||||||
|
"hls-cztv-m3u8": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=m3u8&origin=demo.chnvideo.com&port=8080&stream=live/rtmp_cztv01-sd",
|
||||||
|
"rtmp-cztv-html": "http://demo.chnvideo.com:8085/api/v1/nodes?type=rtmp&format=html&origin=demo.chnvideo.com&vhost=__defaultVhost__&port=1935&stream=live/rtmp_cztv01-sd",
|
||||||
|
"hls-livestream-html": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream",
|
||||||
|
"hls-livestream-m3u8": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=m3u8&origin=demo.chnvideo.com&port=8080&stream=live/livestream",
|
||||||
|
"rtmp-livestream-html": "http://demo.chnvideo.com:8085/api/v1/nodes?type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream"
|
||||||
|
}
|
||||||
|
}})
|
||||||
|
|
||||||
return json.dumps({"code":Error.success, "data": data})
|
return json.dumps({"code":Error.success, "data": data})
|
||||||
|
|
||||||
|
@ -778,6 +792,7 @@ class V1(object):
|
||||||
"summary": "for srs cdn node",
|
"summary": "for srs cdn node",
|
||||||
"POST ip=node_ip&os=node_os": "register a new node",
|
"POST ip=node_ip&os=node_os": "register a new node",
|
||||||
"GET": "get the active edge nodes",
|
"GET": "get the active edge nodes",
|
||||||
|
"GET type=gslb&origin=demo.chnvideo.com": "get the gslb edge ip",
|
||||||
"GET type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream": "get the play url, html for hls",
|
"GET type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream": "get the play url, html for hls",
|
||||||
"GET type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream": "get the play url, for rtmp"
|
"GET type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream": "get the play url, for rtmp"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue