From b9bbb97a558fb9197d4cacc9a5e710942e2f6004 Mon Sep 17 00:00:00 2001 From: anthdm Date: Sat, 13 Jan 2024 09:39:42 +0100 Subject: [PATCH] updated README --- README.md | 23 ++++++++++------------- remote/remote.go | 3 ++- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2f66999..ee663e7 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ compiler. Let's go through a Hello world message. The complete example is available in the [hello world](examples/helloworld) folder. Let's start in main: ```go -engine, err := actor.NewEngine(nil) +engine, err := actor.NewEngine(actor.NewEngineConfig()) ``` This creates a new engine. The engine is the core of Hollywood. It's responsible for spawning actors, sending messages and handling the lifecycle of actors. If Hollywood fails to create the engine it'll return an error. For development @@ -212,21 +212,18 @@ This works the same as local actors but "over the wire". Hollywood supports seri ### Configuration -remote.New() takes a remote.Config struct. This struct contains the following fields: -- ListenAddr string -- TlsConfig *tls.Config +remote.New() takes a listen address and a remote.Config struct. You'll instantiate a new remote with the following code: ```go -var engine *actor.Engine -remote := remote.New("0.0.0.0:2222", - &remote.Config{TlsConfig: &tls.Config{ - Certificates: []tls.Certificate{cert}, - }, - } -}) -var err error -engine, err = actor.NewEngine(actor.EngineOptRemote(remote)) +tlsConfig := TlsConfig: &tls.Config{ + Certificates: []tls.Certificate{cert}, +} + +config := remote.NewConfig().WithTLS(tlsConfig) +remote := remote.New("0.0.0.0:2222", config) + +engine, err := actor.NewEngine(actor.NewEngineConfig().WithRemote(remote)) ``` Look at the [Remote actor examples](examples/remote) and the [Chat client & Server](examples/chat) for more information. diff --git a/remote/remote.go b/remote/remote.go index 42845f2..e4711f9 100644 --- a/remote/remote.go +++ b/remote/remote.go @@ -25,7 +25,8 @@ func NewConfig() Config { return Config{} } -// WithTLS sets the TLS config of the remote. +// WithTLS sets the TLS config of the remote which will set +// the transport of the Remote to TLS. func (c Config) WithTLS(tlsconf *tls.Config) Config { c.TLSConfig = tlsconf return c