Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ghazel committed Jun 8, 2022
2 parents ae1769f + 6c3aad0 commit 2efda6b
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 103 deletions.
Binary file modified NewNode.xcframework/ios-arm64/libnewnode.a
Binary file not shown.
Binary file modified NewNode.xcframework/ios-x86_64-maccatalyst/libnewnode.a
Binary file not shown.
Binary file modified NewNode.xcframework/ios-x86_64-simulator/libnewnode.a
Binary file not shown.
56 changes: 30 additions & 26 deletions android.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,49 +154,53 @@ void platform_dns_prefetch(network *n, const char *host)
JNIEnv *env = get_env();
jvm_frame(env, ^() {
jclass cNewNode = (*env)->GetObjectClass(env, newNode);
CATCH(
debug("%s exception line %d\n", __func__, __LINE__);
return;
);
CALL_VOID(cNewNode, newNode,
dnsPrefetch,
Ljava/lang/String;,
JSTR(host));
CATCH(
debug("%s exception line %d\n", __func__, __LINE__);
return;
);
CATCH(return);
CALL_VOID(cNewNode, newNode, dnsPrefetch, Ljava/lang/String;, JSTR(host));
CATCH(return);
});
}

JNIEXPORT void JNICALL Java_com_clostra_newnode_internal_NewNode_storeDnsPrefetchResult(JNIEnv *env, jobject thiz, jstring host, jobjectArray addresses)
{

const char *hoststr = (*env)->GetStringUTFChars(env, host, NULL);
const char *cHost = (*env)->GetStringUTFChars(env, host, NULL);
int n_addresses = (*env)->GetArrayLength(env, addresses);

debug("%s host:%s n_addresses:%d\n", __func__, hoststr, n_addresses);
debug("%s host:%s n_addresses:%d\n", __func__, cHost, n_addresses);

evutil_addrinfo *rai = NULL;
for (int i = 0; i < n_addresses; ++i) {
jbyteArray jaddr = (jbyteArray)(*env)->GetObjectArrayElement(env, addresses, i);
jbyte* addr = (*env)->GetByteArrayElements(env, jaddr, NULL);
socklen_t addrlen = (*env)->GetArrayLength(env, jaddr);
evutil_addrinfo nullhints = {
.ai_family = PF_UNSPEC,
.ai_socktype = SOCK_STREAM,
.ai_protocol = IPPROTO_TCP
};
evutil_addrinfo *ai = evutil_new_addrinfo_((sockaddr*)addr, addrlen, &nullhints);
rai = evutil_addrinfo_append_(rai, ai);
evutil_addrinfo hints = {.ai_family = PF_UNSPEC, .ai_socktype = SOCK_STREAM, .ai_protocol = IPPROTO_TCP};
switch (addrlen) {
case sizeof(in_addr_t): {
sockaddr_in sin = {.sin_family = AF_INET, .sin_addr.s_addr = *(in_addr_t*)addr};
evutil_addrinfo *ai = evutil_new_addrinfo_((sockaddr*)&sin, sizeof(sin), &hints);
rai = evutil_addrinfo_append_(rai, ai);
break;
}
case sizeof(in6_addr): {
sockaddr_in6 sin6 = {.sin6_family = AF_INET6};
memcpy(&sin6.sin6_addr, &addr, sizeof(sin6.sin6_addr));
evutil_addrinfo *ai = evutil_new_addrinfo_((sockaddr*)&sin6, sizeof(sin6), &hints);
rai = evutil_addrinfo_append_(rai, ai);
break;
}
default:
case 0:
debug("unsupported addrlen:%u\n", addrlen);
break;
}
(*env)->ReleaseByteArrayElements(env, jaddr, addr, JNI_ABORT);
}

char *temp_hoststr = strdup(hoststr);
char *temp_host = strdup(cHost);
(*env)->ReleaseStringUTFChars(env, host, cHost);
network_async(g_n, ^{
dns_prefetch_store_result(g_n, rai, host, 0);
dns_prefetch_store_result(g_n, rai, temp_host, 0);
evutil_freeaddrinfo(rai);
free(temp_hoststr);
free(temp_host);
});
}

Expand All @@ -211,7 +215,7 @@ void cancel_https_request(network *n, https_request_token token)
}
jclass cNewNode = (*env)->GetObjectClass(env, newNode);
CATCH(return);
CALL_VOID(cNewNode, newNode, httpCancel, Lcom/newnode/internal/NewNode/CallblockThread;, https_request);
CALL_VOID(cNewNode, newNode, httpCancel, Lcom/clostra/newnode/internal/NewNode$CallblockThread;, https_request);
CATCH(assert(false));
});
}
Expand Down
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'com.android.tools.build:gradle:7.2.0'
}
}

