-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add index pages for posix and niots transports (#34)
Motivation: The umbrella transport module points to the docs for the POSIX and NIOTS transport which are both empty. Modifications: - Add index pages for the two transports - Fix missing docs Result: Better docs
- Loading branch information
Showing
2 changed files
with
109 additions
and
0 deletions.
There are no files selected for viewing
55 changes: 55 additions & 0 deletions
55
Sources/GRPCNIOTransportHTTP2Posix/Documentation.docc/Documentation.md
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# ``GRPCNIOTransportHTTP2Posix`` | ||
|
||
HTTP/2 client and server transports built on top of SwiftNIO's `NIOPosix` module. | ||
|
||
## Overview | ||
|
||
This module provides HTTP/2 transports for client and server built on top SwiftNIO's `NIOPosix` | ||
module and uses SwiftNIO's `NIOSSL` module to provide TLS. | ||
|
||
The two transport types are: | ||
- `HTTP2ClientTransport.Posix`, and | ||
- `HTTP2ServerTransport.Posix`. | ||
|
||
### Availability | ||
|
||
These transports are available on the following platforms: | ||
|
||
- Linux (Ubuntu, CentOS, Amazon Linux, Red Hat Universal Base Image) | ||
- macOS 15.0+ | ||
- iOS 18.0+ | ||
- tvOS 18.0+ | ||
- watchOS 11.0+ | ||
|
||
|
||
### Getting started | ||
|
||
Bootstrapping a client or server is made easier using the `.http2NIOPosix` shorthand: | ||
|
||
```swift | ||
// Create a server resolving "localhost:31415" using the default transport | ||
// configuration and default TLS security configuration. | ||
try await withGRPCClient( | ||
transport: try .http2NIOPosix( | ||
target: .dns(host: "localhost", port: 31415), | ||
transportSecurity: .tls | ||
) | ||
) { client in | ||
// ... | ||
} | ||
|
||
// Create a plaintext server listening on "127.0.0.1" on any available port | ||
// modifying the default configuration to set max concurrent streams to 256. | ||
try await withGRPCServer( | ||
transport: .http2NIOPosix( | ||
address: .ipv4(host: "127.0.0.1", port: 0), | ||
transportSecurity: .plaintext, | ||
config: .defaults { config in | ||
config.http2.maxConcurrentStreams = 256 | ||
} | ||
), | ||
services: [...] | ||
) { server in | ||
// ... | ||
} | ||
``` |
54 changes: 54 additions & 0 deletions
54
Sources/GRPCNIOTransportHTTP2TransportServices/Documentation.docc/Documentation.md
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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# ``GRPCNIOTransportHTTP2TransportServices`` | ||
|
||
HTTP/2 client and server transports built on top of SwiftNIO's `NIOTransportServices` module. | ||
|
||
## Overview | ||
|
||
This module provides HTTP/2 transports for client and server built on top SwiftNIO's | ||
`NIOTransportServices` module which provide TLS via Apple's Network framework. | ||
|
||
The two transport types are: | ||
- `HTTP2ClientTransport.TransportServices`, and | ||
- `HTTP2ServerTransport.TransportServices`. | ||
|
||
### Availability | ||
|
||
These transports are available on the following platforms: | ||
|
||
- macOS 15.0+ | ||
- iOS 18.0+ | ||
- tvOS 18.0+ | ||
- watchOS 11.0+ | ||
|
||
|
||
### Getting started | ||
|
||
Bootstrapping a client or server is made easier using the `.http2NIOTS` shorthand: | ||
|
||
```swift | ||
// Create a server resolving "localhost:31415" using the default transport | ||
// configuration and default TLS security configuration. | ||
try await withGRPCClient( | ||
transport: try .http2NIOTS( | ||
target: .dns(host: "localhost", port: 31415), | ||
transportSecurity: .tls | ||
) | ||
) { client in | ||
// ... | ||
} | ||
|
||
// Create a server listening on "127.0.0.1" on any available port | ||
// using default plaintext security configuration. | ||
try await withGRPCServer( | ||
transport: .http2NIOTS( | ||
address: .ipv4(host: "127.0.0.1", port: 0), | ||
transportSecurity: .plaintext, | ||
config: .defaults { config in | ||
config.http2.maxConcurrentStreams = 256 | ||
} | ||
), | ||
services: [...] | ||
) { server in | ||
// ... | ||
} | ||
``` |