### Motivation:
To migrate to GitHub actions and centralised infrastructure.
### Modifications:
Changes of note:
* Adopt swift-format using rules from SwiftNIO. Modified so that it
ignores `NoAssignmentInExpressions` in some `XCTAssert` functions.
* Remove scripts and docker files which are no longer needed
### Result:
Feature parity with old CI.
Motivation:
Users are stuck with the hardcoded parameters for receiving data from a
connection.
Modifications:
- Add new options to `NIOTSChannelOptions` for configuring how to
receive data from a connection.
Result:
Users can configure how they receive data from a connection.
This reverts commit 40ffcdef46 in PR #209.
Unfortunately, Swift's behaviour around imports tends to be somewhat
"leaky". In this case, the leak is that the dependency on the
Package.swift allows downstream projects to import `NIOFoundationCompat`
without needing to actually specify the package dependency. This has
affected Hummingbird, which we noticed on our internal integration
testing functionality:
```
hummingbird/Sources/Hummingbird/Codable/JSON/JSONCoding.swift:18:8: error: no such module 'NIOFoundationCompat'
import NIOFoundationCompat
^
```
cc @Joannis @adam-fowler for the Hummingbird report.
Unfortunately, we can't make this change until we're willing to use a
semver major to achieve it. There may be some argument for doing that
now, as the semver major will be very cheap to adopt across the
ecosystem. But we'll need to do this in a considered way.
@Cyberbeni please feel free to reopen your PR targetting main, where we
can discuss whether this is worth issuing a semver major for.
Don't depend on NIOFoundationCompat in NIOTransportServices on Linux
### Motivation:
I'm trying to build a small utility tool based on mqtt-nio which depends
on NIOTransportServices. I noticed that NIOTransportServices depends on
NIOFoundationCompat on all platforms but only imports it where the
Network framework is available. Removing this dependency on non-Apple
platforms allows us to not import Foundations, significantly reducing
the size of the build product when using the Swift Static Linux SDK.
### Modifications:
This PR and a similar one to mqtt-nio.
### Result:
Hello world docker image depending on mqtt-nio went from 169MB to 85MB.
Motivation:
Swift Package Index builds our docs for us and will automatically insert
the dependency.
Modifications:
- Remove the docc-plugin dependency
Result:
Fewer dependencies
### Motivation:
Allow different devices to leverage the capabilities of Mutipath TCP
(MPTCP) to enhance the network reliability. Thanks to MPTCP, a
connection can for example automatically migrate to another interface if
it deteriorates on the first one. This can be especially interesting on
MacOS X and iOS, where devices may frequently benefit from multiple
interfaces (ethernet + Wi-Fi for Macs and Wi-fi + cellular for iOS).
Allowing developers to enable MPTCP on their connections seems thus like
a fine addition to this library.
### Modifications:
Added a function "withMultipath" on NIOTSConnectionBootstrap, that allow
to configure the type of service used for MPTCP (defaults to disabled).
This value will be stored in a field, and then propagated to the
underlying channel when the connect method will be called. Also updated
the parameters field of NIOTSConnectionChannel to set the
multipathServiceType accordingly.
### Result:
Users will now be able to easily enable Multipath TCP, allowing them to
benefit from seamless handover, interactive mode to automatically use
the lowest delay interface or aggregate mode to send data in parallel on
both interfaces.
Example:
```swift
let group = NIOTSEventLoopGroup()
defer {
try! group.syncShutdownGracefully()
}
let bootstrap = NIOTSConnectionBootstrap(group: group)
.withMultipath(.handover) // set handover mode
.channelInitializer { channel in
channel.pipeline.addHandler(MyChannelHandler())
}
try! bootstrap.connect(host: "example.org", port: 12345).wait()
/* the Channel is now connected */
```
Co-authored-by: Cory Benfield <lukasa@apple.com>
# Enhancement: Integration of Viability Handler in `Network.framework`
We have successfully integrated the `viabilityUpdateHandler` from
`Network.framework` into `NIOTransportServices`, enabling developers to
leverage the full potential of the `Network.framework` API.
This enhancement provides adopters with critical insights into the
viability of connections to remote endpoints. By being informed about
the current network status, developers can implement a more responsive
and adaptive approach to network behavior and conditions.
## Modifications
- Introduced two new methods along with corresponding calls to these
methods within the `Network.framework` handler.
- These handlers trigger the `NIO` *InboundEventsTriggered* method,
allowing consumers to respond to network changes effectively.
- Developed two structs within *NIOTSNetworkEvents* to accompany the
*InboundEventsTriggered* methods, ensuring seamless data transfer.
- Conformed these structs to Sendability for compatibility with the
required operating systems.
## Result
Clients can now receive viability events from `Network.framework`,
enhancing their ability to manage network connections dynamically
---------
Co-authored-by: George Barnett <gbarnett@apple.com>
Co-authored-by: Cory Benfield <lukasa@apple.com>
Motivation:
In some cases users may want to access APIs we haven't exposed
in NIOTransportServices. We should have a fallback that allows users
to do this.
Modifications:
- Add ChannelOptions for getting NWConnection and NWListener.
Result:
Users have an escape hatch
Motivation:
Looks like when we previously added syncOptions support to our
channels, we had a few issues. The listeners had code added, but
the code never worked. This is because the code was defined in
subclasses, but the protocol conformance comes from the parent class,
and that parent class did not have a customized protocol witness.
The datagram channel was also entirely missing its support.
Modifications:
- Added the missing unit tests for sync options.
- Added syncOptions to StateManagedListenerChannel base class.
- Added overrides to the listener subclasses.
- Added syncOptions to datagram channel
Result:
Sync options actually work across the board.
# Motivation
We missed a few availability guards in our tests which caused errors when compiling for older Darwin platforms.
# Modification
This PR adds the missing guards.
# Result
We should build on all supported platforms again
# Motivation
After the recent changes in NIO where we introduced the `executeThenClose` method on the `NIOAsyncChannel` our tests here became flaky since we were waiting for something to happen but potentially closed the client channels before we wrote out the data.
# Modification
This PR makes sure we are awaiting for the event in the `executeThenClose` scope; hence, making sure we are not closing the client channels too early.
# Result
Less flakey tests.
# Motivation
We missed a few availability guards in our tests which caused errors when compiling for older Darwin platforms. Additionally the latest NIO release deprecated a few APIs on `NIOAsyncChannel`.
# Modification
This PR adds the missing guards and fixes all of the deprecation warnings.
# Result
We should build on all supported platforms again
* Revert "Back out SPI(AsyncChannel) changes"
This reverts commit 33d2b2993f.
* Add new typed async bootstrap APIs back and drop SPI
# Motivation
We just merged the removal of the `AsyncChannel` SPI in NIO and can now add back the new APIs in transport services as well.
# Modification
This PR brings back the previous SPI and promotes it to API.
# Result
New typed async bootstraps API for `NIOTransportServices`.
* George review
* Fire the pipelines error caughted method when NWConnection's state changes to failed
* Added check if failed error is ChannelError.eof and added a unit test for forwarding failed connnection state errors
* Completing a promise for the error caught
* Fixed Typo
* Removed whitespace
* Binding the listener to port 0 and connecting to listerner's localAddress
Motivation:
Now that Swift 5.9 is GM we should update the supported versions and
remove 5.6
Modifications:
* Update `Package.swift`
* Delete the 5.6 docker compose file and make a 5.10 one
* Update docs
Result:
Remove support for Swift 5.6, add 5.10
Motivation:
There was a typo when setting the allowLocalEndpointReuse channel option, where it was cast to NIOTSEnablePeerToPeerOption.Value
instead of NIOTSAllowLocalEndpointReuse.Value. Both of these types are Bools, so this wouldn't cause any actual issues, this change
is to more to keep the code consistent, and reduce confusion for future contributors or others reading the code base.
Modifications:
This commit casts the allowLocalEndpointReuse property in StateManagedListenerChannel and StateManagedNWConnectionChannel.
Result:
The typo is fixed after this change.
Motivation:
The datagram tests use a handler which sets its event loop in
`channelRegistered`. A function on the handler is called which relies on
the EL being set. However, this can race: the function can be called
before `channelRegistered` is called.
Modifications:
- set the EL in `handlerAdded`
Result:
Fewer crashes
Motivation:
This change was made because UDP support was lacking on iOS. It's needed by my DNS client implementation, which I am in turn using for an iOS app I'm working on relying on SRV typed records.
Modifications:
Adds a NIOTSDatagramListenerBootstrap for making UDP services
Adds a NIOTSDatagramListenerChannel that accepts UDP connections
Adds a NIOTSDatagramChannel for UDP client connections
Adds a NIOTSDatagramBootstrap that can create a new UDP client
# Motivation
We want to release a new `NIOTS` version without the SPI changes for now.
# Modification
This PR backs out the new `NIOAsyncChannel` APIs.
# Result
No more SPI usage so we can safely release.
# Motivation
We had some breaking changes in the NIO AsyncChannel SPI which we have to adapt here.
# Modification
This PR updates to the latest AsyncChannel SPI
# Result
No more warnings and errors when building.
# Motivation
After my recent PR we failed to compile on 5.6 since the compiler isn't capable to infer the return type of one of the closures.
# Modification
This PR adds the closure's return type explicitly.
# Result
Compiling on 5.6 again
# Motivation
We introduced some breaking SPI(AsyncChannel) changes in NIO that we have to adopt here.
# Modification
This PR adopts the latest `NIOProtocolNegotiationResult` APIs. Additionally, it also drops all bind/connect methods on the bootstraps that are specific to protocol negotiation or `NIOAsyncChannel`.
# Result
Green CI on `main` and alignment between `NIOPosix` and `NIOTS.
# Motivation
We introduced a new configuration struct for `NIOAsyncChannel` to make handling and configuring it easier.
# Modification
This PR adopts the new APIs.
# Result
Less boilerplate in our bootstrap methods
* Extract the NWConnection code into StateManagedNWConnectionChannel
* Add a general setup for NWListener implementations
* Add support for UDPOptions as a NWOptionsProtocol type
* Complete the rebase to main
* Fix nits from PR review
* Clean up some of the invalid rebase
* Extract the NWConnection code into StateManagedNWConnectionChannel
* Process cory's feedback
* Remove dead code whose functionality is already handled by the helper protocol
* Make the address cache non-locked, because its lock has been moved to the accessors
* Move getting the Multipath option into the TCP channel, re-introduce the underscores to the addressCache properties
* Drop the umbrella import
---------
Co-authored-by: Cory Benfield <lukasa@apple.com>
* Async methods for `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`
# Motivation
We want to support async bootstrapping with all our bootstraps.
# Modification
This PR adds support for the `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`. It also adds the three variants of methods to it (abstract output, `NIOAsyncChannel` based and protocol negotiation based)
# Result
We now support asynchronous interaction with the `NIOTSListenerBootstrap` and `NIOTSConnectionBootstrap`
* Use protocolHandlers properly
* Update NIO version
* code review
* REview
* Doc indention
Motivation:
We're centralizing on the Swift code of conduct, so we'll x-reference
that instead of holding our own.
Modifications:
Hyperlink out to Swift.
Result:
Shared CoC across the projects.
### Motivation
`swift-nio` has deprecated `NIOPreconcurrencySendable` in `2.51.0`. Removing the protocol conformance would be an API breaking change. Keeping the conformance is low cost and not worth the risk.
### Changes
- replace `NIOPreconcurrencySendable` with underscore version `_NIOPreconcurrencySendable`
### Result
We compile again with the latest `swift-nio` release without warnings
* Drop support for Swift 5.5
Signed-off-by: Si Beaumont <beaumont@apple.com>
* fixup: Next version will be 1.17.0
Signed-off-by: Si Beaumont <beaumont@apple.com>
---------
Signed-off-by: Si Beaumont <beaumont@apple.com>
Motivation:
We try to support building our docs on Linux too, but that means we
can't explicitly reference any symbols from `index.md`.
Modifications:
Enable CI-ing docs.
Result:
Docs will render on Linux too.
Motivation:
The NIO docs are now published on the Swift Package Index but the README
still refers to GitHub pages.
Modifications:
- Update README and other docs to point to Swift Package Index.
Result:
Documentation links work
Motivation
As we've rolled out support for multicast on Linux, it makes sense to
add equivalent configuration for swift-nio-transport-services. The two
features aren't one-to-one, as Network.framework has substantially more
capability than the Linux functionality.
Modifications
- Expose a multipathServiceType channel option
- Add a test to confirm we use it properly
Result
Multicast service types are available.
Motivation:
#fileID introduced in Swift 5.3, so no longer need to use #file anywhere
Modifications:
Changed #file to #filePath or #fileID depending on situation
* Allow retrieval of metadata for a specific protocol from the underlying `NWConnection`
* Address review comments
* Address review comment
* Add availability annotation to tests
* Rename `NIOTSChannelIsNotATransportServicesChannel ` to `NIOTSChannelIsNotANIOTSConnectionChannel `
Motivation:
SwiftNIO periodically drops support for older Swift versions. Now that
5.7 has been released, 5.4 will be dropped.
Modifications:
- Remove 5.4 specific Package.swift and docker-compose
- Update the 5.7 docker-compose to use the released 5.7 and move from
focal (2004) to jammy (2204)
- Update docs
Results:
Minimum Swift version is 5.5
Motivation:
- NIOTSConnectionBootstrap was extended to be marked as non-Sendable,
this extenion missed the availability annotations.
Modifications:
- Add appropriate availability annotation
Result:
Resolves#159
Motivation:
Lock has been deprecated in favour of NIOLock. Warnings aren't great.
Modifications:
- Replace Lock with NIOLock
- Update the minimum required NIO version to 2.42.0.
Result:
Everything builds cleanly
NIO Transport Services is not capable of launching services with existing NWConnection or NWListener objects. Being able to get
an existing NWConnection through a connection bootstrap and into a channel is a useful capability for advanced use cases.
Modifications:
* Added an option to bootstrap with existing NWListener and NWConnection
* Completed promise connection earlier within NIOTSChannels when AlreadyConfigured is called
* Added test with new NWConnection and NWListener to register Channels
Result:
Able to create and register a channel using an existing NWListener and NWConnection
Motivation
Documentation is nice, and we can help support users by providing useful
clear docs.
Modifications
Add Docc to 5.6 and later builds
Make sure symbol references work
Add overview docs
Result
Nice rendering docs