-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for 0.4 release #425
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,11 +63,35 @@ The main program starts by creating a connection to the server: | |
using ILoggerFactory loggerFactory = LoggerFactory.Create(builder => | ||
builder | ||
.AddSimpleConsole() | ||
.AddFilter("IceRpc", LogLevel.Debug)); | ||
.AddFilter("IceRpc", LogLevel.Information)); | ||
|
||
// Path to the root CA certificate. | ||
using var rootCA = X509CertificateLoader.LoadCertificateFromFile("certs/cacert.der"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The templates were updated to use SSL |
||
|
||
// Create Client authentication options with custom certificate validation. | ||
var clientAuthenticationOptions = new SslClientAuthenticationOptions | ||
{ | ||
RemoteCertificateValidationCallback = (sender, certificate, chain, errors) => | ||
{ | ||
if (certificate is X509Certificate2 peerCertificate) | ||
{ | ||
using var customChain = new X509Chain(); | ||
customChain.ChainPolicy.RevocationMode = X509RevocationMode.NoCheck; | ||
customChain.ChainPolicy.DisableCertificateDownloads = true; | ||
customChain.ChainPolicy.TrustMode = X509ChainTrustMode.CustomRootTrust; | ||
customChain.ChainPolicy.CustomTrustStore.Add(rootCA); | ||
return customChain.Build(peerCertificate); | ||
} | ||
else | ||
{ | ||
return false; | ||
} | ||
} | ||
}; | ||
|
||
await using var connection = new ClientConnection( | ||
new Uri("icerpc://localhost"), | ||
clientAuthenticationOptions: null, | ||
clientAuthenticationOptions, | ||
logger: loggerFactory.CreateLogger<ClientConnection>()); | ||
``` | ||
|
||
|
@@ -77,8 +101,8 @@ This connection naturally matches our server configuration: | |
`icerpc` protocol to `localhost` on the default port for `icerpc` (4062) | ||
- we don't specify a transport so we use the default multiplexed transport | ||
(`tcp`) | ||
- the null `clientAuthenticationOptions` means we'll establish a plain | ||
non-secure TCP connection | ||
- Setting the `clientAuthenticationOptions` means we'll establish a secure | ||
SSL connection | ||
|
||
{% callout %} | ||
|
||
|
@@ -164,12 +188,7 @@ cd MyProtobufServer | |
dotnet run | ||
``` | ||
|
||
The server is now listening for new connections from clients: | ||
|
||
``` | ||
dbug: IceRpc.Server[11] | ||
Listener 'icerpc://[::0]?transport=tcp' has started accepting connections | ||
``` | ||
The server is now listening for new connections from clients. | ||
|
||
### Start the client | ||
|
||
|
@@ -181,27 +200,15 @@ dotnet run | |
The client sends a single `greet` request to the service hosted by our server: | ||
|
||
``` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated the logger output to match that of the new log level. |
||
dbug: IceRpc.ClientConnection[3] | ||
Client connection from '[::1]:52308' to '[::1]:4062' connected | ||
info: IceRpc.Logger.LoggerInterceptor[0] | ||
Sent request Greet to icerpc:/visitor_center.Greeter over | ||
[::1]:52308<->[::1]:4062 and received a response with status code Ok | ||
Sent request Greet to icerpc:/visitor_center.Greeter over [::1]:59405<->[::1]:4062 and received a response with status code Ok | ||
Hello, jose! | ||
dbug: IceRpc.ClientConnection[6] | ||
Client connection from '[::1]:52308' to '[::1]:4062' shutdown | ||
dbug: IceRpc.ClientConnection[5] | ||
Client connection from '[::1]:52308' to '[::1]:4062' disposed | ||
``` | ||
|
||
### Shutdown the server | ||
|
||
Press Ctrl+C on the server console to shut it down. | ||
|
||
``` | ||
dbug: IceRpc.Server[12] | ||
Listener 'icerpc://[::0]?transport=tcp' has stopped accepting connections | ||
``` | ||
|
||
{% /step %} | ||
|
||
[create the server]: server-tutorial | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation doesn't match the actual templates. This was changed in icerpc/icerpc-csharp#3840