Session

open class Session

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
suspend fun addUserProvidedPeers(addrs: List<String>)

Adds peers to connect to.

Link copied to clipboard
suspend fun bindMetrics(addr: String?)
Link copied to clipboard
suspend fun bindNetwork(addrs: List<String>)

Binds the network listeners to the specified interfaces.

Link copied to clipboard
suspend fun bindRemoteControl(addr: String?): Short
Link copied to clipboard
suspend fun Session.close()

Closes the session.

Link copied to clipboard
suspend fun createRepository(path: String, readSecret: SetLocalSecret? = null, writeSecret: SetLocalSecret? = null, token: ShareToken? = null, syncEnabled: Boolean = false, dhtEnabled: Boolean = false, pexEnabled: Boolean = false): Repository

Creates a new repository.

Link copied to clipboard
suspend fun deleteRepositoryByName(name: String)

Delete a repository with the given name.

Link copied to clipboard
suspend fun deriveSecretKey(password: Password, salt: PasswordSalt): SecretKey
Link copied to clipboard
suspend fun findRepository(name: String): Repository
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Returns our Ouisync protocol version.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun getExternalAddrV4(): String?
Link copied to clipboard
suspend fun getExternalAddrV6(): String?
Link copied to clipboard

Returns the highest protocol version of all known peers.

Link copied to clipboard

Returns the listener addresses of this Ouisync instance.

Link copied to clipboard
Link copied to clipboard
suspend fun getMountRoot(): String?
Link copied to clipboard
suspend fun getNatBehavior(): NatBehavior?
Link copied to clipboard
suspend fun getNetworkStats(): Stats
Link copied to clipboard
suspend fun getPeers(): List<PeerInfo>

Returns info about all known peers (both discovered and explicitly added).

Link copied to clipboard
Link copied to clipboard

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.

Link copied to clipboard

Returns the runtime id of this Ouisync instance.

Link copied to clipboard

Returns the access mode that the given token grants.

Link copied to clipboard

Return the info-hash of the repository corresponding to the given token, formatted as hex string.

Link copied to clipboard

Returns the suggested name for the repository corresponding to the given token.

Link copied to clipboard
Link copied to clipboard
suspend fun getStoreDir(): String?
Link copied to clipboard
Link copied to clipboard
suspend fun initNetwork(defaults: NetworkDefaults)

Initializes the network according to the stored configuration. If a particular network parameter is not yet configured, falls back to the given defaults.

Link copied to clipboard

Is local discovery enabled?

Link copied to clipboard
suspend fun isPexRecvEnabled(): Boolean

Checks whether accepting peers discovered on the peer exchange is enabled.

Link copied to clipboard
suspend fun isPexSendEnabled(): Boolean
Link copied to clipboard

Is port forwarding (UPnP) enabled?

Link copied to clipboard
Link copied to clipboard
suspend fun mirrorExists(token: ShareToken, host: String): Boolean
Link copied to clipboard
suspend fun openRepository(path: String, localSecret: LocalSecret? = null): Repository

Opens an existing repository.

Link copied to clipboard
suspend fun removeUserProvidedPeers(addrs: List<String>)

Removes peers previously added with Self::session_add_user_provided_peers.

Link copied to clipboard
suspend fun setDefaultBlockExpiration(value: Duration?)
Link copied to clipboard
suspend fun setDefaultQuota(value: StorageSize?)
Link copied to clipboard
Link copied to clipboard
suspend fun setLocalDiscoveryEnabled(enabled: Boolean)

Enables/disables local discovery.

Link copied to clipboard
suspend fun setMountRoot(path: String?)
Link copied to clipboard
suspend fun setPexRecvEnabled(enabled: Boolean)
Link copied to clipboard
suspend fun setPexSendEnabled(enabled: Boolean)
Link copied to clipboard
suspend fun setPortForwardingEnabled(enabled: Boolean)

Enables/disables port forwarding (UPnP).

Link copied to clipboard
suspend fun setStoreDir(path: String)
Link copied to clipboard

Returns a Flow of network events.

Link copied to clipboard
suspend fun validateShareToken(token: String): ShareToken

Checks whether the given string is a valid share token.