ssbc / ssb-ws

ssb-ws & http server for ssb
MIT License
10 stars 9 forks source link

Bind to specified host and support multiple servers #12

Closed regular closed 6 years ago

regular commented 6 years ago

Currently the http server created by ssb-ws binds to all available IP addresses, because no host is specified to listen(). This is not desireable, because users expect the host they configured to be used. (either via config.connections.incoming.ws.host, config.ws.host or config.host)

This also support auto-selecting a host by specifying a scope and no host. If none of incoming.ws.host, incoming.ws.scope, condig.ws.host or config.host is specified, host defaults to 'localhost'.

Binding to localhost by default instead of to all available IPs breaks backward compatibility. However, this can be fixed in ssb-config and secret-stack by creating a default ws incoming with host: '::', or better, by defaulting config.host to '::'

This also adds support for multiple http/websocket servers. Users can configure multiple ws incomings with different scopes and transforms, for example, ws/noauth for localhost only and ws/shs in the LAN.

regular commented 6 years ago

See also: https://github.com/ssbc/multiserver/pull/25

mixmix commented 6 years ago

I've read the code and it seems reasonable (though it is late here). I'd like to escalate this to someone else who knows this domain better. @dominictarr can you review or delegate please?

dominictarr commented 6 years ago

merged into 4.0.0