Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function handleDiscover (dispatch, state, action) {
// disable legacy discovery if new discovery feature flag is set
if (state.config.discovery.enabled) return
// don't duplicate discovery requests
// TODO(mc, 2018-09-10): did not use selector to avoid circular dependency
// this file is getting ditched so ¯\_(ツ)_/¯
if (state.discovery.scanning) return
// TODO(mc, 2017-10-26): we're relying right now on the fact that resin
// advertises an SSH service. Instead, we should be registering an HTTP
// service on port 31950 and listening for that instead
const browser = Bonjour().find({type: 'http'})
.on(UP_EVENT, handleServiceUp)
.on(DOWN_EVENT, handleServiceDown)
let pollInterval
if (!SKIP_WIRED_POLL) {
pollInterval = setInterval(pollDirectConnection, DIRECT_POLL_INTERVAL_MS)
}
setTimeout(finishDiscovery, DISCOVERY_TIMEOUT_MS)
function handleServiceUp (service) {
if (NAME_RE.test(service.name)) {
const serviceWithIp = withIp(service)
dispatch(actions.addDiscovered(serviceWithIp))
// fetchHealth is a thunk action, so give it dispatch
import * as bonjour from 'bonjour';
var bonjourOptions: bonjour.BonjourOptions;
var bonjourInstance: bonjour.Bonjour;
var serviceOptions: bonjour.ServiceOptions;
var service: bonjour.Service;
var browserOptions: bonjour.BrowserOptions;
var browser: bonjour.Browser;
bonjourOptions = { interface: '192.168.1.1', port: 5353 };
bonjourInstance = new bonjour.Bonjour(bonjourOptions);
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 };
service = bonjourInstance.publish(serviceOptions);
browserOptions = { protocol: 'tcp', type: 'http' };
browser = bonjour.find(browserOptions);
var bonjourInstance: bonjour.Bonjour;
var serviceOptions: bonjour.ServiceOptions;
var service: bonjour.Service;
var browserOptions: bonjour.BrowserOptions;
var browser: bonjour.Browser;
bonjourOptions = { interface: '192.168.1.1', port: 5353 };
bonjourInstance = new bonjour.Bonjour(bonjourOptions);
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 };
service = bonjourInstance.publish(serviceOptions);
browserOptions = { protocol: 'tcp', type: 'http' };
browser = bonjour.find(browserOptions);
this.server.listen(opts.port, function () {
self.port = self.server.address().port
debug('IPP printer "%s" listening on port %s', self.name, self.port)
if (opts.zeroconf) bonjour.tcp.publish({ type: 'ipp', port: self.port, name: self.name })
})