Session class

Properties

client → Client
finalinherited
hashCode int
The hash code for this object.
no setterinherited
networkEvents Stream<NetworkEvent>
Stream of network events
no setter
rootStateMonitor StateMonitor
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addUserProvidedPeers(List<String> addrs) Future<void>
Adds peers to connect to.
inherited
bindMetrics(String? addr) Future<void>
inherited
bindNetwork(List<String> addrs) Future<void>
Binds the network listeners to the specified interfaces.
inherited
bindRemoteControl(String? addr) Future<int>
inherited
close() Future<void>
Try to gracefully close connections to peers then close the session.
copy(String? srcRepo, String srcPath, String? dstRepo, String dstPath) Future<void>
Copy file or directory into, from or between repositories
inherited
createRepository({required String path, SetLocalSecret? readSecret, SetLocalSecret? writeSecret, ShareToken? token, bool syncEnabled = false, bool dhtEnabled = false, bool pexEnabled = false}) Future<Repository>
Creates a new repository.
inherited
deleteRepositoryByName(String name) Future<void>
Delete a repository with the given name.
inherited
deriveSecretKey(Password password, PasswordSalt salt) Future<SecretKey>
inherited
findRepository(String name) Future<Repository>
inherited
generatePasswordSalt() Future<PasswordSalt>
inherited
generateSecretKey() Future<SecretKey>
inherited
getCurrentProtocolVersion() Future<int>
Returns our Ouisync protocol version.
inherited
getDefaultBlockExpiration() Future<Duration?>
inherited
getDefaultQuota() Future<StorageSize?>
inherited
getDefaultRepositoryExpiration() Future<Duration?>
inherited
getDhtRouters() Future<List<String>>
Returns the current DHT routers (bootstrap nodes). If the routers haven't been changed by the user yet, returns the default routers.
inherited
getExternalAddrV4() Future<String?>
inherited
getExternalAddrV6() Future<String?>
inherited
getHighestSeenProtocolVersion() Future<int>
Returns the highest protocol version of all known peers.
inherited
getLocalListenerAddrs() Future<List<String>>
Returns the listener addresses of this Ouisync instance.
inherited
getMetricsListenerAddr() Future<String?>
inherited
getMountRoot() Future<String?>
inherited
getNatBehavior() Future<NatBehavior?>
inherited
getNetworkStats() Future<Stats>
inherited
getPeers() Future<List<PeerInfo>>
Returns info about all known peers (both discovered and explicitly added).
inherited
getRemoteControlListenerAddr() Future<String?>
inherited
getRemoteListenerAddrs(String host) Future<List<String>>
Returns the listener addresses of the specified remote Ouisync instance. Works only if the remote control API is enabled on the remote instance. Typically used with cache servers.
inherited
getRuntimeId() Future<PublicRuntimeId>
Returns the runtime id of this Ouisync instance.
inherited
getShareTokenAccessMode(ShareToken token) Future<AccessMode>
Returns the access mode that the given token grants.
inherited
getShareTokenInfoHash(ShareToken token) Future<String>
Return the info-hash of the repository corresponding to the given token, formatted as hex string.
inherited
getShareTokenSuggestedName(ShareToken token) Future<String>
Returns the suggested name for the repository corresponding to the given token.
inherited
getStateMonitor(List<MonitorId> path) Future<StateMonitorNode?>
inherited
getStoreDirs() Future<List<String>>
inherited
getUserProvidedPeers() Future<List<String>>
inherited
initNetwork(NetworkDefaults defaults) Future<void>
Initializes the network according to the stored configuration. If a particular network parameter is not yet configured, falls back to the given defaults.
inherited
insertStoreDirs(List<String> paths) Future<void>
inherited
isLocalDhtEnabled() Future<bool>
Checks whether local DHT is enabled.
inherited
isLocalDiscoveryEnabled() Future<bool>
Is local discovery enabled?
inherited
isPexRecvEnabled() Future<bool>
Checks whether accepting peers discovered on the peer exchange is enabled.
inherited
isPexSendEnabled() Future<bool>
inherited
isPortForwardingEnabled() Future<bool>
Is port forwarding (UPnP) enabled?
inherited
listRepositories() Future<Map<String, Repository>>
inherited
mirrorExists(ShareToken token, String host) Future<bool>
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
openNetworkSocketV4() Future<NetworkSocket?>
Opens a side channel to the underlying IPv4 UDP socket. The side channel is used to send/receive raw UDP datagrams on the same socket that the sync protocol uses. This is useful to share the socket between different protocols for hole punching.
inherited
openNetworkSocketV6() Future<NetworkSocket?>
Opens a side channel to the underlying IPv6 UDP socket. The side channel is used to send/receive raw UDP datagrams on the same socket that the sync protocol uses. This is useful to share the socket between different protocols for hole punching.
inherited
openNetworkStream(String addr, TopicId topicId) Future<NetworkStream>
Opens a raw byte streams to the given peer, bound to the given topic.
inherited
openRepository({required String path, LocalSecret? localSecret}) Future<Repository>
Opens an existing repository.
inherited
pinDht() Future<void>
Pin the DHT to ensure it starts and remains running even when there are no active DHT lookups and no DHT-enabled repositories. This is useful to prevent the DHT restarting between the lookups (which could be slow).
inherited
removeStoreDirs(List<String> paths) Future<void>
inherited
removeUserProvidedPeers(List<String> addrs) Future<void>
Removes peers previously added with Self::session_add_user_provided_peers.
inherited
setDefaultBlockExpiration(Duration? value) Future<void>
inherited
setDefaultQuota(StorageSize? value) Future<void>
inherited
setDefaultRepositoryExpiration(Duration? value) Future<void>
inherited
setDhtRouters(List<String> routers) Future<void>
Changes the DHT routers (bootstrap nodes), rebootstraps the DHTs and restart any ongoing lookups. If this is not called, a default set of routers is used. Each router is specified as hostname + port or ip address + port.
inherited
setLocalDhtEnabled(bool enabled) Future<void>
Set whether DHT on the local network or localhost is allowed. By default this is false because DHT is a global discovery mechanism and finding a local peer on it is unexpected (and could indicate malice). However, is some situations it's still useful to enable it (typically for testing).
inherited
setLocalDiscoveryEnabled(bool enabled) Future<void>
Enables/disables local discovery.
inherited
setMountRoot(String? path) Future<void>
inherited
setPexRecvEnabled(bool enabled) Future<void>
inherited
setPexSendEnabled(bool enabled) Future<void>
inherited
setPortForwardingEnabled(bool enabled) Future<void>
Enables/disables port forwarding (UPnP).
inherited
setStoreDirs(List<String> paths) Future<void>
inherited
toString() String
A string representation of this object.
inherited
unpinDht() Future<void>
Unpin the DHT. If the DHT is not pinned and there are no more active DHT lookups and no DHT-enabled repositories, the DHT shuts down.
inherited
validateShareToken(String token) Future<ShareToken>
Checks whether the given string is a valid share token.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create({required String configPath}) Future<Session>
Creates a new session in this process. configPath is a path to a directory where configuration files shall be stored. If it doesn't exists, it will be created.