Skip to content

Commit

Permalink
Merge branch 'main' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
bragelbytes committed Mar 22, 2024
2 parents 70a8695 + f714bd9 commit 10b9aa3
Show file tree
Hide file tree
Showing 11 changed files with 512 additions and 506 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ Package.resolved

# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace
Sources/.DS_Store
.DS_Store
13 changes: 10 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,22 @@ let package = Package(
targets: ["Starbridge"]),
],
dependencies: [
.package(url: "https://github.com/OperatorFoundation/ReplicantSwift", from: "2.0.1"),
.package(url: "https://github.com/OperatorFoundation/Gardener", from: "0.1.1")
.package(url: "https://github.com/apple/swift-log", from: "1.5.4"),

.package(url: "https://github.com/OperatorFoundation/Gardener", from: "0.1.2"),
.package(url: "https://github.com/OperatorFoundation/KeychainTypes", from: "1.0.2"),
.package(url: "https://github.com/OperatorFoundation/ReplicantSwift", from: "2.0.2"),
.package(url: "https://github.com/OperatorFoundation/TransmissionAsync", from: "0.1.5"),
],
targets: [
.target(
name: "Starbridge",
dependencies: [
"ReplicantSwift",
"Gardener",
"KeychainTypes",
"ReplicantSwift",
"TransmissionAsync",
.product(name: "Logging", package: "swift-log"),
]),
.testTarget(
name: "StarbridgeTests",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ transport provides a different approach to shapeshifting.

### Shapeshifter Transports

Shapeshifter Transports is a suite of pluggable transports implemented in a variety of langauges. This repository
Shapeshifter Transports is a suite of pluggable transports implemented in a variety of languages. This repository
is an implementation of the **Starbridge** transport in the Swift programming language.

The purpose of the transport suite is to provide a variety of different transports to choose from. Each transport implements a different method of shapeshifting network traffic. The goal is for application traffic to be sent over the network in a shapeshifted form that bypasses network filtering, allowing the application to work on networks where it would otherwise be blocked or heavily throttled. If one transport is blocked, trying a different transport (or transport configuration in the case of Replicant) may help. The [Optimizer](https://github.com/OperatorFoundation/Optimizer-go.git) transport is specifically designed with this in mind, it functions by rotating through different transports when a connection cannot be made.
Expand Down
69 changes: 0 additions & 69 deletions Sources/Starbridge/Spacetime/StarbridgeUniverse.swift

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
//
// Starbridge.swift
// AsyncDarkstar.swift
//
//
// Created by Joshua Clark on 6/27/22.
// Created by Mafalda on 3/4/24.
//

import Foundation


import Crypto
import Foundation
import Logging

import Gardener
import KeychainTypes
import ReplicantSwift
import Simulation
import Spacetime
import TransmissionTypes
import Universe
import TransmissionAsync

public class Starbridge
{
var logger: Logger
let simulation: Simulation
let universe: StarbridgeUniverse
let logger: Logger

public init(logger: Logger)
{
self.logger = logger
let sim = Simulation(capabilities: Capabilities(.display, .random, .networkConnect, .networkListen))
self.simulation = sim

// FIXME: Logger
self.universe = StarbridgeUniverse(effects: self.simulation.effects, events: self.simulation.events, logger: nil)
}

public func listen(config: StarbridgeServerConfig) throws -> TransmissionTypes.Listener
public func listen(config: StarbridgeServerConfig) throws -> AsyncListener
{
return try self.universe.starbridgeListen(config: config, logger: self.logger)
let serverToneburst = Starburst(.SMTPServer)
let polishServerConfig = PolishServerConfig(serverAddress: config.serverAddress, serverPrivateKey: config.serverPrivateKey)
let replicant = Replicant(logger: self.logger, polish: polishServerConfig, toneburst: serverToneburst)
return try ReplicantListener(replicant: replicant, serverIP: config.serverIP, serverPort: Int(config.serverPort), logger: self.logger)
}

public func connect(config: StarbridgeClientConfig) throws -> TransmissionTypes.Connection
public func connect(config: StarbridgeClientConfig) async throws -> AsyncConnection
{
return try self.universe.starbridgeConnect(config: config, self.logger)
let clientToneburst = Starburst(.SMTPClient)
let polishClientConfig = PolishClientConfig(serverAddress: config.serverAddress, serverPublicKey: config.serverPublicKey)
let replicant = Replicant(logger: self.logger, polish: polishClientConfig, toneburst: clientToneburst)
let network = try await AsyncTcpSocketConnection(config.serverIP, Int(config.serverPort), logger)

return try await replicant.replicantClientTransformation(connection: network)
}

/// Creates a randomly generated P-256 and returns the hex format of their respective raw (data) representations. This is a format suitable for JSON config files.
Expand Down Expand Up @@ -113,4 +114,3 @@ public class Starbridge
}
}
}

148 changes: 0 additions & 148 deletions Sources/Starbridge/StarbridgeClientConfig.swift

This file was deleted.

Loading

0 comments on commit 10b9aa3

Please sign in to comment.