veilid/veilid-flutter/example/lib/config.dart

142 lines
4.0 KiB
Dart
Raw Normal View History

2022-03-04 01:45:39 +00:00
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: "",
2022-06-10 21:07:10 +00:00
apiLogLevel: VeilidConfigLogLevel.info,
2022-03-04 01:45:39 +00:00
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(
2022-03-15 13:33:34 +00:00
directory: kIsWeb
? ""
: p.join((await getApplicationSupportDirectory()).absolute.path,
"table_store"),
2022-03-04 01:45:39 +00:00
delete: false,
),
blockStore: VeilidConfigBlockStore(
2022-03-15 13:33:34 +00:00
directory: kIsWeb
? ""
: p.join((await getApplicationSupportDirectory()).absolute.path,
"block_store"),
2022-03-04 01:45:39 +00:00
delete: false,
),
network: VeilidConfigNetwork(
2022-05-16 15:52:48 +00:00
connectionInitialTimeoutMs: 2000,
connectionInactivityTimeoutMs: 60000,
maxConnectionsPerIp4: 8,
maxConnectionsPerIp6Prefix: 8,
maxConnectionsPerIp6PrefixSize: 56,
maxConnectionFrequencyPerMin: 8,
clientWhitelistTimeoutMs: 300000,
reverseConnectionReceiptTimeMs: 5000,
holePunchReceiptTimeMs: 5000,
nodeId: "",
nodeIdSecret: "",
2022-06-25 19:32:59 +00:00
bootstrap: kIsWeb
? ["ws://bootstrap-dev.veilid.net:5150/ws"]
: ["bootstrap-dev.veilid.net"],
2022-05-16 15:52:48 +00:00
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: 7,
),
dht: VeilidConfigDHT(
resolveNodeTimeoutMs: null,
resolveNodeCount: 20,
resolveNodeFanout: 3,
maxFindNodeCount: 20,
getValueTimeoutMs: null,
getValueCount: 20,
getValueFanout: 3,
setValueTimeoutMs: null,
setValueCount: 20,
setValueFanout: 5,
2022-06-16 01:51:38 +00:00
minPeerCount: 1, //20,
2022-05-16 15:52:48 +00:00
minPeerRefreshTimeMs: 2000,
2022-06-16 01:51:38 +00:00
validateDialInfoReceiptTimeMs: 2000,
2022-05-16 15:52:48 +00:00
),
upnp: true,
natpmp: true,
enableLocalPeerScope: false,
restrictedNatRetries: 3,
tls: VeilidConfigTLS(
certificatePath: "",
privateKeyPath: "",
2022-03-04 01:45:39 +00:00
connectionInitialTimeoutMs: 2000,
2022-05-16 15:52:48 +00:00
),
application: VeilidConfigApplication(
https: VeilidConfigHTTPS(
enabled: false,
2022-03-09 03:32:12 +00:00
listenAddress: "",
2022-05-16 15:52:48 +00:00
path: "",
2022-03-04 01:45:39 +00:00
url: null,
),
2022-05-16 15:52:48 +00:00
http: VeilidConfigHTTP(
enabled: false,
2022-03-09 03:32:12 +00:00
listenAddress: "",
2022-05-16 15:52:48 +00:00
path: "",
2022-03-04 01:45:39 +00:00
url: null,
2022-05-16 15:52:48 +00:00
)),
protocol: VeilidConfigProtocol(
udp: VeilidConfigUDP(
enabled: !kIsWeb,
socketPoolSize: 0,
listenAddress: "",
publicAddress: null,
),
tcp: VeilidConfigTCP(
connect: !kIsWeb,
listen: !kIsWeb,
maxConnections: 32,
listenAddress: "",
publicAddress: null,
2022-03-04 01:45:39 +00:00
),
2022-05-16 15:52:48 +00:00
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,
),
),
),
2022-03-04 01:45:39 +00:00
);
}