QuantumEntangledAndy / neolink

An RTSP bridge to Reolink IP cameras
GNU Affero General Public License v3.0
330 stars 45 forks source link

Map Discovery not working for Reolink TrackMix LTE Plus #197

Closed BBX999 closed 5 months ago

BBX999 commented 10 months ago

Thanks for your great work on this @QuantumEntangledAndy !

I wasn't sure whether this should be reported as a bug or a feature request, but since "cellular" discovery mode is supposed to use map/relay, it seems implied that map mode should work with cellular cameras. My problem is that while relay discovery works, map discovery does not. Why does it matter? Well, the relay mode stream is choppy and delayed by almost a minute.

Since using the Reolink desktop client on my computer works without any lag, I presume such is possible via neolink. I also presume that the lag is due to using a relay connection instead of a direct connection to the camera, and that the reolink desktop client is not lagged due to it establishing a direct connection between my computer and the camera (or perhaps the desktop client is able to find a relay server in a better location?).

I initially tried using the docker image, but then wanted to eliminate networking concerns between my host and the docker container (I'm running macOS). I then installed it natively, and exposed my computer to the internet (all ports) to make sure this was not a firewall / port forwarding issue.

Any thoughts on how I might be able to troubleshoot further or whether this might be a current limitation in how map discovery currently works with respect to cellular cameras?

Thanks!

BBX999 commented 9 months ago

I think I've found a clue here when I enabled debugging logs:

[2023-12-12T17:05:24Z DEBUG neolink_core::bc_protocol::connection::discovery] Registering 192.168.33.11:53660 to reolink

How is the cellular camera supposed to connect directly to my internal IP address?

I noticed in the sample config this seems to be by design:

# "map" # Register our **local ip** address with reolink and ask the camera to connect to us but don't relay data through reolink

But it also says that map should work with cellular:

# "cellular" # Cellular camera only support Relay and **Map** to speed up connecting to them this option will skip the local/remote

So, is it possible to have map discovery register our external IP address with Reolink so that the camera can connect directly?

Perhaps this can be added as a config parameter? I have a static IP, and I'm really curious to see if that will solve my problem here, as Reolink only seems to allow 3GB per month via their relay servers, and the relay server was super laggy for me.

@QuantumEntangledAndy what do you think?

QuantumEntangledAndy commented 5 months ago

Not really worth it unless you have full port forwarding to your client. Being on 192.168.33.11 means your behind a NAT so this means you cannot connect via map. Your options are relay only, or move your client onto a public ip address

BBX999 commented 5 months ago

Thanks for the reply!

I did have full forwarding to my client I believe as it was set up as the DMZ target on my router.

Is the full port forwarding required to provide flexibility for the port negotiation between the client and camera?

Should "map" theoretically work if all ports are forwarded and the external IP is sent to reolink? I think I tried editing the source code to that effect and it still did not work. So there are either other factors or I didn't make the right changes.

Would it be complicated to add a setting to specify the broadcast address that will be sent to Reolink to allow for using "map" when all ports are forwarded on the client?

Thanks!