plugins {
id 'com.vanniktech.maven.publish' version '0.18.0'
id 'com.vanniktech.maven.publish' version '0.18.0'
}

allprojects {
Expand Down
3 changes: 2 additions & 1 deletion android/examples/WebViewSample/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.+'

// include AAR directly (must include dependencies)
implementation project(':newnode')
releaseImplementation files('../../../build/outputs/aar/newnode-release.aar')
debugImplementation files('../../../build/outputs/aar/newnode-debug.aar')
implementation 'com.bugsnag:bugsnag-android:4.7.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
Expand Down
2 changes: 1 addition & 1 deletion android/examples/WebViewSample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.+'
classpath 'com.android.tools.build:gradle:7.2.+'
}
}

Expand Down
2 changes: 0 additions & 2 deletions android/examples/WebViewSample/newnode/build.gradle

This file was deleted.

27 changes: 0 additions & 27 deletions android/examples/WebViewSample/newnode/newnode.iml

This file was deleted.

2 changes: 1 addition & 1 deletion android/examples/flutter/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0'
classpath 'com.android.tools.build:gradle:7.2.0'
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ CallblockThread http(final String url, final long callblock, final int request_f
return thread;
}

static void httpCancel(CallblockThread t) {
void httpCancel(CallblockThread t) {
t.callblock = 0;
t.interrupt();
}
Expand Down
3 changes: 2 additions & 1 deletion android/vpn/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'

// include AAR directly (must include dependencies)
implementation project(':newnode')
releaseImplementation files('../../build/outputs/aar/newnode-release.aar')
debugImplementation files('../../build/outputs/aar/newnode-debug.aar')
implementation 'com.bugsnag:bugsnag-android:4.7.0'
implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.0.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
Expand Down
2 changes: 1 addition & 1 deletion android/vpn/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.+'
classpath 'com.android.tools.build:gradle:7.2.+'
}
}

Expand Down
2 changes: 0 additions & 2 deletions android/vpn/newnode/build.gradle

This file was deleted.

27 changes: 0 additions & 27 deletions android/vpn/newnode/newnode.iml

This file was deleted.

4 changes: 2 additions & 2 deletions client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1845,7 +1845,7 @@ void stats_set_timer(network *n, uint64_t ms)
if (stats_report_timer) {
return;
}
debug("%s ms:%"PRIu64"\n", __func__, ms);
//debug("%s ms:%"PRIu64"\n", __func__, ms);
stats_report_timer = timer_start(n, ms, ^{
stats_report_timer = NULL;
stats_report(n);
Expand All @@ -1854,7 +1854,7 @@ void stats_set_timer(network *n, uint64_t ms)

void stats_report(network *n)
{
debug("%s\n", __func__);
//debug("%s\n", __func__);
__block double next_time = -1;
hash_iter(byte_count_per_authority, ^bool (const char *authority, void *val) {
if (streq("stats.newnode.com", authority)) {
Expand Down
2 changes: 1 addition & 1 deletion constants.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __CONSTANTS_H__
#define __CONSTANTS_H__

#define VERSION "2.0.6"
#define VERSION "2.0.7"

#ifdef DEBUG
#define injector_sk "\x9e\x20\xb0\x57\x6d\x12\x70\x33\x05\x42\x66\x4d\x07\x00\xfe\x0a\x60\x94\xe0\x9a\xc5\xb9\xad\x78\xb8\xa6\x56\x3e\x09\xf7\x2a\xd2\x1d\x80\x27\x79\xa0\xb9\x27\xd6\x87\x11\xec\xdc\x33\x7a\xe3\x91\x28\xb8\x07\xf1\xb5\x8c\x42\x74\xf3\xae\x09\xcd\x48\x10\x87\x96"
Expand Down
4 changes: 2 additions & 2 deletions ios/vpn/NewNode VPN/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<string>public.app-category.utilities</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Connect with nearby devices running NewNode.</string>
<key>NSBonjourServices</key>
<array>
<string>_newnode._udp.</string>
Expand All @@ -40,8 +42,6 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Connect with nearby devices running NewNode.</string>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
Expand Down
12 changes: 6 additions & 6 deletions ios/vpn/Tunnel/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSBonjourServices</key>
<array>
<string>_newnode._udp.</string>
</array>
<key>NSLocalNetworkUsageDescription</key>
<string>Connect with nearby devices running NewNode.</string>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
Expand All @@ -26,12 +20,18 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSBonjourServices</key>
<array>
<string>_newnode._udp.</string>
</array>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.networkextension.packet-tunnel</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).PacketTunnelProvider</string>
</dict>
<key>NSLocalNetworkUsageDescription</key>
<string>Connect with nearby devices running NewNode.</string>
</dict>
</plist>

0 comments on commit 2efda6b

Please sign in to comment.