SRS2.0 HTTP-FLV, can it also forward the client IP?
zywu31 opened this issue · comments
SRS2.0 HTTP-FLV, can it also forward the client IP?
RTMP requests have the client's requested IP,
but FLV does not.
RTMP
{"action":"on_play","client_id":116,"ip":"172.17.0.1","vhost":"defaultVhost","app":"live","stream":"livestream","param":"?token=123&salt=456","pageUrl":""}
FLV
{"action":"on_play","client_id":113,"ip":"","vhost":"defaultVhost","app":"live","stream":"livestream","param":"?token=123&salt=456","pageUrl":""}
TRANS_BY_GPT3
When playing HTTP, there is no on_connect, only on_play, and on_play does not have an IP.
(gdb) p *req
$2 = {_vptr.SrsRequest = 0x95b3d0 <vtable for SrsRequest+16>, ip = "", tcUrl = "rtmp://__defaultVhost__/live", pageUrl = "", swfUrl = "",
objectEncoding = 0, schema = "http", vhost = "__defaultVhost__", host = "__defaultVhost__", port = "1935", app = "live", param = "",
stream = "livestream", duration = -1, args = 0x0}
(gdb) bt
#0 SrsHttpHooks::on_play (url="http://127.0.0.1:8085/api/v1/sessions", req=0x9e7db0) at src/app/srs_app_http_hooks.cpp:199
#1 0x000000000049eb52 in SrsLiveStream::http_hooks_on_play (this=0x9a78a0, r=0x9e59f0) at src/app/srs_app_http_stream.cpp:671
#2 0x000000000049d6ae in SrsLiveStream::serve_http (this=0x9a78a0, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_stream.cpp:484
#3 0x000000000045c4e3 in SrsHttpServeMux::serve_http (this=0x97e540, w=0x7ffff7f03b90, r=0x9e59f0) at src/protocol/srs_http_stack.cpp:661
#4 0x00000000004e0898 in SrsHttpServer::serve_http (this=0x97e500, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_conn.cpp:1384
#5 0x00000000004dff53 in SrsHttpConn::process_request (this=0x9c55c0, w=0x7ffff7f03b90, r=0x9e59f0) at src/app/srs_app_http_conn.cpp:1296
#6 0x00000000004dfd09 in SrsHttpConn::do_cycle (this=0x9c55c0) at src/app/srs_app_http_conn.cpp:1274
#7 0x0000000000471929 in SrsConnection::cycle (this=0x9c55c0) at src/app/srs_app_conn.cpp:89
TRANS_BY_GPT3
When converting an HTTP Request to SrsRequest, the IP information is lost and cannot be recovered.
[2019-12-26 02:30:41][trace] srs on_play: client id=113, ip=172.17.0.1, vhost=__defaultVhost__, app=live, stream=livestream, pageUrl=
127.0.0.1 - - [26/Dec/2019:02:30:41] "POST /api/v1/sessions HTTP/1.1" 200 1 "" "SRS(Simple RTMP Server)2.0.268"
Directly accessing HTTP-FLV already provides IP information, but we also need to consider the scenario of accessing through an HTTP proxy.
TRANS_BY_GPT3
SRS2, HTTP direct access, and proxy are all supported.
TRANS_BY_GPT3
SRS3 is also supported.
TRANS_BY_GPT3