diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c446418
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,43 @@
+# Created by .ignore support plugin (hsz.mobi)
+*.class
+
+# Mobile Tools for Java (J2ME)
+.mtj.tmp/
+
+# Package Files #
+*.jar
+*.war
+*.ear
+*.zip
+
+# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
+hs_err_pid*
+
+
+target/
+!.mvn/wrapper/maven-wrapper.jar
+
+### STS ###
+.apt_generated
+.classpath
+.factorypath
+.project
+.settings
+.springBeans
+
+### IntelliJ IDEA ###
+.idea
+*.iws
+*.iml
+*.ipr
+
+### NetBeans ###
+nbproject/private/
+builds/
+nbbuild/
+dist/
+nbdist/
+.nb-gradle/
+
+log/
+logs/
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..20e75ff
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,114 @@
+
+
+ 4.0.0
+
+ cn.mesalab
+ generate-baselines
+ 1.0-SNAPSHOT
+
+
+
+ org.apache.maven.plugins
+ maven-jar-plugin
+ 3.0.2
+
+
+
+ true
+ cn.mesalab.main.BaselineApplication
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+ 8
+ 8
+
+
+
+
+
+
+
+ nexus
+ Team Nexus Repository
+ http://192.168.40.125:8099/content/groups/public
+
+
+
+
+ nexus
+ Team Nexus Repository
+ http://192.168.40.125:8099/content/groups/public
+
+
+
+
+
+ org.apache.hbase
+ hbase-client
+ 2.2.3
+
+
+
+ org.jfree
+ jfreechart
+ 1.0.18
+
+
+
+ org.apache.calcite.avatica
+ avatica-core
+ 1.15.0
+
+
+
+ com.typesafe
+ config
+ 1.2.1
+
+
+
+ com.google.protobuf
+ protobuf-java
+ 3.5.1
+
+
+
+ io.vavr
+ vavr
+ 0.10.2
+
+
+
+ org.springframework
+ spring-core
+ 5.1.4.RELEASE
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.26
+
+
+ com.zdjizhi
+ galaxy
+ 1.0.6
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/META-INF/MANIFEST.MF b/src/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..4993e7c
--- /dev/null
+++ b/src/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Main-Class: cn.mesalab.main.BaselineApplication
+
diff --git a/src/main/java/cn/mesalab/config/ApplicationConfig.java b/src/main/java/cn/mesalab/config/ApplicationConfig.java
new file mode 100644
index 0000000..68b8c50
--- /dev/null
+++ b/src/main/java/cn/mesalab/config/ApplicationConfig.java
@@ -0,0 +1,64 @@
+package cn.mesalab.config;
+
+import cn.mesalab.utils.ConfigUtils;
+
+/**
+ * @author yjy
+ * @version 1.0
+ * @date 2021/7/24 10:23 上午
+ */
+public class ApplicationConfig {
+
+ public static final String DRUID_URL= ConfigUtils.getStringProperty("druid.url");
+ public static final String DRUID_DRIVER = ConfigUtils.getStringProperty("druid.driver");
+ public static final String DRUID_TABLE = ConfigUtils.getStringProperty("druid.table");
+
+
+ public static final Integer DRUID_TIME_LIMIT_TYPE = ConfigUtils.getIntProperty("read.druid.time.limit.type");
+ public static final Long READ_DRUID_MAX_TIME = ConfigUtils.getLongProperty("read.druid.max.time");
+ public static final Long READ_DRUID_MIN_TIME = ConfigUtils.getLongProperty("read.druid.min.time");
+
+ public static final Integer READ_HISTORICAL_DAYS = ConfigUtils.getIntProperty("read.historical.days");
+ public static final Integer HISTORICAL_GRAD = ConfigUtils.getIntProperty("historical.grad");
+ public static final String TIME_FORMAT = ConfigUtils.getStringProperty("time.format");
+ public static final String BASELINE_METRIC_TYPE = ConfigUtils.getStringProperty("baseline.metric.type");
+
+ public static final String DRUID_ATTACKTYPE_TCP_SYN_FLOOD = ConfigUtils.getStringProperty("druid.attacktype.tcpsynflood");
+ public static final String DRUID_ATTACKTYPE_UDP_FLOOD = ConfigUtils.getStringProperty("druid.attacktype.udpflood");
+ public static final String DRUID_ATTACKTYPE_ICMP_FLOOD = ConfigUtils.getStringProperty("druid.attacktype.icmpflood");
+ public static final String DRUID_ATTACKTYPE_DNS_AMPL = ConfigUtils.getStringProperty("druid.attacktype.dnsamplification");
+ public static final String DRUID_SERVERIP_COLUMN_NAME = ConfigUtils.getStringProperty("druid.serverip.columnname");
+ public static final String DRUID_ATTACKTYPE_COLUMN_NAME = ConfigUtils.getStringProperty("druid.attacktype.columnname");
+ public static final String DRUID_RECVTIME_COLUMN_NAME = ConfigUtils.getStringProperty("druid.recvtime.columnname");
+
+ public static final float BASELINE_PERIOD_CORR_THRE = ConfigUtils.getFloatProperty("baseline.period.correlative.threshold");
+ public static final float BASELINE_HISTORICAL_RATIO = ConfigUtils.getFloatProperty("baseline.historical.ratio.threshold");
+ public static final float BASELINE_SPARSE_FILL_PERCENTILE = ConfigUtils.getFloatProperty("baseline.historical.sparse.fill.percentile");
+ public static final String BASELINE_FUNCTION = ConfigUtils.getStringProperty("baseline.function");
+ public static final Integer BASELINE_RANGE_DAYS = ConfigUtils.getIntProperty("baseline.range.days");
+ public static final float BASELINE_RATIONAL_PERCENTILE = ConfigUtils.getFloatProperty("baseline.rational.percentile");
+
+
+ public static final String HBASE_TABLE = ConfigUtils.getStringProperty("hbase.table");
+ public static final String HBASE_ZOOKEEPER_QUORUM= ConfigUtils.getStringProperty("hbase.zookeeper.quorum");
+ public static final String HBASE_ZOOKEEPER_CLIENT_PORT= ConfigUtils.getStringProperty("hbase.zookeeper.client.port");
+
+
+ public static final Double BASELINE_KALMAN_Q = ConfigUtils.getDoubleProperty("baseline.kalman.q");
+ public static final Double BASELINE_KALMAN_R = ConfigUtils.getDoubleProperty("baseline.kalman.r");
+
+ public static final Integer LOG_WRITE_COUNT = ConfigUtils.getIntProperty("log.write.count");
+ public static final Integer GENERATE_BATCH_SIZE = ConfigUtils.getIntProperty("generate.batch.size");
+
+
+
+ // http config
+
+ public static final Integer HTTP_REQUEST_TIMEOUT = ConfigUtils.getIntProperty("http.request.timeout");
+ public static final Integer HTTP_RESPONSE_TIMEOUT = ConfigUtils.getIntProperty("http.response.timeout");
+ public static final Integer HTTP_CONNECTION_TIMEOUT = ConfigUtils.getIntProperty("http.connection.timeout");
+ public static final Integer HTTP_MAX_CONNECTION_NUM = ConfigUtils.getIntProperty("http.max.connection.num");
+ public static final Integer HTTP_MAX_PER_ROUTE = ConfigUtils.getIntProperty("http.max.per.route");
+
+}
+
diff --git a/src/main/java/cn/mesalab/dao/DruidData.java b/src/main/java/cn/mesalab/dao/DruidData.java
new file mode 100644
index 0000000..ec28278
--- /dev/null
+++ b/src/main/java/cn/mesalab/dao/DruidData.java
@@ -0,0 +1,187 @@
+package cn.mesalab.dao;
+
+import cn.mesalab.config.ApplicationConfig;
+import cn.mesalab.dao.Impl.ResultSetToListServiceImp;
+import cn.mesalab.utils.DruidUtils;
+import io.vavr.Tuple;
+import io.vavr.Tuple2;
+import org.apache.calcite.avatica.AvaticaConnection;
+import org.apache.calcite.avatica.AvaticaStatement;
+import org.apache.commons.lang.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * @author yjy
+ * @version 1.0
+ * Druid 数据库操作
+ * @date 2021/7/23 4:56 下午
+ */
+public class DruidData {
+
+ private static final Logger LOG = LoggerFactory.getLogger(DruidData.class);
+ private static DruidData druidData;
+ private AvaticaConnection connection;
+ private AvaticaStatement statement;
+ private String timeFilter = ApplicationConfig.DRUID_RECVTIME_COLUMN_NAME
+ + " >= MILLIS_TO_TIMESTAMP(" + getTimeLimit()._2
+ + ") AND " + ApplicationConfig.DRUID_RECVTIME_COLUMN_NAME
+ + " < MILLIS_TO_TIMESTAMP(" + getTimeLimit()._1 + ")";
+
+
+ {
+ connectionInit();
+ }
+
+ /**
+ * 连接初始化
+ */
+ private void connectionInit(){
+ try {
+ connection = DruidUtils.getConn();
+ statement = connection.createStatement();
+ statement.setQueryTimeout(0);
+
+ } catch (SQLException exception) {
+ exception.printStackTrace();
+ }
+ }
+
+ /**
+ * 获取实例
+ * @return DruidData实例
+ */
+ public static DruidData getInstance() {
+ druidData = new DruidData();
+ return druidData;
+ }
+
+ /**
+ * 获取distinct server ip
+ * @return ArrayList ip列表
+ */
+ public ArrayList getServerIpList() {
+ Long startQueryIpLIstTime = System.currentTimeMillis();
+ ArrayList serverIps = new ArrayList();
+ String sql = "SELECT distinct " + ApplicationConfig.DRUID_SERVERIP_COLUMN_NAME
+ + " FROM " + ApplicationConfig.DRUID_TABLE
+ + " WHERE " + timeFilter
+ + " LIMIT 1000";// FOR TEST
+ try{
+ ResultSet resultSet = DruidUtils.executeQuery(statement,sql);
+ while(resultSet.next()){
+ String ip = resultSet.getString(ApplicationConfig.DRUID_SERVERIP_COLUMN_NAME);
+ serverIps.add(ip);
+ }
+ } catch (Exception e){
+ e.printStackTrace();
+ }
+ Long endQueryIpListTime = System.currentTimeMillis();
+ LOG.info("性能测试:ip list查询耗时——"+(endQueryIpListTime-startQueryIpLIstTime));
+
+ return serverIps;
+ }
+
+ /**
+ * 从Druid读取目标IP相关数据
+ * @param ipList ip列表
+ * @return 数据库读取结果
+ */
+ public List