2021-07-29 10:02:31 +08:00
|
|
|
|
package com.zdjizhi.common;
|
|
|
|
|
|
|
|
|
|
|
|
import com.zdjizhi.utils.CommonConfigurations;
|
2022-04-08 10:16:29 +08:00
|
|
|
|
import com.zdjizhi.utils.NacosUtils;
|
2021-12-20 13:50:18 +08:00
|
|
|
|
import org.jasypt.encryption.pbe.StandardPBEStringEncryptor;
|
2021-07-29 10:02:31 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2021-10-22 18:38:29 +08:00
|
|
|
|
* @author wlh
|
|
|
|
|
|
* @date 2021/1/6
|
2021-07-29 10:02:31 +08:00
|
|
|
|
*/
|
|
|
|
|
|
public class CommonConfig {
|
|
|
|
|
|
|
2021-12-20 13:50:18 +08:00
|
|
|
|
private static StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
|
|
|
|
|
|
|
|
|
|
|
static {
|
|
|
|
|
|
encryptor.setPassword("galaxy");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-07-29 10:02:31 +08:00
|
|
|
|
public static final int STREAM_EXECUTION_ENVIRONMENT_PARALLELISM = CommonConfigurations.getIntProperty("stream.execution.environment.parallelism");
|
2021-07-30 10:55:01 +08:00
|
|
|
|
public static final String STREAM_EXECUTION_JOB_NAME = CommonConfigurations.getStringProperty("stream.execution.job.name");
|
2021-07-29 10:02:31 +08:00
|
|
|
|
|
|
|
|
|
|
public static final int KAFKA_INPUT_PARALLELISM = CommonConfigurations.getIntProperty("kafka.input.parallelism");
|
|
|
|
|
|
public static final String KAFKA_INPUT_TOPIC_NAME = CommonConfigurations.getStringProperty("kafka.input.topic.name");
|
|
|
|
|
|
public static final String KAFKA_INPUT_BOOTSTRAP_SERVERS = CommonConfigurations.getStringProperty("kafka.input.bootstrap.servers");
|
|
|
|
|
|
public static final String KAFKA_GROUP_ID = CommonConfigurations.getStringProperty("kafka.input.group.id");
|
|
|
|
|
|
|
|
|
|
|
|
public static final int KAFKA_OUTPUT_METRIC_PARALLELISM = CommonConfigurations.getIntProperty("kafka.output.metric.parallelism");
|
|
|
|
|
|
public static final String KAFKA_OUTPUT_METRIC_TOPIC_NAME = CommonConfigurations.getStringProperty("kafka.output.metric.topic.name");
|
|
|
|
|
|
public static final int KAFKA_OUTPUT_EVENT_PARALLELISM = CommonConfigurations.getIntProperty("kafka.output.event.parallelism");
|
|
|
|
|
|
public static final String KAFKA_OUTPUT_EVENT_TOPIC_NAME = CommonConfigurations.getStringProperty("kafka.output.event.topic.name");
|
|
|
|
|
|
public static final String KAFKA_OUTPUT_BOOTSTRAP_SERVERS = CommonConfigurations.getStringProperty("kafka.output.bootstrap.servers");
|
|
|
|
|
|
|
|
|
|
|
|
public static final String HBASE_ZOOKEEPER_QUORUM = CommonConfigurations.getStringProperty("hbase.zookeeper.quorum");
|
|
|
|
|
|
public static final int HBASE_CLIENT_OPERATION_TIMEOUT = CommonConfigurations.getIntProperty("hbase.client.operation.timeout");
|
|
|
|
|
|
public static final int HBASE_CLIENT_SCANNER_TIMEOUT_PERIOD = CommonConfigurations.getIntProperty("hbase.client.scanner.timeout.period");
|
|
|
|
|
|
|
|
|
|
|
|
public static final String HBASE_BASELINE_TABLE_NAME = CommonConfigurations.getStringProperty("hbase.baseline.table.name");
|
|
|
|
|
|
public static final int HBASE_BASELINE_TOTAL_NUM = CommonConfigurations.getIntProperty("hbase.baseline.total.num");
|
2021-12-08 13:51:09 +08:00
|
|
|
|
public static final int HBASE_BASELINE_TTL = CommonConfigurations.getIntProperty("hbase.baseline.ttl");
|
2021-07-29 10:02:31 +08:00
|
|
|
|
|
2021-08-02 18:11:29 +08:00
|
|
|
|
public static final int FLINK_FIRST_AGG_PARALLELISM = CommonConfigurations.getIntProperty("flink.first.agg.parallelism");
|
2021-08-16 18:24:13 +08:00
|
|
|
|
public static final int FLINK_DETECTION_MAP_PARALLELISM = CommonConfigurations.getIntProperty("flink.detection.map.parallelism");
|
2021-07-29 10:02:31 +08:00
|
|
|
|
public static final int FLINK_WATERMARK_MAX_ORDERNESS = CommonConfigurations.getIntProperty("flink.watermark.max.orderness");
|
|
|
|
|
|
public static final int FLINK_WINDOW_MAX_TIME = CommonConfigurations.getIntProperty("flink.window.max.time");
|
|
|
|
|
|
|
|
|
|
|
|
public static final int SOURCE_IP_LIST_LIMIT = CommonConfigurations.getIntProperty("source.ip.list.limit");
|
2021-08-09 18:28:52 +08:00
|
|
|
|
public static final int DESTINATION_IP_PARTITION_NUM = CommonConfigurations.getIntProperty("destination.ip.partition.num");
|
2021-07-29 10:02:31 +08:00
|
|
|
|
public static final int DATA_CENTER_ID_NUM = CommonConfigurations.getIntProperty("data.center.id.num");
|
|
|
|
|
|
|
|
|
|
|
|
public static final String IP_MMDB_PATH = CommonConfigurations.getStringProperty("ip.mmdb.path");
|
|
|
|
|
|
|
2022-04-08 10:16:29 +08:00
|
|
|
|
public static final int STATIC_SENSITIVITY_THRESHOLD = NacosUtils.getIntProperty("static.sensitivity.threshold");
|
|
|
|
|
|
public static final double BASELINE_SENSITIVITY_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sensitivity.threshold");
|
2021-09-09 10:46:50 +08:00
|
|
|
|
|
2022-04-08 10:16:29 +08:00
|
|
|
|
public static final double BASELINE_SESSIONS_MINOR_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sessions.minor.threshold");
|
|
|
|
|
|
public static final double BASELINE_SESSIONS_WARNING_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sessions.warning.threshold");
|
|
|
|
|
|
public static final double BASELINE_SESSIONS_MAJOR_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sessions.major.threshold");
|
|
|
|
|
|
public static final double BASELINE_SESSIONS_SEVERE_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sessions.severe.threshold");
|
|
|
|
|
|
public static final double BASELINE_SESSIONS_CRITICAL_THRESHOLD = NacosUtils.getDoubleProperty("baseline.sessions.critical.threshold");
|
2021-07-29 10:02:31 +08:00
|
|
|
|
|
2021-08-17 18:56:53 +08:00
|
|
|
|
public static final String BIFANG_SERVER_URI = CommonConfigurations.getStringProperty("bifang.server.uri");
|
2021-09-15 10:08:17 +08:00
|
|
|
|
public static final String BIFANG_SERVER_TOKEN = CommonConfigurations.getStringProperty("bifang.server.token");
|
2021-08-17 18:56:53 +08:00
|
|
|
|
public static final String BIFANG_SERVER_ENCRYPTPWD_PATH = CommonConfigurations.getStringProperty("bifang.server.encryptpwd.path");
|
|
|
|
|
|
public static final String BIFANG_SERVER_LOGIN_PATH = CommonConfigurations.getStringProperty("bifang.server.login.path");
|
|
|
|
|
|
public static final String BIFANG_SERVER_POLICY_THRESHOLD_PATH = CommonConfigurations.getStringProperty("bifang.server.policy.threshold.path");
|
|
|
|
|
|
|
2022-05-31 18:00:36 +08:00
|
|
|
|
public static final String BIFANG_SERVER_POLICY_VSYSID_PATH = CommonConfigurations.getStringProperty("bifang.server.policy.vaysid.path");
|
|
|
|
|
|
|
2021-08-17 18:56:53 +08:00
|
|
|
|
public static final int HTTP_POOL_MAX_CONNECTION = CommonConfigurations.getIntProperty("http.pool.max.connection");
|
|
|
|
|
|
public static final int HTTP_POOL_MAX_PER_ROUTE = CommonConfigurations.getIntProperty("http.pool.max.per.route");
|
|
|
|
|
|
public static final int HTTP_POOL_REQUEST_TIMEOUT = CommonConfigurations.getIntProperty("http.pool.request.timeout");
|
|
|
|
|
|
public static final int HTTP_POOL_CONNECT_TIMEOUT = CommonConfigurations.getIntProperty("http.pool.connect.timeout");
|
|
|
|
|
|
public static final int HTTP_POOL_RESPONSE_TIMEOUT = CommonConfigurations.getIntProperty("http.pool.response.timeout");
|
|
|
|
|
|
|
2021-08-24 16:35:31 +08:00
|
|
|
|
public static final int STATIC_THRESHOLD_SCHEDULE_MINUTES = CommonConfigurations.getIntProperty("static.threshold.schedule.minutes");
|
|
|
|
|
|
public static final int BASELINE_THRESHOLD_SCHEDULE_DAYS = CommonConfigurations.getIntProperty("baseline.threshold.schedule.days");
|
|
|
|
|
|
|
2021-09-06 16:19:33 +08:00
|
|
|
|
public static final String SASL_JAAS_CONFIG_USER = CommonConfigurations.getStringProperty("sasl.jaas.config.user");
|
2021-12-20 13:50:18 +08:00
|
|
|
|
public static final String SASL_JAAS_CONFIG_PASSWORD = encryptor.decrypt(CommonConfigurations.getStringProperty("sasl.jaas.config.password"));
|
2021-09-06 16:19:33 +08:00
|
|
|
|
|
2021-09-14 18:46:23 +08:00
|
|
|
|
public static final int SASL_JAAS_CONFIG_FLAG = CommonConfigurations.getIntProperty("sasl.jaas.config.flag");
|
2021-12-20 13:50:18 +08:00
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
|
StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();
|
|
|
|
|
|
// 配置加密解密的密码/salt值
|
|
|
|
|
|
encryptor.setPassword("galaxy");
|
|
|
|
|
|
// 对"raw_password"进行加密:S5kR+Y7CI8k7MaecZpde25yK8NKUnd6p
|
2022-04-08 10:16:29 +08:00
|
|
|
|
// String password = "galaxy2019";
|
|
|
|
|
|
String password = "nacos";
|
2021-12-20 13:50:18 +08:00
|
|
|
|
String encPwd = encryptor.encrypt(password);
|
|
|
|
|
|
System.out.println(encPwd);
|
|
|
|
|
|
// 再进行解密:raw_password
|
|
|
|
|
|
String rawPwd = encryptor.decrypt(encPwd);
|
|
|
|
|
|
System.out.println(rawPwd);
|
|
|
|
|
|
}
|
2021-07-29 10:02:31 +08:00
|
|
|
|
}
|