xcode demo app UI updates
This commit is contained in:
@@ -10,27 +10,11 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "489623400.349295"
|
||||
timestampString = "490574990.533534"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "78"
|
||||
endingLineNumber = "78"
|
||||
landmarkName = "UI_Connect(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "489623400.349295"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "155"
|
||||
endingLineNumber = "155"
|
||||
startingLineNumber = "174"
|
||||
endingLineNumber = "174"
|
||||
landmarkName = "UI_SendData(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
@@ -42,43 +26,11 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "489623686.632265"
|
||||
timestampString = "490574990.533534"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "137"
|
||||
endingLineNumber = "137"
|
||||
landmarkName = "UI_Bind(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "489623690.124704"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "139"
|
||||
endingLineNumber = "139"
|
||||
landmarkName = "UI_Bind(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
shouldBeEnabled = "No"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "490569637.32756"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "179"
|
||||
endingLineNumber = "179"
|
||||
startingLineNumber = "194"
|
||||
endingLineNumber = "194"
|
||||
landmarkName = "UI_ReadData(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
@@ -94,9 +46,7 @@
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "50"
|
||||
endingLineNumber = "50"
|
||||
landmarkName = "zts_socket(SOCKET_SIG)"
|
||||
landmarkType = "7">
|
||||
endingLineNumber = "50">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
@@ -106,11 +56,11 @@
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "Example_OSX_App/ViewController.swift"
|
||||
timestampString = "490569637.32756"
|
||||
timestampString = "490574990.533534"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "178"
|
||||
endingLineNumber = "178"
|
||||
startingLineNumber = "193"
|
||||
endingLineNumber = "193"
|
||||
landmarkName = "UI_ReadData(_:)"
|
||||
landmarkType = "5">
|
||||
</BreakpointContent>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10116" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10116"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
|
||||
<capability name="box content view" minToolsVersion="7.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
|
||||
@@ -71,9 +71,10 @@ class ViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Connect to remote host on ZeroTier virtual network
|
||||
@IBAction func UI_Connect(sender: AnyObject) {
|
||||
|
||||
// CONNECT
|
||||
var connect_thread : NSThread!
|
||||
func attempt_connect()
|
||||
{
|
||||
// TCP
|
||||
if(selectedProtocol == SOCK_STREAM)
|
||||
{
|
||||
@@ -103,8 +104,18 @@ class ViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Bind a ZeroTier socket
|
||||
@IBAction func UI_Bind(sender: AnyObject) {
|
||||
// Connect to remote host on ZeroTier virtual network
|
||||
@IBAction func UI_Connect(sender: AnyObject) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.connect_thread = NSThread(target:self, selector:"attempt_connect", object:nil)
|
||||
self.connect_thread.start()
|
||||
});
|
||||
}
|
||||
|
||||
// BIND
|
||||
var bind_thread : NSThread!
|
||||
func attempt_bind()
|
||||
{
|
||||
// TCP
|
||||
if(selectedProtocol == SOCK_STREAM)
|
||||
{
|
||||
@@ -146,6 +157,14 @@ class ViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Bind a ZeroTier socket
|
||||
@IBAction func UI_Bind(sender: AnyObject) {
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.bind_thread = NSThread(target:self, selector:"attempt_bind", object:nil)
|
||||
self.bind_thread.start()
|
||||
});
|
||||
}
|
||||
|
||||
// TX
|
||||
@IBOutlet weak var btnSend: NSButton!
|
||||
@IBAction func UI_SendData(sender: AnyObject) {
|
||||
@@ -170,10 +189,6 @@ class ViewController: NSViewController {
|
||||
if(selectedProtocol == SOCK_STREAM)
|
||||
{
|
||||
var buffer = [UInt8](count: 100, repeatedValue: 0)
|
||||
let str = "GET / HTTP/1.0\r\n\r\n"
|
||||
//let str = "Welcome to the machine"
|
||||
print("strlen = %d\n", str.characters.count)
|
||||
let encodedDataArray = [UInt8](str.utf8)
|
||||
read(accepted_sock, &buffer, 1024);
|
||||
print(buffer)
|
||||
|
||||
@@ -185,6 +200,39 @@ class ViewController: NSViewController {
|
||||
}
|
||||
}
|
||||
|
||||
// Watch for incoming data
|
||||
var rx_thread : NSThread!
|
||||
func update_rx() {
|
||||
while(true)
|
||||
{
|
||||
sleep(1)
|
||||
// TCP
|
||||
if(selectedProtocol == SOCK_STREAM)
|
||||
{
|
||||
var len = 32
|
||||
var buffer = [UInt8](count: len, repeatedValue: 0)
|
||||
let n = read(accepted_sock, &buffer, len);
|
||||
if(n > 0)
|
||||
{
|
||||
if let str = String(data: NSData(bytes: &buffer, length: len), encoding: NSUTF8StringEncoding) {
|
||||
dispatch_async(dispatch_get_main_queue()) {
|
||||
self.txtRX.stringValue = str
|
||||
}
|
||||
} else {
|
||||
print("not a valid UTF-8 sequence")
|
||||
}
|
||||
}
|
||||
}
|
||||
// UDP
|
||||
if(selectedProtocol == SOCK_DGRAM)
|
||||
{
|
||||
// recvfrom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Built-in SOCKS5 Proxy Server Test
|
||||
func test_client_proxy_nsstream()
|
||||
{
|
||||
// For HTTP request
|
||||
@@ -216,16 +264,15 @@ class ViewController: NSViewController {
|
||||
outputStream?.write(encodedDataArray, maxLength: encodedDataArray.count)
|
||||
|
||||
// RX
|
||||
//sleep(5)
|
||||
//inputStream?.read(&buffer, maxLength: 100)
|
||||
//print("buffer = \(buffer)\n")
|
||||
sleep(5)
|
||||
inputStream?.read(&buffer, maxLength: 100)
|
||||
print("buffer = \(buffer)\n")
|
||||
}
|
||||
|
||||
var service_thread : NSThread!
|
||||
func ztnc_start_service() {
|
||||
// If you plan on using SOCKS Proxy, you don't need to initialize the RPC
|
||||
//start_service("/Users/Joseph/utest3")
|
||||
|
||||
// If you plan on using direct calls via RPC
|
||||
start_service_and_rpc("/Users/Joseph/utest3","565799d8f65063e5");
|
||||
}
|
||||
@@ -244,6 +291,12 @@ class ViewController: NSViewController {
|
||||
self.service_thread = NSThread(target:self, selector:"ztnc_start_service", object:nil)
|
||||
self.service_thread.start()
|
||||
});
|
||||
|
||||
// Update UI on RX of data
|
||||
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), {
|
||||
self.rx_thread = NSThread(target:self, selector:"update_rx", object:nil)
|
||||
self.rx_thread.start()
|
||||
});
|
||||
}
|
||||
|
||||
override var representedObject: AnyObject? {
|
||||
|
||||
Reference in New Issue
Block a user