mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-12-24 06:49:38 -05:00
progress
This commit is contained in:
parent
e9da652e9a
commit
525baea32c
@ -1514,6 +1514,7 @@ impl NetworkManager {
|
||||
bps_down: 0.into(),
|
||||
bps_up: 0.into(),
|
||||
peers: Vec::new(),
|
||||
|
||||
};
|
||||
}
|
||||
let routing_table = self.routing_table();
|
||||
|
@ -59,6 +59,10 @@ pub struct RoutingTableHealth {
|
||||
pub unreliable_entry_count: usize,
|
||||
/// Number of dead (always unresponsive) entries in the routing table
|
||||
pub dead_entry_count: usize,
|
||||
/// If PublicInternet network class is valid yet
|
||||
pub public_internet_network_class_valid: bool, xxx do this and add to attachment calculation
|
||||
/// If LocalNetwork network class is valid yet
|
||||
pub local_network_network_class_valid: bool,
|
||||
}
|
||||
|
||||
pub(super) struct RoutingTableUnlockedInner {
|
||||
|
@ -7,7 +7,6 @@ import 'package:loggy/loggy.dart';
|
||||
import 'package:veilid_example/veilid_theme.dart';
|
||||
|
||||
import 'log_terminal.dart';
|
||||
import 'config.dart';
|
||||
import 'log.dart';
|
||||
import 'history_wrapper.dart';
|
||||
|
||||
@ -110,8 +109,8 @@ class _MyAppState extends State<MyApp> with UiLoggy {
|
||||
|
||||
Future<void> toggleStartup(bool startup) async {
|
||||
if (startup && !_startedUp) {
|
||||
var updateStream = await Veilid.instance
|
||||
.startupVeilidCore(await getDefaultVeilidConfig());
|
||||
var updateStream = await Veilid.instance.startupVeilidCore(
|
||||
await getDefaultVeilidConfig("Veilid Plugin Example"));
|
||||
setState(() {
|
||||
_updateStream = updateStream;
|
||||
_updateProcessor = processUpdates();
|
||||
|
@ -1,140 +0,0 @@
|
||||
import 'package:veilid/veilid.dart';
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
Future<VeilidConfig> getDefaultVeilidConfig() async {
|
||||
return VeilidConfig(
|
||||
programName: "Veilid Plugin Test",
|
||||
namespace: "",
|
||||
capabilities: VeilidConfigCapabilities(
|
||||
protocolUDP: !kIsWeb,
|
||||
protocolConnectTCP: !kIsWeb,
|
||||
protocolAcceptTCP: !kIsWeb,
|
||||
protocolConnectWS: true,
|
||||
protocolAcceptWS: !kIsWeb,
|
||||
protocolConnectWSS: true,
|
||||
protocolAcceptWSS: false,
|
||||
),
|
||||
protectedStore: VeilidConfigProtectedStore(
|
||||
allowInsecureFallback: false,
|
||||
alwaysUseInsecureStorage: false,
|
||||
insecureFallbackDirectory: "",
|
||||
delete: false,
|
||||
),
|
||||
tableStore: VeilidConfigTableStore(
|
||||
directory: kIsWeb
|
||||
? ""
|
||||
: p.join((await getApplicationSupportDirectory()).absolute.path,
|
||||
"table_store"),
|
||||
delete: false,
|
||||
),
|
||||
blockStore: VeilidConfigBlockStore(
|
||||
directory: kIsWeb
|
||||
? ""
|
||||
: p.join((await getApplicationSupportDirectory()).absolute.path,
|
||||
"block_store"),
|
||||
delete: false,
|
||||
),
|
||||
network: VeilidConfigNetwork(
|
||||
connectionInitialTimeoutMs: 2000,
|
||||
connectionInactivityTimeoutMs: 60000,
|
||||
maxConnectionsPerIp4: 32,
|
||||
maxConnectionsPerIp6Prefix: 32,
|
||||
maxConnectionsPerIp6PrefixSize: 56,
|
||||
maxConnectionFrequencyPerMin: 128,
|
||||
clientWhitelistTimeoutMs: 300000,
|
||||
reverseConnectionReceiptTimeMs: 5000,
|
||||
holePunchReceiptTimeMs: 5000,
|
||||
nodeId: null,
|
||||
nodeIdSecret: null,
|
||||
bootstrap: kIsWeb
|
||||
? ["ws://bootstrap.dev.veilid.net:5150/ws"]
|
||||
: ["bootstrap.dev.veilid.net"],
|
||||
bootstrapNodes: [],
|
||||
routingTable: VeilidConfigRoutingTable(
|
||||
limitOverAttached: 64,
|
||||
limitFullyAttached: 32,
|
||||
limitAttachedStrong: 16,
|
||||
limitAttachedGood: 8,
|
||||
limitAttachedWeak: 4,
|
||||
),
|
||||
rpc: VeilidConfigRPC(
|
||||
concurrency: 0,
|
||||
queueSize: 1024,
|
||||
maxTimestampBehindMs: 10000,
|
||||
maxTimestampAheadMs: 10000,
|
||||
timeoutMs: 10000,
|
||||
maxRouteHopCount: 4,
|
||||
defaultRouteHopCount: 1,
|
||||
),
|
||||
dht: VeilidConfigDHT(
|
||||
resolveNodeTimeoutMs: null,
|
||||
resolveNodeCount: 20,
|
||||
resolveNodeFanout: 3,
|
||||
maxFindNodeCount: 20,
|
||||
getValueTimeoutMs: null,
|
||||
getValueCount: 20,
|
||||
getValueFanout: 3,
|
||||
setValueTimeoutMs: null,
|
||||
setValueCount: 20,
|
||||
setValueFanout: 5,
|
||||
minPeerCount: 20,
|
||||
minPeerRefreshTimeMs: 2000,
|
||||
validateDialInfoReceiptTimeMs: 2000,
|
||||
),
|
||||
upnp: true,
|
||||
detectAddressChanges: true,
|
||||
restrictedNatRetries: 0,
|
||||
tls: VeilidConfigTLS(
|
||||
certificatePath: "",
|
||||
privateKeyPath: "",
|
||||
connectionInitialTimeoutMs: 2000,
|
||||
),
|
||||
application: VeilidConfigApplication(
|
||||
https: VeilidConfigHTTPS(
|
||||
enabled: false,
|
||||
listenAddress: "",
|
||||
path: "",
|
||||
url: null,
|
||||
),
|
||||
http: VeilidConfigHTTP(
|
||||
enabled: false,
|
||||
listenAddress: "",
|
||||
path: "",
|
||||
url: null,
|
||||
)),
|
||||
protocol: VeilidConfigProtocol(
|
||||
udp: VeilidConfigUDP(
|
||||
enabled: !kIsWeb,
|
||||
socketPoolSize: 0,
|
||||
listenAddress: "",
|
||||
publicAddress: null,
|
||||
),
|
||||
tcp: VeilidConfigTCP(
|
||||
connect: !kIsWeb,
|
||||
listen: !kIsWeb,
|
||||
maxConnections: 32,
|
||||
listenAddress: "",
|
||||
publicAddress: null,
|
||||
),
|
||||
ws: VeilidConfigWS(
|
||||
connect: true,
|
||||
listen: !kIsWeb,
|
||||
maxConnections: 16,
|
||||
listenAddress: "",
|
||||
path: "ws",
|
||||
url: null,
|
||||
),
|
||||
wss: VeilidConfigWSS(
|
||||
connect: true,
|
||||
listen: false,
|
||||
maxConnections: 16,
|
||||
listenAddress: "",
|
||||
path: "ws",
|
||||
url: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
@ -1,149 +0,0 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
class AppPlatformMenu extends StatefulWidget {
|
||||
const AppPlatformMenu({super.key, required this.child});
|
||||
|
||||
final Widget child;
|
||||
|
||||
@override
|
||||
State<AppPlatformMenu> createState() => _AppPlatformMenuState();
|
||||
}
|
||||
|
||||
class _AppPlatformMenuState extends State<AppPlatformMenu> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (defaultTargetPlatform != TargetPlatform.macOS) {
|
||||
return widget.child;
|
||||
}
|
||||
|
||||
return PlatformMenuBar(
|
||||
menus: <MenuItem>[
|
||||
PlatformMenu(
|
||||
label: 'TerminalStudio',
|
||||
menus: [
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.about,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.about,
|
||||
),
|
||||
PlatformMenuItemGroup(
|
||||
members: [
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.servicesSubmenu,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.servicesSubmenu,
|
||||
),
|
||||
],
|
||||
),
|
||||
PlatformMenuItemGroup(
|
||||
members: [
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.hide,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.hide,
|
||||
),
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.hideOtherApplications,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.hideOtherApplications,
|
||||
),
|
||||
],
|
||||
),
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.quit,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.quit,
|
||||
),
|
||||
],
|
||||
),
|
||||
PlatformMenu(
|
||||
label: 'Edit',
|
||||
menus: [
|
||||
PlatformMenuItemGroup(
|
||||
members: [
|
||||
PlatformMenuItem(
|
||||
label: 'Copy',
|
||||
shortcut: const SingleActivator(
|
||||
LogicalKeyboardKey.keyC,
|
||||
meta: true,
|
||||
),
|
||||
onSelected: () {
|
||||
final primaryContext = primaryFocus?.context;
|
||||
if (primaryContext == null) {
|
||||
return;
|
||||
}
|
||||
Actions.invoke(
|
||||
primaryContext,
|
||||
CopySelectionTextIntent.copy,
|
||||
);
|
||||
},
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: 'Paste',
|
||||
shortcut: const SingleActivator(
|
||||
LogicalKeyboardKey.keyV,
|
||||
meta: true,
|
||||
),
|
||||
onSelected: () {
|
||||
final primaryContext = primaryFocus?.context;
|
||||
if (primaryContext == null) {
|
||||
return;
|
||||
}
|
||||
Actions.invoke(
|
||||
primaryContext,
|
||||
const PasteTextIntent(SelectionChangedCause.keyboard),
|
||||
);
|
||||
},
|
||||
),
|
||||
PlatformMenuItem(
|
||||
label: 'Select All',
|
||||
shortcut: const SingleActivator(
|
||||
LogicalKeyboardKey.keyA,
|
||||
meta: true,
|
||||
),
|
||||
onSelected: () {
|
||||
final primaryContext = primaryFocus?.context;
|
||||
if (primaryContext == null) {
|
||||
return;
|
||||
}
|
||||
print(primaryContext);
|
||||
try {
|
||||
final action = Actions.maybeFind<Intent>(
|
||||
primaryContext,
|
||||
intent: const SelectAllTextIntent(
|
||||
SelectionChangedCause.keyboard,
|
||||
),
|
||||
);
|
||||
print('action: $action');
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
Actions.invoke<Intent>(
|
||||
primaryContext,
|
||||
const SelectAllTextIntent(SelectionChangedCause.keyboard),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
if (PlatformProvidedMenuItem.hasMenu(
|
||||
PlatformProvidedMenuItemType.quit,
|
||||
))
|
||||
const PlatformProvidedMenuItem(
|
||||
type: PlatformProvidedMenuItemType.quit,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
child: widget.child,
|
||||
);
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:xterm/xterm.dart';
|
||||
|
||||
class VirtualKeyboardView extends StatelessWidget {
|
||||
const VirtualKeyboardView(this.keyboard, {super.key});
|
||||
|
||||
final VirtualKeyboard keyboard;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedBuilder(
|
||||
animation: keyboard,
|
||||
builder: (context, child) => ToggleButtons(
|
||||
isSelected: [keyboard.ctrl, keyboard.alt, keyboard.shift],
|
||||
onPressed: (index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
keyboard.ctrl = !keyboard.ctrl;
|
||||
break;
|
||||
case 1:
|
||||
keyboard.alt = !keyboard.alt;
|
||||
break;
|
||||
case 2:
|
||||
keyboard.shift = !keyboard.shift;
|
||||
break;
|
||||
}
|
||||
},
|
||||
children: const [Text('Ctrl'), Text('Alt'), Text('Shift')],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
|
||||
final TerminalInputHandler _inputHandler;
|
||||
|
||||
VirtualKeyboard(this._inputHandler);
|
||||
|
||||
bool _ctrl = false;
|
||||
|
||||
bool get ctrl => _ctrl;
|
||||
|
||||
set ctrl(bool value) {
|
||||
if (_ctrl != value) {
|
||||
_ctrl = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
bool _shift = false;
|
||||
|
||||
bool get shift => _shift;
|
||||
|
||||
set shift(bool value) {
|
||||
if (_shift != value) {
|
||||
_shift = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
bool _alt = false;
|
||||
|
||||
bool get alt => _alt;
|
||||
|
||||
set alt(bool value) {
|
||||
if (_alt != value) {
|
||||
_alt = value;
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String? call(TerminalKeyboardEvent event) {
|
||||
return _inputHandler.call(event.copyWith(
|
||||
ctrl: event.ctrl || _ctrl,
|
||||
shift: event.shift || _shift,
|
||||
alt: event.alt || _alt,
|
||||
));
|
||||
}
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:html';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:convert';
|
||||
|
||||
@ -11,6 +10,8 @@ import 'veilid_stub.dart'
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
export 'default_config.dart';
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
// FFI Platform-specific config
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user