Struct dittolive_ditto::transport::TransportConfig
source · pub struct TransportConfig {
pub peer_to_peer: PeerToPeer,
pub connect: Connect,
pub listen: Listen,
pub global: Global,
}
Expand description
A configuration object specifying which network transports Ditto should use to sync data.
A Ditto
object comes with a default transport configuration where all
available peer-to-peer transports are enabled. You can customize this by
initializing a TransportConfig
, adjusting its properties, and supplying it
to set_transport_config()
on Ditto
.
When you initialize a TransportConfig
yourself it starts with all
transports disabled. You must enable each one directly.
Peer-to-peer transports will automatically discover peers in the vicinity
and create connections without any configuration. These are configured
inside the peer_to_peer
property. To turn each one on, set its enabled
property to true
.
To connect to a peer at a known location, such as a Ditto Big Peer, add its
address inside the connect
configuration. These are either host:port
strings for raw TCP sync, or a wss://…
URL for websockets.
The listen
configurations are for specific less common data sync
scenarios. Please read the documentation on the Ditto website for examples.
Incorrect use of listen
can result in insecure configurations.
Fields§
§peer_to_peer: PeerToPeer
Configure Bluetooth and LAN transports.
connect: Connect
Configure TCP and WebSocket outbound transports.
listen: Listen
Configure TCP and HTTP inbound transports.
global: Global
Set peer-global transport settings.
Implementations§
source§impl TransportConfig
impl TransportConfig
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new TransportConfig
with default settings.
sourcepub fn enable_all_peer_to_peer(&mut self)
pub fn enable_all_peer_to_peer(&mut self)
Enables peer-to-peer transports in this config.
Trait Implementations§
source§impl Clone for TransportConfig
impl Clone for TransportConfig
source§fn clone(&self) -> TransportConfig
fn clone(&self) -> TransportConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TransportConfig
impl Debug for TransportConfig
source§impl Default for TransportConfig
impl Default for TransportConfig
source§fn default() -> TransportConfig
fn default() -> TransportConfig
source§impl<'de> Deserialize<'de> for TransportConfig
impl<'de> Deserialize<'de> for TransportConfig
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl PartialEq for TransportConfig
impl PartialEq for TransportConfig
source§fn eq(&self, other: &TransportConfig) -> bool
fn eq(&self, other: &TransportConfig) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for TransportConfig
impl Serialize for TransportConfig
impl Eq for TransportConfig
impl StructuralPartialEq for TransportConfig
Auto Trait Implementations§
impl Freeze for TransportConfig
impl RefUnwindSafe for TransportConfig
impl Send for TransportConfig
impl Sync for TransportConfig
impl Unpin for TransportConfig
impl UnwindSafe for TransportConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)