Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Auto discover host IP address #472

Open
elvisimprsntr opened this issue Mar 11, 2013 · 8 comments
Open

Auto discover host IP address #472

elvisimprsntr opened this issue Mar 11, 2013 · 8 comments

Comments

@elvisimprsntr
Copy link
Collaborator

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
Copy link
Owner

plamoni commented Mar 11, 2013

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

@plamoni
Copy link
Owner

plamoni commented Mar 11, 2013

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
Copy link
Collaborator Author

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
Copy link
Collaborator Author

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
Copy link
Owner

plamoni commented Mar 11, 2013

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
Copy link
Collaborator Author

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
Copy link

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

@elvisimprsntr
Copy link
Collaborator Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants