plamoni / SiriProxy

A (tampering) proxy server for Apple's Siri
GNU General Public License v3.0
2.12k stars 343 forks source link

Auto discover host IP address #472

Open elvisimprsntr opened 11 years ago

elvisimprsntr commented 11 years ago

Instead of requiring one to manually specify the server IP address you can use UDPSocket to determine the IP address.

require 'socket'

addr = UDPSocket.open {|s| s.connect("255.255.255.0", 1); s.addr.last}

plamoni commented 11 years ago

I will have to check this out. Thanks for the tip!!

plamoni commented 11 years ago

PS -- Read this this morning, pretty cool. Congrats: http://www.theengineer.co.uk/electronics/in-depth/home-help-towards-the-automated-home/1015721.article

elvisimprsntr commented 11 years ago

Technically one is supposed to use a valid external IP address, but I discovered that as long as it is not all zeros or the loop back yields the correct result

elvisimprsntr commented 11 years ago

Thanks. I wasn't looking for fame, but if I can make some coin I'll take it. So far it hasn't been very lucrative.

PS I put you in for a 2013 Ruby Hero Award. Let me know if you get a call from Matz.

plamoni commented 11 years ago

This might not work 100% of the time, because it doesn't account for boxes that might have more than one interface, and I'm not sure exactly how it decides which one is correct. However, I think that anyone with a network complicated enough for it to matter will recognize if it's wrong and override with the correct address. This should work for 90%+ of cases and will provide an excellent default option.

I'll code it up this evening if I have time.

elvisimprsntr commented 11 years ago

I have been working on a plugin with service (aka Bonjour) auto discovery. I have a few bugs to work out, but resolving the hostname to an IP address works.
Theoretically you could register for an official Zeroconf (aka Bonjour) service name and configure siriproxy (Avahi+dnssd) to broadcast it's service. Unfortunately, even though the iOS device could detect the service, iOS would need a provision to direct the Siri traffic thru siriproxy vs directly to apple servers. Maybe a well placed request to someone "inside" could make it possible. I use a transparent redirect using my router vs dnsmasq.
If the UDPSocket method doesn't cover 100% of the cases, one could theoretically use dnssd to discover siriproxy running on the host which can be resolved to an IP address. That might cover 100% of the cases. it would also allow automatic discovery of the port.

Or is it possible to have siriproxy, maybe using UPnP, to report to a basic router DNS the hostname/ip resolution?
Just looking for a way to make installation and configuration easier. http://serverfault.com/questions/130457/how-to-announce-my-laptop-hostname-ip-to-my-linksys-wrt54gl-router-via-upnp

awesomecode commented 11 years ago

Is it possible to use a custom host in siri proxy like http://youtubeproxy.co/ ?

elvisimprsntr commented 11 years ago

That is a question not related to the subject of this thread. But based on the link you provided I think you have a misunderstanding what SiriProxy is used for. It is not a generic proxy server to allow you to circumvent blocked sites by your employer or your ISP. It is to add functionality to Siri which is not available natively.