Windows Server Forum / Windows Media Server / December 2008
Windows Media Publishing point with geolocation
|
|
Thread rating:  |
Gator767 - 27 Nov 2008 03:30 GMT Hi , this is my first post and maybe somebody can help me with this question. we are starting a video streaming channel, but we have the copyright or the righs to broadcast the videos only for a certain country. So im looking how to block the publishing point with some kind of geolocation database or allow only ranges for the allowed country and block the others.
i was thinking in use some kind of gelocation script for the website wich the streaming would be broadcasting, but that is not useful if somebody copies the direct url of the broadcast, and start spreading, i will lose the block because the people could access directly and not via the website.
i was checking the wms ip authorization plugin, but i dont know how to add ranges of ip. and i dont know the subnet masks of each range for my country, so in that way would be very difficult to use it.
but maybe somebody here can give me and advise. and sorry for my bad english
thanks in advance.
best regards.
Gabriel.
Neil Smith [MVP Digital Media] - 27 Nov 2008 21:39 GMT >Hi , this is my first post and maybe somebody can help me with this question. >we are starting a video streaming channel, but we have the copyright or the [quoted text clipped - 12 lines] > >but maybe somebody here can give me and advise. and sorry for my bad english We've used the HostIP lookup before http://www.hostip.info/ which you're encouraged to grab the database monthly using rsync and parse it into the database format you use there.
They offer CSV, Postgres and MySQL downloads, though I've converted to SQLite for our application. You might use SQL Server for example, by parsing the CSV files in an an application update scheduled monthly - the IP blocks only change location very rarely.
The data quality is more than adequate for your intended use.
Rsync is used to minimise the load on their freely provided data sources (as well as your own download time and network resources), and ensures only modifed data is copied after the initial sync.
If you choose to use their web API, please be sure to contribute a cash donation appropriate to your usage level.
Maxmind offer a "lite" open source version of their database, which includes a C# class you could modify : see
http://www.maxmind.com/app/api and http://www.maxmind.com/app/geoip_country
The data has been more closely verified from alternate sources and is appropriate for geolocation where it really matters.
In both cases what you're likely to have is an IP address lookup from A.B.C.D which does primary lookup on a table referenced to IP.A, and which contains rows with the B.C component.
Localisation is unnecessary to the D component of the IP address.
I preferred the A table structure (256 tables ip_0, ip_1, ...) because in MySQL case, it will load the table into memory on first use. This data will be cached into the user session, and won't be accessed frequently once the user has connected, so more but smaller tables are more efficient for MySQL.
Other table structures might be a single large table, depending on which is best handled by your database, and contains indexes on rows for A.B or A.B.C parts of the address.
Typical data size can be from 250-500MB on disk. For transport or distribition, this can usually be 7-zipped to around 25-30MB.
HTH Cheers - Neil ------------------------------------------------ Digital Media MVP : 2004-2008 http://mvp.support.microsoft.com/mvpfaqs
Gator767 - 27 Nov 2008 22:47 GMT Hi Neil, thanks for your answer, i checked the site of geolite database, and i can use the PHP API to block unwanted countries for the website and, use the range of ips for allowing only one country on the windows media. so would be double protection, and of course i will donate to that project.
thanks again for your answer, i will work in the case tonight.. to make some tests..
by the way, is there any form to add ranges of ip con WMS using the IP plugin?
best regards..
Gabriel.
Neil Smith [MVP Digital Media] - 27 Nov 2008 23:15 GMT You wouldn't need to lookup the range, just get the user IP, lookup A.B.C to country in the DB, and determine if that's allowed or not.
HTH Cheers - Neil
>Hi Neil, thanks for your answer, i checked the site of geolite database, and >i can use the PHP API to block unwanted countries for the website and, use [quoted text clipped - 9 lines] > >Gabriel. ------------------------------------------------ Digital Media MVP : 2004-2008 http://mvp.support.microsoft.com/mvpfaqs
Gator767 - 27 Nov 2008 23:22 GMT let me try to understand, if i use the WMS IP Control Plugin.. can i add only for example
192.168.100.0 or add only 192.168.100 (to catch the whole range?)
regards
Gabriel
>You wouldn't need to lookup the range, just get the user IP, lookup >A.B.C to country in the DB, and determine if that's allowed or not. [quoted text clipped - 11 lines] >Digital Media MVP : 2004-2008 >http://mvp.support.microsoft.com/mvpfaqs Neil Smith [MVP Digital Media] - 29 Nov 2008 18:44 GMT For each request, lookup the individual IP address, not the block. You only need to lookup the A.B.C portion, not the .D portion.
It is *not* a safe assumption that IP address ranges are in blocks of 256 class C addresses per country, but it's generally safe that the last octet is within a particular country - which is why the DB does not contain the .D element of the IP address.
The Hilbert curve shown as a comic on the XKCD site is a good representation of IP fragmentation by country / region and organisation : http://xkcd.com/195/ (also a good time waster browsing other comic pages too !)
As a concrete example with real IP addresses, you might find foir netblock 205.x.x.x : rough back of an envelope
SELECT IP1.*, IP2.* FROM ip4_205 AS IP1 LEFT JOIN ip4_205 AS IP2 WHERE IP1.b = IP2.b AND (IP1.c + 1) = IP2.c AND IP1.country != IP2.country LIMIT 10;
205.68.69.x USA 205.68.70.x Italy 205.105.104.x USA 205.105.105.x Canada 205.124.111.x USA 205.124.112 France
non USA examples :
SELECT IP1.*, IP2.* FROM ip4_205 AS IP1 LEFT JOIN ip4_205 AS IP2 WHERE IP1.b = IP2.b AND (IP1.c + 1) = IP2.c AND IP1.country != IP2.country AND IP1.country != 226 AND IP2.country != 226 LIMIT 10;
205.188.9.x Australia 205.188.10.x Germany 205.211.9.x Bermuda 205.211.71.x Canada 205.211.72.x Syria 205.211.73.x Canada
So your problem just resoves to a single lookup per visitor, and then get the country code (ID number, ISO country code etc) and check if it's on your "Allow" list of country codes.
As I said before, cache the visitors country code in their web session, as you know they're unlilkely to change countries while viewing your site.
HTH Cheers - Neil
>let me try to understand, if i use the WMS IP Control Plugin.. >can i add only for example [quoted text clipped - 20 lines] >>Digital Media MVP : 2004-2008 >>http://mvp.support.microsoft.com/mvpfaqs ------------------------------------------------ Digital Media MVP : 2004-2008 http://mvp.support.microsoft.com/mvpfaqs
Gator767 - 02 Dec 2008 21:51 GMT Thank you very much Neil, your help is very useful!!
regards.
Gabriel.
>For each request, lookup the individual IP address, not the block. >You only need to lookup the A.B.C portion, not the .D portion. [quoted text clipped - 59 lines] >Digital Media MVP : 2004-2008 >http://mvp.support.microsoft.com/mvpfaqs Vladimir Polischuk - 03 Dec 2008 22:56 GMT Hi,
You can develop a WMS authorization plug-in to authorize users basing on their IP address. Also it is possible to use a ready made solution - http://voynex.com/wmsbilling. In case of WMS authrorization plug-in you will not need to add the whole range of IP to WMS IP Authorization plug-in. A single validation request will be sent to the GEO IP DB. Regards,
Vladimir V. Polischuk IT Manager www.voynex.com - custom software development, solutions for Windows Media (pay-per-minute billing, streaming content protection, access control)
> Hi , this is my first post and maybe somebody can help me with this > question. [quoted text clipped - 26 lines] > > Gabriel.
|
|
|