@=pf^3Kcyaw=`58VB>sMG|Yxo9x`{R8JH
zf)k-rQhqaf7U0phiDrgh?(QsMBCyB1h`Tx@t`ZsjxT@2CMn|A*~tpLqMf&U^XNH(iJG&L
z4<9t40Q9MCx|y|Aq{zyVyap)>-_9~Sw@Gf60=i^Kan214q^n;Mr4|}szO>Gh9?!xM+w$YN7YO&
zjJ#}h<#Fq@b>#9A&r9^*lR$2J*6WIt)&G9|p4pd^Tmt{8tmY#HBHzq&=fq_uB@f_P
z2QX
z6pC9=ot07?`M7?c^aLrPtd+0Q21{~XB{$egksyMhe}Nn?tU~Za;BK*Ml!5=aL{B2$
z@$!xOE@h4<<$$(ffo#p&DGix!Hb6=K;wCWj3HokseHs?{kf`T%Fb7$|KinVRbrK{oLA-G@vjeVHI-$n&S65KPi(&L7bu3XtF3qS@>Blmpf*g^&q+}T?3n9+rT31{c
z3{Iah)vV$AiVBGwmZ8prr@g+Pt=xNK1#9(0Ts?Z=
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include
-#include
-#include
-#include
-
-#define BUFFER_SIZE 8092
-
-namespace acgist {
-
-/**
- * 信令
- */
-class Taoyao {
-private:
- // 端口
- int port;
- // 地址
- std::string address;
- // 通道
- int socketChannel;
- // 接收线程
- std::thread acceptThread;
- // 超时
- struct timeval timeout;
- // 地址
- struct sockaddr_in serverAddress;
-private:
- // 当前索引
- int index = 0;
- // 最大索引
- int maxIndex = 999;
- // 终端索引
- int clientIndex = 99999;
- // 索引互斥
- std::mutex indexMutex;
-public:
- /**
- * @param port 端口
- * @param address 地址
- * @param timeout 超时
- */
- Taoyao(int port, std::string address, int timeout);
- /**
- *
- */
- virtual ~Taoyao();
-private:
- /**
- * 生成ID
- */
- long long buildId();
- /**
- * @param signal 信令标识
- * @param body 消息主体
- * @param id 消息ID
- * @param v 消息版本
- *
- * @returns 信令消息
- */
- std::string buildMessage(std::string signal, json body, long long id, std::string v);
- /**
- * 接收消息
- */
- void acceptSignal();
-public:
- /**
- * 连接信令
- */
- void connectSignal();
- /**
- * 推送消息
- */
- void push(std::string message);
- /**
- * 请求消息
- */
- // void request(std::string message);
- /**
- * 关闭信令
- */
- void closeSignal();
-};
-
-}
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/package.json b/taoyao-client-harmony/taoyao/package.json
new file mode 100644
index 0000000..0db3279
--- /dev/null
+++ b/taoyao-client-harmony/taoyao/package.json
@@ -0,0 +1,3 @@
+{
+
+}
diff --git a/taoyao-client-harmony/taoyao/settings.gradle b/taoyao-client-harmony/taoyao/settings.gradle
new file mode 100644
index 0000000..04de2bc
--- /dev/null
+++ b/taoyao-client-harmony/taoyao/settings.gradle
@@ -0,0 +1,2 @@
+rootProject.name = 'taoyao'
+include ':client'
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/src/main.cpp b/taoyao-client-harmony/taoyao/src/main.cpp
deleted file mode 100644
index 4c11003..0000000
--- a/taoyao-client-harmony/taoyao/src/main.cpp
+++ /dev/null
@@ -1,10 +0,0 @@
-#include
-#include "../include/main.hpp"
-
-using std::cout;
-using std::endl;
-
-int main(const int argc, const char **argv) {
- cout << "测试" << endl;
- return 0;
-}
diff --git a/taoyao-client-harmony/taoyao/src/media/AudioPublisher.cpp b/taoyao-client-harmony/taoyao/src/media/AudioPublisher.cpp
deleted file mode 100644
index 68ab873..0000000
--- a/taoyao-client-harmony/taoyao/src/media/AudioPublisher.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../include/AudioPublisher.hpp"
-
-namespace acgist {
-
-}
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/src/media/MediaClient.cpp b/taoyao-client-harmony/taoyao/src/media/MediaClient.cpp
deleted file mode 100644
index 8a4fc03..0000000
--- a/taoyao-client-harmony/taoyao/src/media/MediaClient.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../include/MediaClient.hpp"
-
-namespace acgist {
-
-}
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/src/media/MediaRecorder.cpp b/taoyao-client-harmony/taoyao/src/media/MediaRecorder.cpp
deleted file mode 100644
index 81ef505..0000000
--- a/taoyao-client-harmony/taoyao/src/media/MediaRecorder.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../include/MediaRecorder.hpp"
-
-namespace acgist {
-
-}
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/src/media/VideoPublisher.cpp b/taoyao-client-harmony/taoyao/src/media/VideoPublisher.cpp
deleted file mode 100644
index b806c48..0000000
--- a/taoyao-client-harmony/taoyao/src/media/VideoPublisher.cpp
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../include/VideoPublisher.hpp"
-
-namespace acgist {
-
-}
\ No newline at end of file
diff --git a/taoyao-client-harmony/taoyao/src/signal/Taoyao.cpp b/taoyao-client-harmony/taoyao/src/signal/Taoyao.cpp
deleted file mode 100644
index 0ca1fdb..0000000
--- a/taoyao-client-harmony/taoyao/src/signal/Taoyao.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-#include "../../include/Taoyao.hpp"
-
-namespace acgist {
-
-Taoyao::Taoyao(int port, std::string address, int timeout = 5) {
- this->port = port;
- this->address = address;
- this->socketChannel = 0;
- this->timeout = {timeout, 0};
- memset(&this->serverAddress, 0, sizeof(this->serverAddress));
- this->serverAddress.sin_family = AF_INET;
- this->serverAddress.sin_port = htons(this->port);
- this->serverAddress.sin_addr.s_addr = inet_addr(this->address.c_str());
- // 接收线程
- this->acceptThread = std::thread(&acgist::Taoyao::acceptSignal, this);
-}
-
-Taoyao::~Taoyao() {
-}
-
-long long Taoyao::buildId() {
- this->indexMutex.lock();
- int index = this->index;
- if (++index > this->maxIndex) {
- index = 0;
- }
- this->index = index;
- this->indexMutex.unlock();
- time_t curtime;
- time(&curtime);
- tm *pCurtime = localtime(&curtime);
- return (
- 100000000000000 * pCurtime->tm_mday +
- 1000000000000 * pCurtime->tm_hour +
- 10000000000 * pCurtime->tm_min +
- 100000000 * pCurtime->tm_sec +
- 1000 * this->clientIndex +
- index
- );
-}
-
-std::string Taoyao::buildMessage(std::string signal, json body, long long id = this->buildId(), std::string v = "1.0.0") {
-
-}
-
-void Taoyao::acceptSignal() {
- int status;
- char recvbuf[BUFFER_SIZE];
- while(true) {
- if(this->socketChannel == 0) {
- this->connectSignal();
- continue;
- }
- /**
- * 0 - 服务断开
- * -1 - 网络故障:如果设置超时也会出现
- */
- status = recv(this->socketChannel, recvbuf, sizeof(recvbuf), 0);
- if(status == 0) {
- this->connectSignal();
- continue;
- }
- std::cout << "接收消息:" << status << " - " << recvbuf << std::endl;
- memset(recvbuf, 0, sizeof(recvbuf));
- }
-}
-
-void Taoyao::connectSignal() {
- this->closeSignal();
- this->socketChannel = socket(AF_INET, SOCK_STREAM, 0);
- setsockopt(this->socketChannel, SOL_SOCKET, SO_SNDTIMEO, &this->timeout, sizeof(this->timeout));
- setsockopt(this->socketChannel, SOL_SOCKET, SO_RCVTIMEO, &this->timeout, sizeof(this->timeout));
- if (connect(this->socketChannel, (struct sockaddr *) &this->serverAddress, sizeof(this->serverAddress)) < 0) {
- std::cout << "连接失败:重试" << std::endl;
- this->connectSignal();
- return;
- }
- std::cout << "连接成功:" << this->address << ":" << this->port << std::endl;
-}
-
-void Taoyao::push(std::string message) {
- std::cout << "发送消息:" << message << std::endl;
- char sendbuf[message.length() + 1];
- strncpy(sendbuf, message.c_str(), message.length() + 1);
- send(this->socketChannel, sendbuf, sizeof(sendbuf), 0);
- memset(sendbuf, 0, sizeof(sendbuf));
-}
-
-// void Taoyao::request(std::string message) {
-// }
-
-void Taoyao::closeSignal() {
- if(this->socketChannel != 0) {
- close(this->socketChannel);
- this->socketChannel = 0;
- }
-}
-
-}
-
-int main(int argc, char const *argv[]) {
- acgist::Taoyao taoyao(9999, "192.168.1.100");
- taoyao.connectSignal();
- char sendbuf[BUFFER_SIZE];
- while (fgets(sendbuf, sizeof(sendbuf), stdin) != NULL) {
- taoyao.push(sendbuf);
- }
- return 0;
-}
diff --git a/taoyao-signal-server/taoyao-server/src/main/resources/application.yml b/taoyao-signal-server/taoyao-server/src/main/resources/application.yml
index 27341ad..8dd92a8 100644
--- a/taoyao-signal-server/taoyao-server/src/main/resources/application.yml
+++ b/taoyao-signal-server/taoyao-server/src/main/resources/application.yml
@@ -132,7 +132,7 @@ taoyao:
host: 0.0.0.0
port: 9999
encrypt: DES
- encrypt-key:
+ encrypt-key: 2SPWy+TF1zM=
timeout: ${taoyao.timeout}
queue-size: 100000
min-thread: 4
diff --git a/taoyao-signal-server/taoyao-signal/src/main/java/com/acgist/taoyao/signal/configuration/SocketSignalAutoConfiguration.java b/taoyao-signal-server/taoyao-signal/src/main/java/com/acgist/taoyao/signal/configuration/SocketSignalAutoConfiguration.java
index 12de528..5b0ab3e 100644
--- a/taoyao-signal-server/taoyao-signal/src/main/java/com/acgist/taoyao/signal/configuration/SocketSignalAutoConfiguration.java
+++ b/taoyao-signal-server/taoyao-signal/src/main/java/com/acgist/taoyao/signal/configuration/SocketSignalAutoConfiguration.java
@@ -3,6 +3,7 @@ package com.acgist.taoyao.signal.configuration;
import java.util.Base64;
import java.util.Random;
+import org.apache.commons.lang3.StringUtils;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
@@ -57,7 +58,7 @@ public class SocketSignalAutoConfiguration {
*/
private void buildSecret(SocketProperties socketProperties) {
log.info("Socket信令加密策略:{}", socketProperties.getEncrypt());
- if(socketProperties.getEncrypt() == null) {
+ if(socketProperties.getEncrypt() == null || StringUtils.isNotEmpty(socketProperties.getEncryptKey())) {
return;
}
final Random random = new Random();