aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-16 22:01:05 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2022-11-16 22:01:05 +0100
commita8bacbd385cf1db83b7bc56d2716b528740875cd (patch)
tree7e35cae0fdaca91f43e11ad1879d45617a0bb9d9
parent6dfba80013e6c1a8a063f8542babda8e390389ed (diff)
[client] Update code snippets
-rw-r--r--README.md13
-rw-r--r--docs/Certificates.md6
2 files changed, 9 insertions, 10 deletions
diff --git a/README.md b/README.md
index 464847e..c702c4b 100644
--- a/README.md
+++ b/README.md
@@ -99,7 +99,7 @@ Those are the features/tasks that will probably come next (in no particular orde
```rust
fn start_connection(client: ResMut<Client>) {
client
- .connect(
+ .open_connection(
ClientConfigurationData::new(
"127.0.0.1".to_string(),
6000,
@@ -107,8 +107,7 @@ fn start_connection(client: ResMut<Client>) {
0,
),
CertificateVerificationMode::SkipVerification,
- )
- .unwrap();
+ );
// When trully connected, you will receive a ConnectionEvent
```
@@ -120,7 +119,7 @@ fn handle_server_messages(
mut client: ResMut<Client>,
/*...*/
) {
- while let Ok(Some(message)) = client.receive_message::<ServerMessage>() {
+ while let Ok(Some(message)) = client.connection().receive_message::<ServerMessage>() {
match message {
// Match on your own message types ...
ServerMessage::ClientConnected { client_id, username} => {/*...*/}
@@ -209,11 +208,11 @@ On the client:
```rust
// To accept any certificate
- client.connect(/*...*/, CertificateVerificationMode::SkipVerification);
+ client.open_connection(/*...*/, CertificateVerificationMode::SkipVerification);
// To only accept certificates issued by a Certificate Authority
- client.connect(/*...*/, CertificateVerificationMode::SignedByCertificateAuthority);
+ client.open_connection(/*...*/, CertificateVerificationMode::SignedByCertificateAuthority);
// To use the default configuration of the Trust on first use authentication scheme
- client.connect(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
+ client.open_connection(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
// You can configure TrustOnFirstUse through the TrustOnFirstUseConfig:
// Provide your own fingerprint store variable/file,
// or configure the actions to apply for each possible certificate verification status.
diff --git a/docs/Certificates.md b/docs/Certificates.md
index 8c61082..c050754 100644
--- a/docs/Certificates.md
+++ b/docs/Certificates.md
@@ -6,7 +6,7 @@
Use the default configuration like this:
```rust
-client.connect(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
+client.open_connection(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
..Default::default()
}),
);
@@ -23,7 +23,7 @@ The defaults verifier behaviours are:
Default verifier behaviours with a custom store file:
```rust
-client.connect(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
+client.open_connection(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
known_hosts: KnownHosts::HostsFile("MyCustomFile".to_string()),
..Default::default()
}),
@@ -32,7 +32,7 @@ client.connect(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirs
Custom verifier behaviours with a custom store:
```rust
-client.connect(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
+client.open_connection(/*...*/, CertificateVerificationMode::TrustOnFirstUse(TrustOnFirstUseConfig {
known_hosts: KnownHosts::Store(my_cert_store),
verifier_behaviour: HashMap::from([
(