7ecc12b747
Server: internal/discovery publishes a DNS-SD record (hashicorp/mdns) with the port LAN clients dial (the web proxy via -mdns-port, which the supervisor passes, or a non-loopback -addr) and TXT v, name, path, tls, auth. On by default; -mdns=false or PIPELINES_MDNS=off disables it. Failures are logged and never block startup; the advert is withdrawn on shutdown. App: the Connect to Pipelines screen gets 'Find servers on this network' behind a ServerDiscovery interface (Bonsoir: Android NSD with multicast lock, iOS Bonjour with NSLocalNetworkUsageDescription and NSBonjourServices). Tapping a server fills the address and connects; manual entry stays. Web has no scan.
19 lines
696 B
Dart
19 lines
696 B
Dart
import 'package:flutter/foundation.dart';
|
|
|
|
import 'bonsoir_server_discovery.dart';
|
|
import 'discovered_server.dart';
|
|
|
|
/// Finds Pipelines servers on the local network.
|
|
abstract interface class ServerDiscovery {
|
|
/// Browses while listened to. Each event is every server currently known;
|
|
/// a failure to browse is a stream error. Cancelling stops the browse.
|
|
Stream<List<DiscoveredServer>> scan();
|
|
}
|
|
|
|
/// The discovery this platform supports, or null where there is none.
|
|
///
|
|
/// Browsers cannot send mDNS, and the web app is served by the server it
|
|
/// talks to, so web has no scan.
|
|
ServerDiscovery? platformServerDiscovery({bool web = kIsWeb}) =>
|
|
web ? null : BonsoirServerDiscovery();
|