Move autodetect handling to the library.

This is consistent with how we expand the settings. Also add comments to
separate code that deals with settings and registration parameters.
Prefer outgoing address over loopback when using autodetect.

This makes autodetect more useful when the runtime and editor are on diferent systems.
Add a jslinter as this module does not have tests.
Merge pull request #10 from ensonic/master

Small code reorganisation and cleanups.