TCPStack
open class TCPStack: TSIPStackDelegate, IPStackProtocol
This class wraps around tun2socks to build a TCP only IP stack.
-
The
TCPStack
singleton instance.Declaration
Swift
open static var stack: TCPStack
-
The proxy server that handles connections accepted from this stack.
Declaration
Swift
open weak var proxyServer: ProxyServer?
-
This is set automatically when the stack is registered to some interface.
Declaration
Swift
open var outputFunc: (([Data], [NSNumber]) -> Void)!
-
Input a packet into the stack.
Note
Only process IPv4 TCP packet as of now, since stable lwip does not support ipv6 yet.
Declaration
Swift
open func input(packet: Data, version: NSNumber?) -> Bool
Parameters
packet
The IP packet.
version
The version of the IP packet, i.e., AF_INET, AF_INET6.
Return Value
If the stack takes in this packet. If the packet is taken in, then it won’t be processed by other IP stacks.
-
Undocumented
Declaration
Swift
open class TCPStack: TSIPStackDelegate, IPStackProtocol
-
Stop the TCP stack.
After calling this, this stack should never be referenced. Use
TCPStack.stack
to get a new reference of the singleton.Declaration
Swift
open func stop()
-
Declaration
Swift
open func didAcceptTCPSocket(_ sock: TSTCPSocket)
Parameters
sock