Parse bus configuration from connection string with following format

hdl://device@gateway[:port]

@param  {String|Object} resource - connection string or configutaion
@return {Object} - bus connection configuration
function parse(resource) {
  if (typeof resource === 'object') return resource;

  var config = url.parse(resource);

  return {
    port: config.port,
    device: config.auth,
    gateway: config.hostname
  };
}