mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-26 04:57:52 +00:00
Motivation: Currently whenever we add new config to TLSConfiguration, we add a new static factory function that needs to provide the field. This is because we currently allow configuration primarily by way of initializers. This is increasingly not scaling, leading to a proliferation of almost identical static factory functions. We can replace this proliferation by having only "default" constructions that default basically everything, and then having users use getters/setters to initialize things. This also works well when we have multiple ways of interacting with config, e.g. with the various cipher suite operations. Modifications: - Deprecate all existing factory functions. - Replace with two: forClient() and forServer(certificateChain:privateKey:). These configure only the mandatory things for each mode. - Replace all uses of the deprecated initializers with the new ones, configuring fields manually as needed. Result: More consistent configuration objects.
NIOTLSServer
This sample application provides a TLS server. Invoke it with the following syntax.
swift run NIOTLSServer # Gets a content on a server on ::1, port 4433, using TLS