正在显示
1 个修改的文件
包含
16 行增加
和
1 行删除
| @@ -449,6 +449,7 @@ class CdnNode: | @@ -449,6 +449,7 @@ class CdnNode: | ||
| 449 | data["heartbeat"] = self.heartbeat | 449 | data["heartbeat"] = self.heartbeat |
| 450 | data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat)) | 450 | data["heartbeat_h"] = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(self.heartbeat)) |
| 451 | data["clients"] = self.clients | 451 | data["clients"] = self.clients |
| 452 | + data["summaries"] = "http://%s:1985/api/v1/summaries"%(self.ip) | ||
| 452 | return data | 453 | return data |
| 453 | 454 | ||
| 454 | ''' | 455 | ''' |
| @@ -481,7 +482,7 @@ class RESTNodes(object): | @@ -481,7 +482,7 @@ class RESTNodes(object): | ||
| 481 | for node in self.__nodes: | 482 | for node in self.__nodes: |
| 482 | if node.id == target_node.id: | 483 | if node.id == target_node.id: |
| 483 | continue | 484 | continue |
| 484 | - if node.public_ip == target_node.public_ip: | 485 | + if node.public_ip == target_node.public_ip and node.srs_status == "running": |
| 485 | peers.append(node) | 486 | peers.append(node) |
| 486 | return peers | 487 | return peers |
| 487 | 488 | ||
| @@ -537,6 +538,19 @@ class RESTNodes(object): | @@ -537,6 +538,19 @@ class RESTNodes(object): | ||
| 537 | #return html | 538 | #return html |
| 538 | raise cherrypy.HTTPRedirect(html) | 539 | raise cherrypy.HTTPRedirect(html) |
| 539 | return rtmp_url | 540 | return rtmp_url |
| 541 | + elif type == "gslb": | ||
| 542 | + return json.dumps({"code":Error.success, "data": { | ||
| 543 | + "edge":server, "client":ip, | ||
| 544 | + "peers":self.__json_dump_nodes(peers), | ||
| 545 | + "streams": { | ||
| 546 | + "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", | ||
| 547 | + "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", | ||
| 548 | + "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", | ||
| 549 | + "hls-livestream-html": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream", | ||
| 550 | + "hls-livestream-m3u8": "http://demo.chnvideo.com:8085/api/v1/nodes?type=hls&format=m3u8&origin=demo.chnvideo.com&port=8080&stream=live/livestream", | ||
| 551 | + "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" | ||
| 552 | + } | ||
| 553 | + }}) | ||
| 540 | 554 | ||
| 541 | return json.dumps({"code":Error.success, "data": data}) | 555 | return json.dumps({"code":Error.success, "data": data}) |
| 542 | 556 | ||
| @@ -778,6 +792,7 @@ class V1(object): | @@ -778,6 +792,7 @@ class V1(object): | ||
| 778 | "summary": "for srs cdn node", | 792 | "summary": "for srs cdn node", |
| 779 | "POST ip=node_ip&os=node_os": "register a new node", | 793 | "POST ip=node_ip&os=node_os": "register a new node", |
| 780 | "GET": "get the active edge nodes", | 794 | "GET": "get the active edge nodes", |
| 795 | + "GET type=gslb&origin=demo.chnvideo.com": "get the gslb edge ip", | ||
| 781 | "GET type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream": "get the play url, html for hls", | 796 | "GET type=hls&format=html&origin=demo.chnvideo.com&port=8080&stream=live/livestream": "get the play url, html for hls", |
| 782 | "GET type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream": "get the play url, for rtmp" | 797 | "GET type=rtmp&format=html&origin=demo.chnvideo.com&vhost=demo.srs.com&port=1935&stream=live/livestream": "get the play url, for rtmp" |
| 783 | }, | 798 | }, |
-
请 注册 或 登录 后发表评论