winlin

refine wiki, cluster to forward.

@@ -151,7 +151,7 @@ Supported operating systems and hardware: @@ -151,7 +151,7 @@ Supported operating systems and hardware:
151 1. Support listen at multiple ports. 151 1. Support listen at multiple ports.
152 1. Support long time(>4.6hours) publish/play. 152 1. Support long time(>4.6hours) publish/play.
153 1. High performace, 1800 connections(500kbps), 900Mbps, CPU 90.2%, 41MB 153 1. High performace, 1800 connections(500kbps), 900Mbps, CPU 90.2%, 41MB
154 -1. Support forward publish stream to build active-standby [cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster). 154 +1. Support forward publish stream to build active-standby [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/Forward).
155 1. Support broadcast by forward the stream to other servers(origin/edge). 155 1. Support broadcast by forward the stream to other servers(origin/edge).
156 1. Support live stream transcoding by ffmpeg. 156 1. Support live stream transcoding by ffmpeg.
157 1. Support live stream forward(acopy/vcopy) by ffmpeg. 157 1. Support live stream forward(acopy/vcopy) by ffmpeg.
@@ -199,7 +199,7 @@ Supported operating systems and hardware: @@ -199,7 +199,7 @@ Supported operating systems and hardware:
199 * 2013-12-25, [Release v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9), support bandwidth test, player/encoder/chat [demos](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo). 20926 lines.<br/> 199 * 2013-12-25, [Release v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9), support bandwidth test, player/encoder/chat [demos](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo). 20926 lines.<br/>
200 * 2013-12-08, [Release v0.8](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.8), support [http hooks callback](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback), update [st_load](https://github.com/winlinvip/st-load). 19186 lines.<br/> 200 * 2013-12-08, [Release v0.8](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.8), support [http hooks callback](https://github.com/winlinvip/simple-rtmp-server/wiki/HTTPCallback), update [st_load](https://github.com/winlinvip/st-load). 19186 lines.<br/>
201 * 2013-12-03, [Release v0.7](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.7), support [live stream transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG). 17605 lines.<br/> 201 * 2013-12-03, [Release v0.7](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.7), support [live stream transcoding](https://github.com/winlinvip/simple-rtmp-server/wiki/FFMPEG). 17605 lines.<br/>
202 -* 2013-11-29, [Release v0.6](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.6), support [forward](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster) stream to origin/edge. 16094 lines.<br/> 202 +* 2013-11-29, [Release v0.6](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.6), support [forward](https://github.com/winlinvip/simple-rtmp-server/wiki/Forward) stream to origin/edge. 16094 lines.<br/>
203 * 2013-11-26, [Release v0.5](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.5), support [HLS(m3u8)](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS), fragment and window. 14449 lines.<br/> 203 * 2013-11-26, [Release v0.5](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.5), support [HLS(m3u8)](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS), fragment and window. 14449 lines.<br/>
204 * 2013-11-10, [Release v0.4](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.4), support [reload](https://github.com/winlinvip/simple-rtmp-server/wiki/Reload) config, pause, longtime publish/play. 12500 lines.<br/> 204 * 2013-11-10, [Release v0.4](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.4), support [reload](https://github.com/winlinvip/simple-rtmp-server/wiki/Reload) config, pause, longtime publish/play. 12500 lines.<br/>
205 * 2013-11-04, [Release v0.3](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.3), support [vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/RtmpUrlVhost), refer, gop cache, listen multiple ports. 11773 lines.<br/> 205 * 2013-11-04, [Release v0.3](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.3), support [vhost](https://github.com/winlinvip/simple-rtmp-server/wiki/RtmpUrlVhost), refer, gop cache, listen multiple ports. 11773 lines.<br/>
@@ -310,7 +310,7 @@ Supported operating systems and hardware: @@ -310,7 +310,7 @@ Supported operating systems and hardware:
310 * v1.0, 2014-01-19, add wiki [DeliveryHLS](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS) 310 * v1.0, 2014-01-19, add wiki [DeliveryHLS](https://github.com/winlinvip/simple-rtmp-server/wiki/DeliveryHLS)
311 * v1.0, 2014-01-12, add wiki [HowToAskQuestion](https://github.com/winlinvip/simple-rtmp-server/wiki/HowToAskQuestion), [RtmpUrlVhost](https://github.com/winlinvip/simple-rtmp-server/wiki/RtmpUrlVhost) 311 * v1.0, 2014-01-12, add wiki [HowToAskQuestion](https://github.com/winlinvip/simple-rtmp-server/wiki/HowToAskQuestion), [RtmpUrlVhost](https://github.com/winlinvip/simple-rtmp-server/wiki/RtmpUrlVhost)
312 * v1.0, 2014-01-11, fix jw/flower player pause bug, which send closeStream actually. 312 * v1.0, 2014-01-11, fix jw/flower player pause bug, which send closeStream actually.
313 -* v1.0, 2014-01-05, add wiki [Build](https://github.com/winlinvip/simple-rtmp-server/wiki/Build), [Performance](https://github.com/winlinvip/simple-rtmp-server/wiki/Performance), [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster) 313 +* v1.0, 2014-01-05, add wiki [Build](https://github.com/winlinvip/simple-rtmp-server/wiki/Build), [Performance](https://github.com/winlinvip/simple-rtmp-server/wiki/Performance), [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/Forward)
314 * v1.0, 2014-01-01, change listen(512), chunk-size(60000), to improve performance. 314 * v1.0, 2014-01-01, change listen(512), chunk-size(60000), to improve performance.
315 * v1.0, 2013-12-27, merge from wenjie, the bandwidth test feature. 315 * v1.0, 2013-12-27, merge from wenjie, the bandwidth test feature.
316 * <strong>v0.9, 2013-12-25, [v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9) released. 20926 lines.</strong> 316 * <strong>v0.9, 2013-12-25, [v0.9](https://github.com/winlinvip/simple-rtmp-server/releases/tag/0.9) released. 20926 lines.</strong>
@@ -507,8 +507,8 @@ to ingest any input to rtmp, push to SRS. @@ -507,8 +507,8 @@ to ingest any input to rtmp, push to SRS.
507 507
508 ### [RTMP cluster(origin/edge) Architecture](https://github.com/winlinvip/simple-rtmp-server/wiki/Edge) 508 ### [RTMP cluster(origin/edge) Architecture](https://github.com/winlinvip/simple-rtmp-server/wiki/Edge)
509 509
510 -Remark: cluster over forward, see [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster)  
511 Remark: cluster over edge, see [Edge](https://github.com/winlinvip/simple-rtmp-server/wiki/Edge) 510 Remark: cluster over edge, see [Edge](https://github.com/winlinvip/simple-rtmp-server/wiki/Edge)
  511 +Remark: cluster over forward, see [Forward](https://github.com/winlinvip/simple-rtmp-server/wiki/Forward)
512 512
513 <pre> 513 <pre>
514 +---------+ +-----------------+ +-----------------------+ 514 +---------+ +-----------------+ +-----------------------+
@@ -993,6 +993,25 @@ string srs_get_local_ip(int fd) @@ -993,6 +993,25 @@ string srs_get_local_ip(int fd)
993 return ip; 993 return ip;
994 } 994 }
995 995
  996 +int srs_get_local_port(int fd)
  997 +{
  998 + std::string ip;
  999 +
  1000 + // discovery client information
  1001 + sockaddr_in addr;
  1002 + socklen_t addrlen = sizeof(addr);
  1003 + if (getsockname(fd, (sockaddr*)&addr, &addrlen) == -1) {
  1004 + return 0;
  1005 + }
  1006 + srs_verbose("get local ip success.");
  1007 +
  1008 + int port = ntohs(addr.sin_port);
  1009 +
  1010 + srs_verbose("get local ip of client port=%s, fd=%d", port, fd);
  1011 +
  1012 + return port;
  1013 +}
  1014 +
996 string srs_get_peer_ip(int fd) 1015 string srs_get_peer_ip(int fd)
997 { 1016 {
998 std::string ip; 1017 std::string ip;
@@ -619,12 +619,14 @@ extern std::vector<std::string>& srs_get_local_ipv4_ips(); @@ -619,12 +619,14 @@ extern std::vector<std::string>& srs_get_local_ipv4_ips();
619 619
620 // get local or peer ip. 620 // get local or peer ip.
621 // where local ip is the server ip which client connected. 621 // where local ip is the server ip which client connected.
622 -std::string srs_get_local_ip(int fd); 622 +extern std::string srs_get_local_ip(int fd);
  623 +// get the local id port.
  624 +extern int srs_get_local_port(int fd);
623 // where peer ip is the client public ip which connected to server. 625 // where peer ip is the client public ip which connected to server.
624 -std::string srs_get_peer_ip(int fd); 626 +extern std::string srs_get_peer_ip(int fd);
625 627
626 // dump summaries for /api/v1/summaries. 628 // dump summaries for /api/v1/summaries.
627 -void srs_api_dump_summaries(std::stringstream& ss); 629 +extern void srs_api_dump_summaries(std::stringstream& ss);
628 630
629 #endif 631 #endif
630 632