| View previous topic :: View next topic |
| Author |
Message |
robertut
Joined: 31 Aug 2007 Posts: 156
|
Posted: Fri Aug 31, 2007 3:59 pm Post subject: Redirect based on country IP |
|
|
Dear all,
There is an interesting situation we're in.
Currently we use Shoutcast DNAS and have a daily peak of 2500 listeners on our 20 server instances. Server bandwidth is okay, the ISP offers us 1GBit of national bandwidth (we're in Hungary), the peak looks nice, around 178 Mbit:
Unfortunately the international bandwidth, out of this 1G is only 10Mbit, which looks pretty ugly:
This means that although the maxuser setting in the servers would allow more users to come in, those from outside Hungary actually cannot even reach the server between 10:00 and 21:00.
Our ISP cannot give more international access, so we think to contract another service, with for example only 100Mbit national, but another extra 10Mbit international.
Now I'd like to make a setup (wouldn't mind ofcourse to move to Icecast) that would somehow identify the listeners country by IP (actually I'd be interested only to filter out internationals) and redirect them to a new server. So national listeners would use the main server in Hungary, and internationals would listen from the second one. But never viceversa.
Any ideas? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Fri Aug 31, 2007 4:19 pm Post subject: |
|
|
The only redirection work is currently in my branch work and the trigger for that is currently based on max listeners. In theory the auth url engine could be used to inform icecast that a new listener should be redirected to an alternative server. I don't see that being a large change. A header could be sent back (based on some test of the IP or whatever) to icecast which specifies where to redirect to.
karl. |
|
| Back to top |
|
 |
robertut
Joined: 31 Aug 2007 Posts: 156
|
Posted: Mon Sep 03, 2007 6:19 am Post subject: |
|
|
Indeed, that could be a great feature. You'd need one or two lists, eventually saved in a separate text file each (or some entry groups in the xml), where you can specify single IP numbers, IP intervals (from-to), classes or IPs with wildcards. Because the main thing is to do some filters based on country, so one will need to get information, what IP classes belong to which country. This is why multiple entries are needed.
And some logic selection possibility, like
- all IPs in the list should be redirected to a specific server, the others offer the streams
- all IPs except the ones in the list should be redirected to a specific server, only those in the list would receive the streams
depending on the needs of the user...
Perhaps the setting should be available on a per mount basis, I mean, each mount could have a different setting. This is why keeping the IP list in a separate file would be easier, only the path to the file would need to be adjusted for each mount.
Are there any chances to include this feature? |
|
| Back to top |
|
 |
robertut
Joined: 31 Aug 2007 Posts: 156
|
Posted: Mon Sep 03, 2007 6:31 am Post subject: |
|
|
| Oops, I read your e-mail after my post. Thanks, looking into it. Nevermind the words above. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Mon Sep 03, 2007 12:09 pm Post subject: |
|
|
Because of the variability of the possible ways this could be setup, it's very unlikely to be built into icecast. What I have working is a simple mechanism which allow such decisions to be made externally via auth_url. By sending backa location: header you can tell that particular listener to reconnect using the http 302 mechanism. This is currently in my current work which I'll release later today/tomorrow.
karl. |
|
| Back to top |
|
 |
robertut
Joined: 31 Aug 2007 Posts: 156
|
Posted: Mon Sep 03, 2007 3:23 pm Post subject: |
|
|
| karlH wrote: |
Because of the variability of the possible ways this could be setup, it's very unlikely to be built into icecast. What I have working is a simple mechanism which allow such decisions to be made externally via auth_url. By sending backa location: header you can tell that particular listener to reconnect using the http 302 mechanism. This is currently in my current work which I'll release later today/tomorrow.
karl. |
Very good, thanks. Could you please point me into the right direction on redirects? A few hints would be useful and save me a lot of time. If we manage to get something together, we'll change the 20 instances of shoutcast to one single icecast service with 20 mounts. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue Sep 04, 2007 1:21 am Post subject: |
|
|
I have uploaded kh20 now on my website. What you need to do is parse the ip and whatever else out of the POST details from listener_add, make a decision based on that data and send a location: http://... header back or not.
karl. |
|
| Back to top |
|
 |
liveatc
Joined: 22 Sep 2007 Posts: 4 Location: Boston, MA
|
|
| Back to top |
|
 |
|