├── openNAT
├── test
│ └── test1
├── webservice
│ └── test
├── authentication
│ ├── test
│ ├── src
│ │ └── main
│ │ │ ├── webapp
│ │ │ ├── index.jsp
│ │ │ └── WEB-INF
│ │ │ │ └── web.xml
│ │ │ └── java
│ │ │ └── tech
│ │ │ └── wolfdog
│ │ │ └── kafkaconsumer
│ │ │ ├── WebServiceContactor.java
│ │ │ ├── MessageObserver.java
│ │ │ ├── MessageManager.java
│ │ │ └── AuthenticationMQConsumer.java
│ ├── .settings
│ │ ├── org.eclipse.m2e.core.prefs
│ │ └── org.eclipse.jdt.core.prefs
│ ├── target
│ │ └── classes
│ │ │ └── tech
│ │ │ └── wolfdog
│ │ │ └── kafkaconsumer
│ │ │ ├── MessageManager.class
│ │ │ ├── MessageObserver.class
│ │ │ ├── WebServiceContactor.class
│ │ │ └── AuthenticationMQConsumer.class
│ ├── .project
│ ├── .classpath
│ └── pom.xml
├── openNAT解决方案.doc
├── OpenNAT软件部分HTTP规范.doc
├── dispatcher
│ ├── src
│ │ └── main
│ │ │ ├── webapp
│ │ │ ├── index.jsp
│ │ │ └── WEB-INF
│ │ │ │ └── web.xml
│ │ │ └── java
│ │ │ └── tech
│ │ │ └── wolfdog
│ │ │ └── kafkaproducer
│ │ │ └── DispatcherMQProducer.java
│ ├── .settings
│ │ ├── org.eclipse.m2e.core.prefs
│ │ └── org.eclipse.jdt.core.prefs
│ ├── .project
│ ├── pom.xml
│ └── .classpath
├── cpp_proxy
│ └── test
├── README.md
└── LICENSE
├── newToolTest
├── bin
│ └── com
│ │ └── sunli
│ │ └── newtools
│ │ ├── StrIntTrans.class
│ │ └── PriorityQueueTest.class
├── .classpath
├── .project
├── .settings
│ └── org.eclipse.jdt.core.prefs
├── src
│ └── com
│ │ └── sunli
│ │ └── newtools
│ │ ├── PriorityQueueTest.java
│ │ └── KafkaTest.java
├── Nacos-spring-boot
├── AuthenticationInACM
└── Untitled Diagram.drawio
├── README.md
├── LICENSE
├── Untitled Diagram.drawio
├── reflecxive.drawio
├── 鉴权流程图
└── 推送轨迹方案设计.drawio
/openNAT/test/test1:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/openNAT/webservice/test:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/openNAT/authentication/test:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/openNAT/openNAT解决方案.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/openNAT解决方案.doc
--------------------------------------------------------------------------------
/openNAT/OpenNAT软件部分HTTP规范.doc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/OpenNAT软件部分HTTP规范.doc
--------------------------------------------------------------------------------
/openNAT/dispatcher/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/webapp/index.jsp:
--------------------------------------------------------------------------------
1 |
2 |
3 | Hello World!
4 |
5 |
6 |
--------------------------------------------------------------------------------
/openNAT/cpp_proxy/test:
--------------------------------------------------------------------------------
1 | #include
2 | using namespace std;
3 | int main(){
4 | cout << "Hello world!" << endl;
5 | }
6 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/newToolTest/bin/com/sunli/newtools/StrIntTrans.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/newToolTest/bin/com/sunli/newtools/StrIntTrans.class
--------------------------------------------------------------------------------
/openNAT/authentication/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/newToolTest/bin/com/sunli/newtools/PriorityQueueTest.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/newToolTest/bin/com/sunli/newtools/PriorityQueueTest.class
--------------------------------------------------------------------------------
/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/MessageManager.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/MessageManager.class
--------------------------------------------------------------------------------
/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/MessageObserver.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/MessageObserver.class
--------------------------------------------------------------------------------
/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/WebServiceContactor.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/WebServiceContactor.class
--------------------------------------------------------------------------------
/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/AuthenticationMQConsumer.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realJackSun/OpenNAT/HEAD/openNAT/authentication/target/classes/tech/wolfdog/kafkaconsumer/AuthenticationMQConsumer.class
--------------------------------------------------------------------------------
/openNAT/dispatcher/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/webapp/WEB-INF/web.xml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 | Archetype Created Web Application
7 |
8 |
--------------------------------------------------------------------------------
/newToolTest/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # OpenNAT
2 |
3 | #### 介绍
4 | openNAT是一款轻量级适用于Web开发与部署的内网穿透框架,可以稳定的对web服务提供内网穿透、流量转发服务。
5 |
6 | #### 软件架构
7 | 软件架构包括代理端转发器(cpp_proxy)、服务端传令兵模块(dispatcher)、服务端消息队列(MQ)、鉴权及黑名单(authentication)等模块等。
8 |
9 |
10 | #### 参与贡献
11 |
12 | 1. Fork 本仓库
13 | 2. 新建 Feat_{FeatureName} 分支
14 | 3. 提交代码
15 | 4. 新建 Pull Request
16 |
17 |
18 | #### 加入团队
19 |
20 | 请联系sjtusl@163.com
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/java/tech/wolfdog/kafkaconsumer/WebServiceContactor.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaconsumer;
2 |
3 | import org.apache.kafka.clients.consumer.ConsumerRecords;
4 | /*This class contact the WebService*/
5 | public class WebServiceContactor {
6 | public boolean contactWebService(ConsumerRecords recores) {
7 | return true;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/openNAT/README.md:
--------------------------------------------------------------------------------
1 | # OpenNAT
2 |
3 | #### 介绍
4 | openNAT是一款轻量级适用于Web开发与部署的内网穿透框架,可以稳定的对web服务提供内网穿透、流量转发服务。
5 |
6 | #### 软件架构
7 | 软件架构包括代理端转发器(cpp_proxy)、服务端传令兵模块(dispatcher)、服务端消息队列(MQ)、鉴权及黑名单(authentication)等模块等。
8 |
9 |
10 | #### 参与贡献
11 |
12 | 1. Fork 本仓库
13 | 2. 新建 Feat_{FeatureName} 分支
14 | 3. 提交代码
15 | 4. 新建 Pull Request
16 |
17 |
18 | #### 加入团队
19 |
20 | 请联系sjtusl@163.com
--------------------------------------------------------------------------------
/newToolTest/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | NewToolTest
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 |
15 | org.eclipse.jdt.core.javanature
16 |
17 |
18 |
--------------------------------------------------------------------------------
/openNAT/authentication/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
3 | org.eclipse.jdt.core.compiler.compliance=1.5
4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7 | org.eclipse.jdt.core.compiler.release=disabled
8 | org.eclipse.jdt.core.compiler.source=1.5
9 |
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/java/tech/wolfdog/kafkaconsumer/MessageObserver.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaconsumer;
2 |
3 | import org.apache.kafka.clients.consumer.ConsumerRecords;
4 | /*Observer design pattern*/
5 | class MessageObserver {
6 | ConsumerRecords records = null;
7 |
8 | public ConsumerRecords getRecords() {
9 | return records;
10 | }
11 |
12 | public void setRecords(ConsumerRecords records) {
13 | this.records = records;
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/java/tech/wolfdog/kafkaconsumer/MessageManager.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaconsumer;
2 |
3 | import org.apache.kafka.clients.consumer.ConsumerRecords;
4 | /*This is the Manager of the Authentication module*/
5 | public class MessageManager {
6 | public static void main(String [] args) {
7 | AuthenticationMQConsumer mqConsumer = new AuthenticationMQConsumer();
8 | mqConsumer.getHTTPfromMQ();
9 | ConsumerRecords records = null;
10 | while((records = mqConsumer.getObserver().getRecords())!=null) {
11 | new WebServiceContactor().contactWebService(records);
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | dispatcher
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/newToolTest/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
11 | org.eclipse.jdt.core.compiler.source=1.8
12 |
--------------------------------------------------------------------------------
/openNAT/authentication/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | authentication
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/newToolTest/src/com/sunli/newtools/PriorityQueueTest.java:
--------------------------------------------------------------------------------
1 | package com.sunli.newtools;
2 |
3 | import java.util.PriorityQueue;
4 |
5 | public class PriorityQueueTest {
6 | public static void main(String [] args){
7 | PriorityQueue heap = new PriorityQueue<>(5);
8 | heap.offer(8);
9 | System.out.println(heap.peek());
10 | heap.offer(5);
11 | System.out.println(heap.peek());
12 | heap.offer(6);
13 | System.out.println(heap.peek());
14 | heap.offer(7);
15 | System.out.println(heap.peek());
16 | heap.offer(2);
17 | System.out.println(heap.peek());
18 | heap.offer(3);
19 | System.out.println(heap.peek());
20 | int a = heap.poll();
21 | System.out.println(a);
22 | System.out.println(heap.peek());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
5 | org.eclipse.jdt.core.compiler.compliance=1.8
6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
10 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
14 | org.eclipse.jdt.core.compiler.release=disabled
15 | org.eclipse.jdt.core.compiler.source=1.8
16 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | tech.wolfdog
5 | kafkaproducer
6 | war
7 | 0.0.1-SNAPSHOT
8 | kafkaproducer Maven Webapp
9 | http://maven.apache.org
10 |
11 |
12 | junit
13 | junit
14 | 4.13.1
15 | test
16 |
17 |
18 | org.apache.kafka
19 | kafka-clients
20 | 2.0.0
21 |
22 |
23 |
24 | kafkaproducer
25 |
26 |
27 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 孙立
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/openNAT/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 孙立
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/openNAT/authentication/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/openNAT/authentication/pom.xml:
--------------------------------------------------------------------------------
1 |
3 | 4.0.0
4 | tech.wolfdog
5 | kafkaconsumer
6 | war
7 | 0.0.1-SNAPSHOT
8 | kafkaproducer Maven Webapp
9 | http://maven.apache.org
10 |
11 |
12 | 2.11
13 | 1.7.21
14 | 2.0.0
15 | 1.18.8
16 | 4.11
17 | 2.2.4
18 | 1.5.4
19 | 2.3.1
20 |
21 |
22 |
23 | junit
24 | junit
25 | 4.13.1
26 | test
27 |
28 |
29 |
30 | org.apache.kafka
31 | kafka-clients
32 | 2.0.0
33 |
34 |
35 |
36 | kafkaconsumer
37 |
38 |
39 |
--------------------------------------------------------------------------------
/openNAT/authentication/src/main/java/tech/wolfdog/kafkaconsumer/AuthenticationMQConsumer.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaconsumer;
2 |
3 | import java.time.Duration;
4 | import java.util.Arrays;
5 | import java.util.Properties;
6 |
7 | import org.apache.kafka.clients.consumer.Consumer;
8 | import org.apache.kafka.clients.consumer.ConsumerRecord;
9 | import org.apache.kafka.clients.consumer.ConsumerRecords;
10 | import org.apache.kafka.clients.consumer.KafkaConsumer;
11 |
12 |
13 | public class AuthenticationMQConsumer {
14 | private MessageObserver observer = new MessageObserver();
15 |
16 | public MessageObserver getObserver() {
17 | return observer;
18 | }
19 |
20 | public void getHTTPfromMQ() {
21 | String topic = "test";
22 | Properties props = new Properties();
23 | props.put("bootstrap.servers", "localhost:9092");
24 | props.put("group.id", "testGroup1");
25 | props.put("enable.auto.commit", "true");
26 | props.put("auto.commit.interval.ms", "1000");
27 | props.put("key.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
28 | props.put("value.deserializer", "org.apache.kafka.common.serialization.StringDeserializer");
29 | Consumer consumer = new KafkaConsumer(props);
30 | consumer.subscribe(Arrays.asList(topic));
31 | while (true) {
32 | //Duration d = new Duration(0, 0);
33 | @SuppressWarnings("deprecation")
34 | ConsumerRecords records = consumer.poll(100);
35 | observer.setRecords(records);
36 | //for (ConsumerRecord record : records) {
37 | //System.out.printf("partition = %d, offset = %d, key = %s, value = %s%n", record.partition(), record.offset(), record.key(), record.value());
38 | //}
39 |
40 |
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/newToolTest/src/com/sunli/newtools/KafkaTest.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaproducer;
2 |
3 | import org.apache.kafka.clients.producer.Producer;
4 | import org.apache.kafka.clients.producer.ProducerConfig;
5 | import org.apache.kafka.clients.producer.ProducerRecord;
6 | import org.apache.kafka.clients.producer.RecordMetadata;
7 | import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
8 | import org.apache.kafka.common.serialization.StringSerializer;
9 |
10 | import java.util.HashMap;
11 | import java.util.Map;
12 | /**
13 | * {@code DispatcherMQProducer} writes HTTP message into the MQ.
14 | *
15 | * @author Li Sun (sjtusl@163.com)
16 | */
17 | public class KafkaTest {
18 | /**
19 | * Returns {@code true} if this task completed.
20 | *
21 | * Completion may be due to normal termination, an exception, or
22 | * cancellation -- in all of these cases, this method will return
23 | * {@code true}.
24 | *
25 | * @return {@code true} if this task completed
26 | */
27 | public boolean saveHTTPtoMQ (String topic,String key,String httpBody){
28 | ThreadLocal sendSuccess = new ThreadLocal();
29 | sendSuccess.set(true);
30 | Map props = new HashMap();
31 | props.put("bootstrap.servers", "localhost:9092");
32 | //System.out.println(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG);
33 | props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
34 | //props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
35 | props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
36 | //props.put("value.serializer","org.apache.kafka.common.serialization.StringSerializer");
37 | props.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName());
38 | Producer producer = new org.apache.kafka.clients.producer.KafkaProducer(props);
39 | producer.send(new ProducerRecord(topic, key, httpBody)
40 | ,(RecordMetadata metadata,Exception exception)->{
41 | System.out.println("Sending message...");
42 | if(exception == null) {
43 | System.out.println("I have send the message");
44 | sendSuccess.set(new Boolean(true));
45 | }else {
46 | sendSuccess.set(false);
47 | }
48 |
49 | });
50 | producer.close();
51 | return sendSuccess.get();
52 | }
53 | public static void main(String [] args) {
54 | System.out.println(new DispatcherMQProducer().saveHTTPtoMQ("test","test-key", "{User-agent:chrome}"));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/openNAT/dispatcher/src/main/java/tech/wolfdog/kafkaproducer/DispatcherMQProducer.java:
--------------------------------------------------------------------------------
1 | package tech.wolfdog.kafkaproducer;
2 |
3 | import org.apache.kafka.clients.producer.Producer;
4 | import org.apache.kafka.clients.producer.ProducerConfig;
5 | import org.apache.kafka.clients.producer.ProducerRecord;
6 | import org.apache.kafka.clients.producer.RecordMetadata;
7 | import org.apache.kafka.clients.producer.internals.DefaultPartitioner;
8 | import org.apache.kafka.common.serialization.StringSerializer;
9 |
10 | import java.util.HashMap;
11 | import java.util.Map;
12 | /**
13 | * {@code DispatcherMQProducer} writes HTTP message into the MQ.
14 | *
15 | * @author Li Sun (sjtusl@163.com)
16 | */
17 | public class DispatcherMQProducer {
18 | /**
19 | * Returns {@code true} if this task completed.
20 | *
21 | * Completion may be due to normal termination, an exception, or
22 | * cancellation -- in all of these cases, this method will return
23 | * {@code true}.
24 | *
25 | * @return {@code true} if this task completed
26 | */
27 | public boolean saveHTTPtoMQ (String topic,String key,String httpBody){
28 | ThreadLocal sendSuccess = new ThreadLocal();
29 | sendSuccess.set(true);
30 | Map props = new HashMap();
31 | props.put("bootstrap.servers", "localhost:9092");
32 | //System.out.println(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG);
33 | props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
34 | //props.put("key.serializer", "org.apache.kafka.common.serialization.StringSerializer");
35 | props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
36 | //props.put("value.serializer","org.apache.kafka.common.serialization.StringSerializer");
37 | props.put(ProducerConfig.PARTITIONER_CLASS_CONFIG, DefaultPartitioner.class.getName());
38 | Producer producer = new org.apache.kafka.clients.producer.KafkaProducer(props);
39 | producer.send(new ProducerRecord(topic, key, httpBody)
40 | ,(RecordMetadata metadata,Exception exception)->{
41 | System.out.println("Sending message...");
42 | if(exception == null) {
43 | System.out.println("I have send the message");
44 | sendSuccess.set(new Boolean(true));
45 | }else {
46 | sendSuccess.set(false);
47 | }
48 |
49 | });
50 | producer.close();
51 | return sendSuccess.get();
52 | }
53 | public static void main(String [] args) {
54 | System.out.println(new DispatcherMQProducer().saveHTTPtoMQ("test","test-key", "{User-agent:chrome}"));
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/Untitled Diagram.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/newToolTest/Nacos-spring-boot:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
--------------------------------------------------------------------------------
/reflecxive.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/newToolTest/AuthenticationInACM:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
--------------------------------------------------------------------------------
/newToolTest/Untitled Diagram.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
--------------------------------------------------------------------------------
/鉴权流程图:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
--------------------------------------------------------------------------------
/推送轨迹方案设计.drawio:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
--------------------------------------------------------------------------------