From a7b66094519d403541816b844efdd424b83981bd Mon Sep 17 00:00:00 2001 From: CryptoSax Date: Fri, 29 Oct 2021 05:57:44 -0500 Subject: [PATCH] Update README.md --- README.md | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d0d7bd..d6b082f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,54 @@ # ShadowSwift -A description of this package. +Shadowsocks is a simple, but effective and popular network traffic obfuscation tool that uses basic encryption with a shared password. shadow is a wrapper for Shadowsocks that makes it available as a Pluggable Transport. + +## Prerequisites + +What things you need to install the software and how to install them + +``` +Xcode +``` + +## Installing + +1. Clone the repository. + +2. Navigate to the project folder + +3. Update the dependencies using Swift Package Manager +``` +swift package update +``` + +## Using the Library + +### Client: +1. Create a Shadow connection factory with the host, port and ShadowConfig containing the password and cipher mode. For DarkStar mode, the password will be the server's persistent private key in hex. +``` + let factory = ShadowConnectionFactory(host: NWEndpoint.Host.ipv4(IPv4Address("host")!), port: NWEndpoint.Port(integerLiteral: port), config: ShadowConfig(password: "password", mode: .DARKSTAR_CLIENT), logger: self.logger) +``` + +2. Connect using the client factory +``` + guard var client = factory.connect(using: .tcp) else {return} +``` + +3. Call .send and .receive on the client connection to send and receive data + +#### Server: +1. Create a Shadow Server with the host, port, and ShadowConfig containing the password and cipher mode. For DarkStar mode, the password will be the server's persistent private key in hex. +``` + guard let server = ShadowServer(host: "host", port: port, config: ShadowConfig(password: "password", mode: .DARKSTAR_SERVER), logger: self.logger) else { + return + } +``` + +2. Accept the connection +``` + guard let connection = server.accept() else { + return + } +``` + +3. Call .send and .receive on the server connection to send and receive data