anacrolix / dms

A UPnP DLNA Digital Media Server that includes basic video transcoding. Tested on a Panasonic Viera television, several Android UPnP apps, and Chromecast.
BSD 3-Clause "New" or "Revised" License
637 stars 97 forks source link

[feat](ssdp): Add ip filter callback holder #96

Closed YanceyChiew closed 2 years ago

YanceyChiew commented 2 years ago

Currently ssdp will announce all available ip addresses on the interface, which may not be what the dlna service actually wants.

The dlna service might not be listening on those addresses at all, which would mislead clients trying to establish a connection.

This commit allows to use a callback function to filter the ip addresses discovered by ssdp to decide whether to use.

anacrolix commented 2 years ago

Do you have your own project that makes use of the new field? IPFilter or IpFilter might be more idiomatic field names. Also note there's no enclosing parentheses for if conditions in Go, and to run go fmt on this.

YanceyChiew commented 2 years ago

Do you have your own project that makes use of the new field?

No, I don't own such a project, but one of the software I'm using (ps. rclone) depends on anacrolix/dms. Since the announced ip may contain non-LAN addresses, it may be a security risk for DMS. If the DMS only listens on LAN addresses, some of the announced but not actually listened IPs may have a negative impact. After all, in this case, we can't expect all DMCs to be able to find an accessable IP from those announced by DMS.

So I want to make some improvements to the software mentioned above to allow ssdp to announce only those addresses that DMS listens on, but if I want to achieve such a function. I need the support of it's upstream anacrolix/dms first. Also, I think it might be a common need to filter out unwanted ip's from announcements.

IPFilter or IpFilter might be more idiomatic field names. Also note there's no enclosing parentheses for if conditions in Go, and to run go fmt on this.

Thanks for the pointers, I'll fix them.

anacrolix commented 2 years ago

Good luck!