OCT 1. 更新DEMO文档,Android SDK版本

This commit is contained in:
黄昕 2023-12-13 09:36:04 +08:00
parent 29dfb9caf1
commit fe1e2b7740
3 changed files with 18 additions and 19 deletions

View File

@ -4,12 +4,12 @@ plugins {
android {
namespace = "com.example.sccproxy"
compileSdk = 33
compileSdk = 34
defaultConfig {
applicationId = "com.example.sccproxy"
minSdk = 24
targetSdk = 33
targetSdk = 34
versionCode = 1
versionName = "1.0"
@ -42,9 +42,8 @@ android {
}
dependencies {
implementation("androidx.appcompat:appcompat:1.6.1")
implementation("com.google.android.material:material:1.8.0")
implementation("com.google.android.material:material:1.10.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")

View File

@ -37,8 +37,8 @@ static void connect_scg_server() {
ANDROID_LOG(ANDROID_LOG_INFO, "SCGPROXY", "connect_scg_server: %d\n", ret);
}
#endif
extern "C" JNIEXPORT jstring JNICALL
Java_com_example_sccproxy_MainActivity_stringFromJNI(
JNIEnv *env,
@ -87,7 +87,7 @@ Java_com_example_sccproxy_MainActivity_stringFromJNI(
goto error;
}
#if 0
#if 1
//-----------------------------------------------------------------------
// 隧道控制,每次启动/停止 SCC 服务时调用
//-----------------------------------------------------------------------
@ -108,7 +108,7 @@ Java_com_example_sccproxy_MainActivity_stringFromJNI(
"vmName": "ct-pool-95-1696922439711",
"vmId": 827, // TODO Set to vmid (Step 3)
"extVmId": "a3adc00b-d794-46b7-bb83-1951f3368cfb",
"vmNetwork": "172.31.18.108/24",
"vmNetwork": "172.31.18.108/24", // TODO Set to local wireguard configure peer AllowedIPs
"scgIp": "112.17.28.220",
"scgPort": 1080,
"portMapIp": "112.17.28.221",
@ -132,12 +132,12 @@ Java_com_example_sccproxy_MainActivity_stringFromJNI(
// TODO
/**
[Interface]
PrivateKey = 6PIYlZHVDzRbgvfWgeu27OfO0NeN8WrFBMAa56hIL0M= // TODO from (step 1)
Address = 10.10.10.1/24 // TODO from (step 1)
PrivateKey = 6PIYlZHVDzRbgvfWgeu27OfO0NeN8WrFBMAa56hIL0M= // TODO from (step 1), Server Response JSON: cliPriKey
Address = 10.10.10.1/24 // TODO from (step 1), Server Response JSON: cliHost
[Peer]
PublicKey = nssKUB0d+uRLiys/YzCqA0n8xhw6fuRgs2Q5asEAExc= // TODO from (step 1)
AllowedIPs = 10.10.10.0/24,172.31.18.0/24 // TODO from (Step 1 pCliTunNetwork and svrTunnelNetwork)
PublicKey = nssKUB0d+uRLiys/YzCqA0n8xhw6fuRgs2Q5asEAExc= // TODO from (step 1), Server Response JSON: svrPubKey
AllowedIPs = 10.10.10.0/24, 172.31.18.0/24 // TODO from (Step 1 pCliTunNetwork(10.10.10.0) and Server Response JSON: vmNetwork(172.31.18.108))
Endpoint = 127.0.0.1:49301 // TODO Port from tunnelProxyPort (Init Step 2)
PersistentKeepalive = 30 // TODO fixed or configure by user
*/

View File

@ -318,7 +318,7 @@ int remote_tunnel_set_params(const char *pCliPubKey, const char *pCliNetwork, co
cJSON *pMsgContent;
cJSON *pRspCode;
cJSON *pSvrNet;
char url[1024];
char tempStr[1024];
sion::Response resp;
if (pCliPubKey == nullptr || strlen(pCliPubKey) == 0) {
@ -377,12 +377,12 @@ int remote_tunnel_set_params(const char *pCliPubKey, const char *pCliNetwork, co
pJsonString = cJSON_PrintUnformatted(pRoot);
cJSON_Delete(pRoot);
memset(url, 0, 1024);
snprintf(url, 1024, "%s%s", g_scgProxyCfg.scgProxyUrl, SET_CLIENTCFG_PATH);
memset(tempStr, 0, 1024);
snprintf(tempStr, 1024, "%s%s", g_scgProxyCfg.scgProxyUrl, SET_CLIENTCFG_PATH);
try {
resp = sion::Request()
.SetUrl(url)
.SetUrl(tempStr)
.SetHttpMethod(sion::Method::Post)
.SetHeader("Content-type", "application/json")
.SetBody(pJsonString)
@ -407,10 +407,10 @@ int remote_tunnel_set_params(const char *pCliPubKey, const char *pCliNetwork, co
return -ERR_HTTP_SERVER_RSP;
}
#if 0
memset(url, 0, 1024);
//sprintf(url, "%s", g_scgProxyCfg.)
snprintf(url, 1024, "http://%s:%d%s", g_scgProxyCfg.scgProxyIpAddr, g_scgProxyCfg.scgProxyPort, SET_CLIENTCFG_PATH);
char *resp = http_post(url, pJsonString);
memset(tempStr, 0, 1024);
//sprintf(tempStr, "%s", g_scgProxyCfg.)
snprintf(tempStr, 1024, "http://%s:%d%s", g_scgProxyCfg.scgProxyIpAddr, g_scgProxyCfg.scgProxyPort, SET_CLIENTCFG_PATH);
char *resp = http_post(tempStr, pJsonString);
if (resp == nullptr) {
ANDROID_LOG(ANDROID_LOG_ERROR, "SCGPROXY", "[%s]:Post Data %s recv NULL\n", SET_CLIENTCFG_PATH, pJsonString);