{"id":20677266,"url":"https://github.com/operatorfoundation/shadowswift","last_synced_at":"2025-04-19T20:58:04.829Z","repository":{"id":37611846,"uuid":"393120336","full_name":"OperatorFoundation/ShadowSwift","owner":"OperatorFoundation","description":"A Swift Implementation of the Shadow Transport","archived":false,"fork":false,"pushed_at":"2024-10-30T18:54:07.000Z","size":301,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T13:22:44.938Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OperatorFoundation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-05T17:13:59.000Z","updated_at":"2024-12-13T09:11:02.000Z","dependencies_parsed_at":"2024-01-12T06:59:35.235Z","dependency_job_id":"97669ea2-69ea-41a7-aafb-0ca6ec4a263b","html_url":"https://github.com/OperatorFoundation/ShadowSwift","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OperatorFoundation%2FShadowSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OperatorFoundation%2FShadowSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OperatorFoundation%2FShadowSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OperatorFoundation%2FShadowSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OperatorFoundation","download_url":"https://codeload.github.com/OperatorFoundation/ShadowSwift/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249800267,"owners_count":21327031,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T21:15:00.763Z","updated_at":"2025-04-19T20:58:04.800Z","avatar_url":"https://github.com/OperatorFoundation.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"### The Operator Foundation\n\n[Operator](https://operatorfoundation.org) makes usable tools to help people around the world with censorship, security, and privacy.\n\n## Shapeshifter\n\nThe Shapeshifter project provides network protocol shapeshifting technology\n(also sometimes referred to as obfuscation). The purpose of this technology is\nto change the characteristics of network traffic so that it is not identified\nand subsequently blocked by network filtering devices.\n\nThere are two components to Shapeshifter: transports and the dispatcher. Each\ntransport provide different approach to shapeshifting. ShadowSwift is provided as a \nSwift library which can be integrated directly into applications.\n\nIf you are a tool developer working in the Swift programming language, then you\nare in the right place. If you are a tool developer working in other languages we have \nseveral other tools available to you:\n\n- A Go transports library that can be used directly in your application:\n[shapeshifter-transports](https://github.com/OperatorFoundation/shapeshifter-transports)\n\n- A Kotlin transports library that can be used directly in your Android application (currently supports Shadow):\n[ShapeshifterAndroidKotlin](https://github.com/OperatorFoundation/ShapeshifterAndroidKotlin)\n\n- A Java transports library that can be used directly in your Android application (currently supports Shadow):\n[ShapeshifterAndroidJava](https://github.com/OperatorFoundation/ShapeshifterAndroidJava)\n\nIf you want a end user that is trying to circumvent filtering on your network or\nyou are a developer that wants to add pluggable transports to an existing tool\nthat is not written in the Swift programming language, then you probably want the\ndispatcher. Please note that familiarity with executing programs on the command\nline is necessary to use this tool.\n\u003chttps://github.com/OperatorFoundation/shapeshifter-dispatcher\u003e\n\nIf you are looking for a complete, easy-to-use VPN that incorporates\nshapeshifting technology and has a graphical user interface, consider\n[Moonbounce](https://github.com/OperatorFoundation/Moonbounce), an application for macOS which incorporates shapeshifting without\nthe need to write code or use the command line.\n\n### Shapeshifter Transports\n\nShapeshifter Transports is a suite of pluggable transports implemented in a variety of langauges. This repository \nis an implementation of the Shadow transport in the Swift programming language. \n\nIf you are looking for a tool which you can install and\nuse from the command line, take a look at [shapeshifter-dispatcher](https://github.com/OperatorFoundation/shapeshifter-dispatcher.git) instead.\n\nShadowSwift implements the Pluggable Transports 3.0 specification available here:\n\u003chttps://github.com/Pluggable-Transports/Pluggable-Transports-spec/tree/main/releases/PTSpecV3.0\u003e Specifically,\nthey implement the [Swift Transports API v3.0](https://github.com/Pluggable-Transports/Pluggable-Transports-spec/blob/main/releases/PTSpecV3.0/Pluggable%20Transport%20Specification%20v3.0%20-%20Swift%20Transport%20API%20v3.0.md).\n\nThe purpose of the transport library is to provide a set of different\ntransports. Each transport implements a different method of shapeshifting\nnetwork traffic. The goal is for application traffic to be sent over the network\nin a shapeshifted form that bypasses network filtering, allowing\nthe application to work on networks where it would otherwise be blocked or\nheavily throttled.\n\n# ShadowSwift\n\nShadowsocks is a fast, free, and open-source encrypted proxy project, used to circumvent Internet censorship by utilizing a simple, but effective encryption and a shared password. ShadowSwift is a wrapper for Shadowsocks that makes it available as a Pluggable Transport. \n\n## Prerequisites\n\nThe Swift programming language minimum version 5.6. If you are using a Linux system follow the instructions on swift.org to install Swift. If you are using macOS we recommend that you install Xcode.\n\n## Using the Library\n\n### Add the dependency to your project\n\nThis can be done through the Xcode GUI or by updating your Package.swift file\n```\ndependencies: [\n        // Dependencies declare other packages that this package depends on.\n        .package(url: \"https://github.com/OperatorFoundation/ShadowSwift.git\", from: \"3.0.4\"),\n    ],\n```\n\n```\ntargets: [\n        // Targets are the basic building blocks of a package. A target can define a module or a test suite.\n        // Targets can depend on other targets in this package, and on products in packages this package depends on.\n        .target(\n            name: \"MyApp\",\n            dependencies: [\n                \"ShadowSwift\",\n            ]),\n        .testTarget(\n            name: \"MyAppTests\",\n            dependencies: [\"MyApp\"]),\n    ],\n```\n\n### Client:\n1. Create a Shadow connection factory with a ShadowConfig and a swift Logger containing the password and cipher mode.  For DarkStar mode, the password will be the server's persistent private key in hex.\n```\nlet logger: Logger = Logger(label: \"Shadow Logger\")\nLoggingSystem.bootstrap(StreamLogHandler.standardError)\n\nlet shadowConfig = ShadowConfig(key: publicKeyHex, serverIP: \"127.0.0.1\", port: 1234, mode: .DARKSTAR)\nlet factory = ShadowConnectionFactory(config: shadowConfig, logger: logger)\n```\n\n2. Connect using the client factory\n```\nguard var connection = factory.connect(using: .tcp) else \n{\n    return\n}\n\n connection.stateUpdateHandler = \n {\n    state in\n\n    switch state\n    {\n        case .ready:\n            print(\"Ready!\")\n        default:\n            return\n    }\n}\n```\n\n3. Call .send and .receive on the client connection to send and receive data\n\n#### Server:\n1. Create a Shadow config containing the password and cipher mode. For DarkStar mode, the password will be the server's persistent private key in hex.\n```\nlet shadowServerConfig = ShadowConfig(password: \"privateKeyHex\", mode: .DARKSTAR)\n```\n2. Create a Shadow Server with the host, port, ShadowConfig and Swift Logger. \n```\nguard let server = ShadowServer(host: \"host\", port: 2222, config: shadowServerConfig, logger: logger) else                \n{\n    return\n}\n```\n\n3. Accept the connection\n```\nlet connection = try server.accept()\n```\n\n4. Call .send and .receive on the server connection to send and receive data\n```\nlet messageSent = connection.write(string: \"test\\n\")\nlet maybeData = connection.read(size: expectedLength)\n```\n\n### Credits\n* Shadowsocks was developed by the Shadowsocks team. [whitepaper](https://shadowsocks.org/assets/whitepaper.pdf)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foperatorfoundation%2Fshadowswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foperatorfoundation%2Fshadowswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foperatorfoundation%2Fshadowswift/lists"}