aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgilles henaux <gill.henaux@gmail.com>2023-02-20 21:50:29 +0100
committergilles henaux <gill.henaux@gmail.com>2023-02-20 21:50:29 +0100
commit027ab7e3c50168e56d057574c22a0ec65f8ba14a (patch)
tree2feec8f6bfea27df3b73bb4abde693d5cb7bfc91
parent321fb46598de84c6f4ebfa4a62cb5f11ea746eb1 (diff)
Update README code samples
-rw-r--r--README.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/README.md b/README.md
index 4e0629d..f45c515 100644
--- a/README.md
+++ b/README.md
@@ -95,10 +95,10 @@ This is a bird-eye view of the features/tasks that will probably be worked on ne
fn start_connection(client: ResMut<Client>) {
client
.open_connection(
- ClientConfigurationData::new(
- "127.0.0.1".to_string(),
+ ClientConfigurationData::from_ips(
+ IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)),
6000,
- "0.0.0.0".to_string(),
+ IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)),
0,
),
CertificateVerificationMode::SkipVerification,
@@ -143,7 +143,7 @@ fn handle_server_messages(
fn start_listening(mut server: ResMut<Server>) {
server
.start_endpoint(
- ServerConfigurationData::new("127.0.0.1".to_string(), 6000, "0.0.0.0".to_string()),
+ ServerConfigurationData::from_ip(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 6000),
CertificateRetrievalMode::GenerateSelfSigned,
)
.unwrap();
@@ -258,7 +258,9 @@ On the server:
```rust
// To generate a new self-signed certificate on each startup
- server.start_endpoint(/*...*/, CertificateRetrievalMode::GenerateSelfSigned);
+ server.start_endpoint(/*...*/, CertificateRetrievalMode::GenerateSelfSigned {
+ server_hostname: "127.0.0.1".to_string(),
+ });
// To load a pre-existing one from files
server.start_endpoint(/*...*/, CertificateRetrievalMode::LoadFromFile {
cert_file: "./certificates.pem".into(),
@@ -269,6 +271,7 @@ On the server:
cert_file: "./certificates.pem".into(),
key_file: "./privkey.pem".into(),
save_on_disk: true, // To persist on disk if generated
+ server_hostname: "127.0.0.1".to_string(),
});
```