ProxySocket
open class ProxySocket: NSObject, SocketProtocol, RawTCPSocketDelegate
The socket which encapsulates the logic to handle connection to proxies.
-
Received
ConnectSession
.Declaration
Swift
public var session: ConnectSession?
-
Undocumented
Declaration
Swift
open class ProxySocket: NSObject, SocketProtocol, RawTCPSocketDelegate
-
Undocumented
Declaration
Swift
open class ProxySocket: NSObject, SocketProtocol, RawTCPSocketDelegate
-
Undocumented
Declaration
Swift
open class ProxySocket: NSObject, SocketProtocol, RawTCPSocketDelegate
-
Init a
ProxySocket
with a raw TCP socket.Declaration
Swift
public init(socket: RawTCPSocketProtocol, observe: Bool = true)
Parameters
socket
The raw TCP socket.
-
Begin reading and processing data from the socket.
Declaration
Swift
open func openSocket()
-
Response to the
AdapterSocket
on the other side of theTunnel
which has succefully connected to the remote server.Declaration
Swift
open func respondTo(adapter: AdapterSocket)
Parameters
adapter
The
AdapterSocket
. -
Read data from the socket.
Warning
This should only be called after the last read is finished, i.e.,delegate?.didReadData()
is called.Declaration
Swift
open func readData()
-
Send data to remote.
Warning
This should only be called after the last write is finished, i.e.,delegate?.didWriteData()
is called.Declaration
Swift
open func write(data: Data)
Parameters
data
Data to send.
-
Disconnect the socket elegantly.
Declaration
Swift
open func disconnect(becauseOf error: Error? = nil)
-
Disconnect the socket immediately.
Declaration
Swift
open func forceDisconnect(becauseOf error: Error? = nil)
-
The underlying TCP socket transmitting data.
Declaration
Swift
public var socket: RawTCPSocketProtocol!
-
The delegate instance.
Declaration
Swift
weak public var delegate: SocketDelegate?
-
Undocumented
Declaration
Swift
open class ProxySocket: NSObject, SocketProtocol, RawTCPSocketDelegate
-
The current connection status of the socket.
Declaration
Swift
public var status: SocketStatus
-
The socket did disconnect.
Declaration
Swift
open func didDisconnectWith(socket: RawTCPSocketProtocol)
Parameters
socket
The socket which did disconnect.
-
The socket did read some data.
Declaration
Swift
open func didRead(data: Data, from: RawTCPSocketProtocol)
Parameters
data
The data read from the socket.
withTag
The tag given when calling the
readData
method.from
The socket where the data is read from.
-
The socket did send some data.
Declaration
Swift
open func didWrite(data: Data?, by: RawTCPSocketProtocol)
Parameters
data
The data which have been sent to remote (acknowledged). Note this may not be available since the data may be released to save memory.
from
The socket where the data is sent out.
-
The socket did connect to remote.
Note
This never happens for
ProxySocket
.Declaration
Swift
open func didConnectWith(socket: RawTCPSocketProtocol)
Parameters
socket
The connected socket.