Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
tanner0101 committed Mar 17, 2017
1 parent 81b7954 commit 442b3a6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 20 deletions.
14 changes: 13 additions & 1 deletion Sources/Sockets/TCP/TCPInternetSocket.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import libc

public final class TCPInternetSocket: InternetSocket, TCPDuplexSocket, InternetStream, DuplexProgramStream {
public final class TCPInternetSocket {

// program
public let scheme: String
Expand Down Expand Up @@ -129,3 +129,15 @@ public final class TCPInternetSocket: InternetSocket, TCPDuplexSocket, InternetS
isClosed = true
}
}

// MARK: Socks

extension TCPInternetSocket: TCPReadableSocket { }
extension TCPInternetSocket: TCPWriteableSocket { }
extension TCPInternetSocket: InternetSocket { }

// MARK: Transport

extension TCPInternetSocket: ClientStream { }
extension TCPInternetSocket: ServerStream { }
extension TCPInternetSocket: InternetStream { }
19 changes: 0 additions & 19 deletions Sources/Transport/Streams/ProgramStream/InternetStream.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
public enum ProgramStreamError: Error {
case unsupportedSecurityLayer
}

public typealias DuplexProgramStream = ClientStream & ServerStream

public typealias Port = UInt16
Expand All @@ -10,25 +6,10 @@ public protocol InternetStream {
var scheme: String { get }
var hostname: String { get }
var port: Port { get }
init(scheme: String, hostname: String, port: Port) throws
}

extension Int {
public var port: Port {
return Port(self % Int(Port.max))
}
}

extension InternetStream {
public init() throws {
try self.init(scheme: "http", hostname: "0.0.0.0", port: 80)
}

public init(hostname: String) throws {
try self.init(scheme: "http", hostname: hostname, port: 80)
}

public init(hostname: String, port: Port) throws {
try self.init(scheme: "http", hostname: hostname, port: port)
}
}

0 comments on commit 442b3a6

Please sign in to comment.