131 Commits

Author SHA1 Message Date
Peter Adams
dabef818d3
Simple index pages for docc (#170)
Motivation:

An index page ties all the other documentation together

Modifications:

Add index pages for the library targets.
Correct a few minor errors in the main docs.

Result:

A more joined up documentation experience.
2022-08-12 07:31:17 -07:00
Peter Adams
da7c04777b
Docnioextras (#169)
* Improve documentation for NIOExtras

Motivation:

Docs will help users do things correctly.

Modifications:

Add missing comments, improve links.

Result:

Better docc documentation

* Docc in NIOHTTPCompression

* NIOSOCKS docc

* Correct bad symbol

* Minor typo

Co-authored-by: Cory Benfield <lukasa@apple.com>
2022-08-03 01:34:45 -07:00
Peter Adams
ca22c12528
Deprecate cumulationBuffer (#168)
Motivation:

It is no longer used.

Modifications:

Deprecate the 3 cumulationBuffers

Result:

Less confusion and accidental usage.
2022-08-02 09:46:57 +01:00
Peter Adams
f4359b987d
Prepare for docc (#167)
Motivation:

Publishing docs is a good thing.

Modifications:

Update Package.swift to allow docc documentation to be generated.

Result:

It is possible to generate docc docs.
2022-08-01 14:21:15 +01:00
Cory Benfield
a75e92bde3
Bump the lowest NIO version to 2.34.0 (#165) 1.12.1 2022-06-14 03:59:18 -07:00
Cory Benfield
8e4f5cfdec
Use 5.7 nightlies (#164) 2022-06-13 04:17:06 -07:00
David Evans
e4dc3c8d1d
Implement Sendable (#160)
Make every non-channel class conform to Sendable (or @unchecked Sendable) to prepare for NIO.
1.12.0
2022-05-04 11:46:21 +01:00
George Barnett
79586313bd
Remove build_podspec.sh (#162)
Motivation:

We no longer support Cocoapods.

Modifications:

- Remove build_podspec.sh

Result:

Less unused code.
2022-05-04 11:02:26 +01:00
George Barnett
ba05378671
Update podspec generation (#161)
Motivation:

Pods need to include all transitive dependencies in order
to work around https://github.com/apple/swift-nio/issues/2073.

We also ship a second library from this repo: NIOSOCKS which doesn't yet
have a pod published.

Modifications:

- Update the pod generation script

Result:

Pods include all transitive dependencies
2022-05-03 16:31:04 +01:00
Fabian Fett
8eea84ec61
Fix warnings, that appeared after requiring Swift 5.4 (#159) 1.11.0 2022-04-22 07:57:02 +01:00
Fabian Fett
59971a8c69
Drop support for Swift 5.2 and 5.3 (#154)
As outlined in a [Swift forums post in November ’21](https://forums.swift.org/t/swiftnio-swift-version-support/53232), SwiftNIO will only support the latest non-patch Swift release and the 2 immediately prior non-patch versions.

- drop support for Swift 5.2 and 5.3. 
- update CI for Swift 5.4 to run on bionic instead of focal to ensure that we still test bionic.
2022-04-21 08:49:12 +02:00
Peter Adams
0cd4cc3e38
Fix concurrency warning (#153)
Motivation:

A clean build is good.

Modifications:

Make the warning string for debug mode a let constant.

Result:

No warning about concurrency safety.

Co-authored-by: Peter Adams <peteradamshc76@gmail.com>
2022-03-20 12:29:58 +00:00
tomer doron
344a517828
ci update (#152)
motivation: 5.6 is out

changes:
* use release version of 5.6
* add docker setup for 5.7 (using nightly for now)
2022-03-16 21:18:47 -07:00
Cory Benfield
e07c67c9b4
Add 5.6 nightly CI (#151)
The 5.6 nightly images are available, let's use them.
2022-01-18 09:38:36 +00:00
George Barnett
c2e508ab19
Update doc generation script (#149)
Motivation:

The docs haven't been generated for a while.

See also: https://github.com/apple/swift-nio/pull/2013

Modifications:

- Add NIOSOCKS module
- Pass `--spm` flag to sourcekitten
- Update source location of sourcekitten
- Fix link to NIO docs

Result:

Docs build.
2021-12-20 11:05:58 +00:00
Cory Benfield
6f8038f8dd
Strip a NIO. (#148)
That's not what the type is called.
2021-12-03 11:26:46 +01:00
Cory Benfield
06033450fb
Update to 5.5 release in CI (#147) 2021-09-22 09:27:42 +01:00
Cory Benfield
f73ca5ee9c
Remove SourceKitten submodule. (#145)
Motivation:

This SourceKitten submodule is not needed, and there isn't any
appropriate map, so it can't actually be initialized. This is breaking
adopters of swift-nio-extras.

Modifications:

- Delete the submodule.

Results:

Adopters can build again.
1.10.2
2021-09-16 14:30:51 +01:00
Cory Benfield
d66ae0557e
Clean up imports and dependencies. (#144)
Motivation:

With NIO 2.32.0 we broke the core NIO module up into modules that split
apart the POSIX layer and the core abstractions. As a result, this
package no longer needs to express a hard dependency on the POSIX layer.

Modifications:

- Rewrote imports of NIO to NIOCore.
- Added NIOEmbedded and NIOPosix imports where necessary in tests.
- Extended soundness script to detect NIO imports.
- Note that the main modules still depend on NIO, which is necessary
    for backwards-compatibility reasons. This dependency is unused.

Result:

No need to use NIOPosix.
1.10.1
2021-09-14 16:30:39 +01:00
tomer doron
a39213b640
update docker to always install ruby as it is used by some scripts (#142) 2021-09-02 17:47:51 +01:00
Nicolas Combe
21bb5ba29d
Add fflush(stdout) to DebugInboundEventsHandler and DebugOutboundEventsHandler (#140)
Co-authored-by: George Barnett <gbarnett@apple.com>
2021-09-02 16:59:35 +01:00
tomer doron
5fbe51af53
fix doc generation and jazzy version (#141)
motivation: fix ci

changes:
* only install ruby and jazzy on focal since jazzy id not supported onlder versions of ubuntu
* fix doc generations script adjusting it to latest source-kittent syntax
2021-09-02 09:14:11 +01:00
David Evans
f72c4688f8
Update NIO to 2.30.0 (#139) 1.10.0 2021-06-23 14:04:13 +01:00
David Evans
c67aa046e5
Remove support for Swift 5.0 and 5.1 (#138)
Changes made:

Removed CI config for 5.0 ad 5.1
Changed 5.2 to be based on 16.04 so we have some coverage there
Converted Package.swift to the latest syntax
Added a description to supported Swift versions in the README
2021-06-22 18:07:01 +01:00
Fabian Fett
79c0d26ba8
Add SOCKSProxyEstablishedEvent (#136)
* Add SOCKSProxyEstablishedEvent

* Ensuring Handler removal works

* Code review
2021-06-22 16:56:35 +01:00
David Evans
29e4c0a2b4
Fix writing domains (#135) 1.9.1 2021-06-18 11:58:57 +01:00
David Evans
b03d835bca
Add SOCKS authentication fast path (#134)
Add a fast path to SOCKS auto-authenticate when the server selects noneRequired as the SOCKS server authentication method.
1.9.0
2021-06-17 14:56:32 +01:00
David Evans
548e0d4893
Fix incorrect SOCKS client flushing behaviour (#133)
* Add buffering test

* Convert to marked buffer

* Soundness

* Re-add fastpath

* Fix
2021-06-17 11:01:54 +01:00
David Evans
93fc12bdb7
Implement SOCKSv5 server handshake (#132)
* SOCKS handshake handler implementation

* Soundness

* Remove placeholder text

* Sad path tests

* Soundness

* Docs

* Fix workflow tests

* Make handler removable

* Protect methods

* Prevent test crashes

* Cleanup public types

* Add test that writing after auth fails

* Add force handler removal tests

* Remove client and server state from public api

* Explicitly handle states

* Remove promises

* Fix test

* Add data to authentication complete

* Refactor to add authentication complete flag
2021-06-16 15:51:23 +01:00
David Evans
d861f305a1
Fix SOCKS client sending greeting and port/address endianness (#131)
* Guard channel is active

* Add delayed channel connection test

* Soundness

* Fix endianness

* Add delayed added test

* Soundness

* Apply suggestions from code review

Co-authored-by: George Barnett <gbarnett@apple.com>

Co-authored-by: George Barnett <gbarnett@apple.com>
2021-06-11 15:21:24 +01:00
David Evans
806a0ead2c
Implement a SOCKSv5 client (#128)
Implement a SOCKSv5 client according to RFC 1928. Server implementation will be added in another PR to keep sizes down.

https://datatracker.ietf.org/doc/html/rfc1928

A few meaningful changes:

Add all relevant types used across SOCKS clients and servers
Add a state machine used to manage a connection from a clients side
Add a channel handler that should be added at the very start of a channel pipeline
2021-06-10 12:12:30 +01:00
Johannes Weiss
cd07a89f5b
Stop publishing the executable products (#130) 2021-06-08 13:18:28 +01:00
David Evans
b8e150416a
Add docker yaml (#129) 2021-06-03 12:28:19 +01:00
Johannes Weiss
0d0af4edd8
docker setup for main nightlies (#119) 2021-05-04 21:21:03 +01:00
Johannes Weiss
9666712c1d
docker: use 5.4 release instead of nightly (#123) 2021-05-04 16:23:33 +01:00
George Barnett
fd8f9dfb11
Add SECURITY.md (#122) 2021-03-09 11:10:43 +00:00
David Nadoba
de1c80ad1f
fix crash in LengthFieldBasedFrameDecoder for malicious length values (#115)
* fix crash in LengthFieldBasedFrameDecoder for malicious length values

Motivation:

LengthFieldBasedFrameDecoder will cause a fatal error if the length value does not fit into an `Int`.
This can happen if `lengthFieldLength` is set to `.eight` and we are on a 64 bit platform or if `lengthFieldLength` is set to `.four` and we are on a 32-bit platform.
If we then receive a length field value which is greater than `Int.max` the conversion from `UInt` to `Int` will cause a fatal error.
This could be abused to crash a server by only sending 4 or 8 bytes.

Modifications:

safely convert UInt64 & UInt32 to Int and throw an error if they can't be represented as an Int

Result:

- LengthFieldBasedFrameDecoder with lengthFieldLength set to `.eight` can no longer crash the server on a 64-bit platform
- LengthFieldBasedFrameDecoder with lengthFieldLength set to `.four` can no longer crash the server on a 32-bit platform

* use early exit instead of XCTSkipIf

* add support for `.eight` on 32-bit platforms

* limit frame length to `Int32.max`

* change test names

* throw correct error

* fix compilation for Swift 5.0 and add NIO prefix to error enum

* add test for maximum allowed length and one above the maximum allowed length

Signed-off-by: David Nadoba <dnadoba@gmail.com>

* run XCTest script

Signed-off-by: David Nadoba <dnadoba@gmail.com>

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
1.8.0
2021-02-18 12:37:41 +00:00
Johannes Weiss
1ce2e70c08
update code of conduct to version 1.4 (#120) 2021-02-17 14:18:42 +00:00
David Nadoba
3d14afbe3f
add support for a 24 bit (3 byte) length field (#114)
Motivation:

The RSocket protocol uses a 24 bit length field

Modifications:

- add two new methods readInteger and writeInteger on ByteBuffer that support reading and writing integers of any size.
- add a new case (.three) to ByteLength

Result:

LengthFieldBasedFrameDecoder & LengthFieldPrepender do now support a 24 bit length field

Co-authored-by: Johannes Weiss <johannesweiss@apple.com>
2021-02-17 09:04:24 +00:00
David Nadoba
f9a828d8b3
Fix link to LengthFieldPrepender.swift in readme (#116) 2021-02-16 09:30:03 +00:00
Fabian Fett
caa96cd4de
Use eventLoop.assertInEventLoop() over assert(eventLoop.inEventLoop) (#111)
Co-authored-by: Cory Benfield <lukasa@apple.com>
2021-01-22 09:04:46 +00:00
Fabian Fett
e4bbe79d7e
Use welcoming language (#112) 2021-01-22 08:49:59 +00:00
George Barnett
e8d4442cf7
Add watchOS deployment to PodSpec build script (#110)
Motivation:

We support watchOS 6+ with SwiftNIO Transport Services; as such we should
include watchOS as a deployment target for our CocoaPods.

Modifications:

- Add a watchOS deployment target to `build_podspecs.sh`

Result:

Users can deploy to watchOS 6+ with CocoaPods.
2020-10-21 15:27:58 +01:00
Cory Benfield
5258afd617
This repository now uses main. (#109) 2020-09-24 16:28:47 +01:00
Cory Benfield
2233123ee7
Swift 5.3-RELEASE is here, let's use it (#108) 2020-09-21 10:08:01 +01:00
George Barnett
e5b5d191a8
Forward 'channelInactive' in the RequestResponseHandler (#107)
Motivation:

As a rule of thumb we should always forward channel events to the next
handler. #106 added an implementation for `channelInactive` but forgot
to forward it.

Modifications:

- forward `channelInactive` in the `RequestResponseHandler`

Result:

Handlers after the `RequestResponseHandler` will recieve
`channelInactive`.
1.7.0
2020-08-24 13:11:47 +01:00
George Barnett
a8e195bdf8
Fail outstanding promises in channelInactive in the RequestResponseHandler (#106)
Motivation:

It's possible for channels to be closed without an error; and the
`RequestResponseHandler` should tolerate that by failing any promises
for which it does not have a response for.

Modifications:

- Add `ClosedBeforeReceivingResponseError`
- Fail outstanding promises with `ClosedBeforeReceivingResponseError` in
  `RequestResponseHandler.channelInactive`
- Add a test.

Result:

Outstanding request promises are failed when the channel becomes inactive.
2020-08-24 07:35:13 +01:00
Tanner
0b9eb87b22
Skip HTTPResponseCompressor logic if response is 204 (no content) (#105)
* Skip HTTPResponseCompressor logic if response is 204 (no content)

* update test manifests

* use mayHaveResponseBody
1.6.1
2020-08-14 17:10:00 +01:00
Karl
f700f5b355
Rename startsWithSameUnicodeScalars -> startsWithExactly, switch to comparing UTF8 bytes. (#104) 2020-08-05 10:47:25 +01:00
Peter Adams
71c5df21bd
Get API breakage script working on Linux for swift-5.2+ (#103)
Motivation:

Current script always reports sdk errors on 5.2.

Modifications:

Only give -sdk where really necessary on 5.2 linux.

Result:

Script will work on 5.2 (although still reports silent errors)
2020-08-04 14:17:30 +01:00