OSX SDK demo app update
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -685,6 +685,9 @@
|
|||||||
<buttonCell key="cell" type="push" title="Leave Network" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nq1-lz-v2i">
|
<buttonCell key="cell" type="push" title="Leave Network" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="nq1-lz-v2i">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_LeaveNetwork:" target="XfG-lQ-9wD" id="P2I-Ge-IBF"/>
|
||||||
|
</connections>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uMn-O6-Lab">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uMn-O6-Lab">
|
||||||
@@ -692,6 +695,9 @@
|
|||||||
<buttonCell key="cell" type="push" title="Join Network" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OKB-ZQ-zkv">
|
<buttonCell key="cell" type="push" title="Join Network" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OKB-ZQ-zkv">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_JoinNetwork:" target="XfG-lQ-9wD" id="fW8-yA-4bf"/>
|
||||||
|
</connections>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
</button>
|
</button>
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7LM-Q0-D7l">
|
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7LM-Q0-D7l">
|
||||||
@@ -729,6 +735,9 @@
|
|||||||
<segment label="TCP"/>
|
<segment label="TCP"/>
|
||||||
<segment label="UDP" selected="YES" tag="1"/>
|
<segment label="UDP" selected="YES" tag="1"/>
|
||||||
</segments>
|
</segments>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_SelectProtocol:" target="XfG-lQ-9wD" id="skN-Qs-8V3"/>
|
||||||
|
</connections>
|
||||||
</segmentedCell>
|
</segmentedCell>
|
||||||
</segmentedControl>
|
</segmentedControl>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4eY-GQ-b8o">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4eY-GQ-b8o">
|
||||||
@@ -736,6 +745,9 @@
|
|||||||
<buttonCell key="cell" type="push" title="Connect" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="vZ1-6O-PCi">
|
<buttonCell key="cell" type="push" title="Connect" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="vZ1-6O-PCi">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_Connect:" target="XfG-lQ-9wD" id="EK6-0x-jUw"/>
|
||||||
|
</connections>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
</button>
|
</button>
|
||||||
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="l8L-xo-sGi">
|
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="l8L-xo-sGi">
|
||||||
@@ -743,6 +755,9 @@
|
|||||||
<buttonCell key="cell" type="push" title="Bind" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iHn-D2-BL1">
|
<buttonCell key="cell" type="push" title="Bind" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="iHn-D2-BL1">
|
||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_Bind:" target="XfG-lQ-9wD" id="oxy-rd-MaC"/>
|
||||||
|
</connections>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
</button>
|
</button>
|
||||||
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="anE-Lb-OeR">
|
<textField verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="anE-Lb-OeR">
|
||||||
@@ -786,6 +801,9 @@
|
|||||||
<segment label="SOCKS5 Proxy of NSStream" selected="YES" tag="1"/>
|
<segment label="SOCKS5 Proxy of NSStream" selected="YES" tag="1"/>
|
||||||
<segment label="Changeling"/>
|
<segment label="Changeling"/>
|
||||||
</segments>
|
</segments>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_SelectAPI:" target="XfG-lQ-9wD" id="TFz-Eh-tzM"/>
|
||||||
|
</connections>
|
||||||
</segmentedCell>
|
</segmentedCell>
|
||||||
</segmentedControl>
|
</segmentedControl>
|
||||||
</subviews>
|
</subviews>
|
||||||
@@ -841,6 +859,9 @@
|
|||||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
</buttonCell>
|
</buttonCell>
|
||||||
|
<connections>
|
||||||
|
<action selector="UI_SendData:" target="XfG-lQ-9wD" id="5u7-do-lmf"/>
|
||||||
|
</connections>
|
||||||
</button>
|
</button>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T6r-uI-PyR">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T6r-uI-PyR">
|
||||||
<rect key="frame" x="11" y="192" width="21" height="17"/>
|
<rect key="frame" x="11" y="192" width="21" height="17"/>
|
||||||
@@ -917,6 +938,23 @@
|
|||||||
</textField>
|
</textField>
|
||||||
</subviews>
|
</subviews>
|
||||||
</view>
|
</view>
|
||||||
|
<connections>
|
||||||
|
<outlet property="UI_SelectProtocol" destination="TgD-cF-oG9" id="kIv-d1-Rbq"/>
|
||||||
|
<outlet property="btnBind" destination="l8L-xo-sGi" id="bdP-Kz-8Si"/>
|
||||||
|
<outlet property="btnConnect" destination="4eY-GQ-b8o" id="JOV-ky-esd"/>
|
||||||
|
<outlet property="btnJoinNetwork" destination="uMn-O6-Lab" id="kuE-Lk-ipe"/>
|
||||||
|
<outlet property="btnLeaveNetwork" destination="mGU-Lt-Mi0" id="t18-og-FtK"/>
|
||||||
|
<outlet property="btnSend" destination="kBj-wv-ccA" id="Bg5-qM-tLw"/>
|
||||||
|
<outlet property="segmentAPISelector" destination="zJe-Qg-KiM" id="B1u-ja-2o3"/>
|
||||||
|
<outlet property="segmentProtocolSelector" destination="TgD-cF-oG9" id="Lbo-Pn-lgi"/>
|
||||||
|
<outlet property="txtAddr" destination="imQ-Xu-9iD" id="FQu-fG-Pg2"/>
|
||||||
|
<outlet property="txtNWID" destination="7LM-Q0-D7l" id="3QF-tw-Hws"/>
|
||||||
|
<outlet property="txtPort" destination="imQ-Xu-9iD" id="UrQ-84-slh"/>
|
||||||
|
<outlet property="txtR" destination="f93-eE-nJ9" id="Sbh-vb-Ycb"/>
|
||||||
|
<outlet property="txtRX" destination="f93-eE-nJ9" id="aTL-JM-evI"/>
|
||||||
|
<outlet property="txtRx" destination="f93-eE-nJ9" id="yPZ-sv-Ctq"/>
|
||||||
|
<outlet property="txtTX" destination="qu5-Bf-5GJ" id="AZG-jC-vS5"/>
|
||||||
|
</connections>
|
||||||
</viewController>
|
</viewController>
|
||||||
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
|
||||||
</objects>
|
</objects>
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
#define Example_OSX_Bridging_Header_h
|
#define Example_OSX_Bridging_Header_h
|
||||||
|
|
||||||
int start_intercept();
|
int start_intercept();
|
||||||
int start_service(const char * path);
|
void start_service(const char * path);
|
||||||
int join_network(const char * nwid);
|
void join_network(const char * nwid);
|
||||||
void disable_intercept();
|
void disable_intercept();
|
||||||
void enable_intercept();
|
void enable_intercept();
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,44 @@ import Cocoa
|
|||||||
|
|
||||||
class ViewController: NSViewController {
|
class ViewController: NSViewController {
|
||||||
|
|
||||||
|
@IBOutlet weak var btnJoinNetwork: NSButton!
|
||||||
|
@IBOutlet weak var btnLeaveNetwork: NSButton!
|
||||||
|
@IBOutlet weak var txtNWID: NSTextField!
|
||||||
|
@IBOutlet weak var segmentAPISelector: NSSegmentedCell!
|
||||||
|
@IBOutlet weak var segmentProtocolSelector: NSSegmentedCell!
|
||||||
|
@IBOutlet weak var txtAddr: NSTextField!
|
||||||
|
@IBOutlet weak var txtPort: NSTextField!
|
||||||
|
@IBOutlet weak var btnConnect: NSButton!
|
||||||
|
@IBOutlet weak var btnBind: NSButton!
|
||||||
|
@IBOutlet weak var txtTX: NSScrollView!
|
||||||
|
@IBOutlet weak var txtRX: NSScrollView!
|
||||||
|
@IBOutlet weak var btnSend: NSButton!
|
||||||
|
|
||||||
|
|
||||||
|
@IBAction func UI_JoinNetwork(sender: AnyObject) {
|
||||||
|
zt_join_network(txtNWID.stringValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_LeaveNetwork(sender: AnyObject) {
|
||||||
|
zt_leave_network(txtNWID.stringValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_SelectAPI(sender: AnyObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_SelectProtocol(sender: AnyObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_Connect(sender: AnyObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_Bind(sender: AnyObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@IBAction func UI_SendData(sender: AnyObject) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var service_thread : NSThread!
|
var service_thread : NSThread!
|
||||||
func ztnc_start_service() {
|
func ztnc_start_service() {
|
||||||
|
|||||||
@@ -180,12 +180,12 @@ namespace ZeroTier {
|
|||||||
#define __STATIC_LWIP__
|
#define __STATIC_LWIP__
|
||||||
// iOS Simulator or iOS device
|
// iOS Simulator or iOS device
|
||||||
// Do nothing, symbols are statically-linked
|
// Do nothing, symbols are statically-linked
|
||||||
#elif TARGET_OS_MAC
|
#elif TARGET_OS_MAC && !defined(SDK_BUNDLED)
|
||||||
#define __DYNAMIC_LWIP__
|
#define __DYNAMIC_LWIP__
|
||||||
// Dynamically load liblwip.so
|
// Dynamically load liblwip.so
|
||||||
_libref = dlopen(path, RTLD_NOW);
|
_libref = dlopen(path, RTLD_NOW);
|
||||||
#else
|
#else
|
||||||
error "Unknown Apple platform"
|
#define __STATIC_LWIP__
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -16,25 +16,23 @@
|
|||||||
|
|
||||||
#include "SDK_ServiceSetup.hpp"
|
#include "SDK_ServiceSetup.hpp"
|
||||||
|
|
||||||
// Starts a service at the specified path
|
// Starts a ZeroTier service at the specified path
|
||||||
extern "C" int start_service(const char * path) {
|
extern "C" void start_service(const char * path) {
|
||||||
init_service(INTERCEPT_DISABLED, path);
|
init_service(INTERCEPT_DISABLED, path);
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Joins a network
|
// Joins a ZeroTier virtual network
|
||||||
extern "C" void zt_join_network(const char * nwid){
|
extern "C" void zt_join_network(const char * nwid){
|
||||||
join_network(nwid); // Instruct ZeroTier service to join network
|
join_network(nwid);
|
||||||
// zt_init_rpc(nwid); // Tells the RPC code where to contact the ZeroTier service
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Leaves a network
|
// Leaves a ZeroTier virtual network
|
||||||
extern "C" void zt_leave_network(const char * nwid){
|
extern "C" void zt_leave_network(const char * nwid){
|
||||||
leave_network(nwid);
|
leave_network(nwid);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit ZT API wrappers
|
// Explicit ZT API wrappers
|
||||||
extern "C" int zts_socket(SOCKET_SIG) {
|
extern "C" int zt_socket(SOCKET_SIG) {
|
||||||
return zt_socket(socket_family, socket_type, protocol);
|
return zt_socket(socket_family, socket_type, protocol);
|
||||||
}
|
}
|
||||||
extern "C" int zts_connect(CONNECT_SIG) {
|
extern "C" int zts_connect(CONNECT_SIG) {
|
||||||
|
|||||||
Reference in New Issue
Block a user