Pulse-Swift
A port of the Syncthing synchronization protocol in Swift.
Status
This library is still very much in development. It is not yet usable by any standard. Only the Block Exchange Protocol layer and the Connection layer (see below) are completed.
Building
To build, you need Xcode 7.3. Open the .xcworkspace instead of the .xcodeproj, because it contains the CocoaPods dependencies.
Architecture
The Pulse-Swift library is composed of several layers. Each layer only depends on the layers below.
+----------------------------+
| Synchronization |
+-------------+--------------+
| Discovery | Connection |
+-------------+--------------+
| Block Exchange Protocol |
+----------------------------+
The synchronization layer ensures that files get synchronized between the current device and the device that you connect to. It initiates discovery to find the device that you want to synchronize with, opens the connection, and starts synchronizing files.
The discovery layer is responsible for finding other devices. Either on the local network by sending multicast or broadcast UDP messages, or on the internet by using a discovery server.
The connection layer is responsible for connecting securely to a device. It initiates a TCP session, starts TLS encryption, and sends and receives Block Exchange Protocol messages.
The lowest layer is the Swift implementation of the Block Exchange Protocol. These encode the binary messages that go back and forth between two devices over a TCP socket. A full description of the protocol itself can be found here. The classes that implement the Block Exchange Protocol can be found in the pulse-swift/bep folder.