├── .idea ├── .name ├── .gitignore ├── vcs.xml ├── libraries │ ├── Maven__junit_junit_4_12.xml │ ├── Maven__log4j_log4j_1_2_14.xml │ ├── Maven__org_ow2_asm_asm_5_0_4.xml │ ├── Maven__com_h2database_h2_1_4_197.xml │ ├── Maven__io_grpc_grpc_api_1_33_0.xml │ ├── Maven__org_eclipse_jdt_ecj_3_18_0.xml │ ├── Maven__com_google_guava_guava_22_0.xml │ ├── Maven__net_jodah_failsafe_2_4_0.xml │ ├── Maven__commons_io_commons_io_2_6.xml │ ├── Maven__io_etcd_jetcd_core_0_5_4.xml │ ├── Maven__io_grpc_grpc_core_1_33_0.xml │ ├── Maven__io_grpc_grpc_stub_1_33_0.xml │ ├── Maven__io_grpc_grpc_netty_1_33_0.xml │ ├── Maven__net_minidev_json_smart_2_3.xml │ ├── Maven__org_objenesis_objenesis_2_6.xml │ ├── Maven__com_alibaba_fastjson_1_2_70.xml │ ├── Maven__commons_cli_commons_cli_1_2.xml │ ├── Maven__javax_cache_cache_api_1_0_0.xml │ ├── Maven__org_aspectj_aspectjrt_1_9_2.xml │ ├── Maven__org_slf4j_slf4j_api_1_7_30.xml │ ├── Maven__com_google_code_gson_gson_2_8_0.xml │ ├── Maven__com_google_code_gson_gson_2_8_6.xml │ ├── Maven__io_etcd_jetcd_common_0_5_4.xml │ ├── Maven__io_grpc_grpc_grpclb_1_33_0.xml │ ├── Maven__io_netty_netty_3_10_5_Final.xml │ ├── Maven__commons_lang_commons_lang_2_6.xml │ ├── Maven__io_grpc_grpc_context_1_33_0.xml │ ├── Maven__com_google_guava_guava_28_2_jre.xml │ ├── Maven__io_grpc_grpc_protobuf_1_33_0.xml │ ├── Maven__org_hamcrest_hamcrest_core_1_3.xml │ ├── Maven__commons_codec_commons_codec_1_2.xml │ ├── Maven__org_opentest4j_opentest4j_1_2_0.xml │ ├── Maven__org_projectlombok_lombok_1_18_12.xml │ ├── Maven__org_slf4j_jul_to_slf4j_1_7_30.xml │ ├── Maven__com_alibaba_nacos_nacos_api_1_1_4.xml │ ├── Maven__org_gridgain_ignite_shmem_1_0_0.xml │ ├── Maven__org_skyscreamer_jsonassert_1_5_0.xml │ ├── Maven__io_perfmark_perfmark_api_0_19_0.xml │ ├── Maven__io_prometheus_simpleclient_0_5_0.xml │ ├── Maven__net_minidev_accessors_smart_1_2.xml │ ├── Maven__org_aspectj_aspectjweaver_1_9_2.xml │ ├── Maven__org_jetbrains_annotations_16_0_3.xml │ ├── Maven__ch_qos_logback_logback_core_1_2_3.xml │ ├── Maven__com_google_code_findbugs_jsr305_1_3_9.xml │ ├── Maven__com_google_code_findbugs_jsr305_3_0_2.xml │ ├── Maven__com_jayway_jsonpath_json_path_2_4_0.xml │ ├── Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml │ ├── Maven__org_apache_ignite_ignite_core_2_8_1.xml │ ├── Maven__org_apache_lucene_lucene_core_7_4_0.xml │ ├── Maven__org_apache_commons_commons_lang3_3_4.xml │ ├── Maven__com_alibaba_csp_sentinel_core_1_7_2.xml │ ├── Maven__com_alibaba_nacos_nacos_client_1_1_4.xml │ ├── Maven__com_alibaba_nacos_nacos_common_1_1_4.xml │ ├── Maven__org_apache_ignite_ignite_slf4j_2_8_1.xml │ ├── Maven__com_google_guava_failureaccess_1_0_1.xml │ ├── Maven__io_grpc_grpc_protobuf_lite_1_33_0.xml │ ├── Maven__ch_qos_logback_logback_classic_1_2_3.xml │ ├── Maven__org_apache_httpcomponents_httpcore_4_4_5.xml │ ├── Maven__org_apache_ignite_ignite_spring_2_8_1.xml │ ├── Maven__com_google_android_annotations_4_1_1_4.xml │ ├── Maven__commons_logging_commons_logging_1_0_4.xml │ ├── Maven__org_apache_lucene_lucene_queries_7_4_0.xml │ ├── Maven__org_apache_lucene_lucene_sandbox_7_4_0.xml │ ├── Maven__org_apiguardian_apiguardian_api_1_1_0.xml │ ├── Maven__javax_servlet_javax_servlet_api_3_1_0.xml │ ├── Maven__org_apache_curator_curator_client_4_0_1.xml │ ├── Maven__org_apache_logging_log4j_log4j_api_2_17_0.xml │ ├── Maven__org_apache_logging_log4j_log4j_jul_2_17_0.xml │ ├── Maven__com_google_protobuf_protobuf_java_3_12_0.xml │ ├── Maven__org_apache_httpcomponents_httpclient_4_5_3.xml │ ├── Maven__org_apache_ignite_ignite_indexing_2_8_1.xml │ ├── Maven__org_apache_logging_log4j_log4j_core_2_17_0.xml │ ├── Maven__org_checkerframework_checker_qual_2_10_0.xml │ ├── Maven__com_google_j2objc_j2objc_annotations_1_1.xml │ ├── Maven__com_google_j2objc_j2objc_annotations_1_3.xml │ ├── Maven__org_apache_curator_curator_recipes_4_0_1.xml │ ├── Maven__org_apache_zookeeper_zookeeper_3_5_3_beta.xml │ ├── Maven__com_ctrip_framework_apollo_apollo_core_1_2_0.xml │ ├── Maven__commons_httpclient_commons_httpclient_3_1.xml │ ├── Maven__org_apache_httpcomponents_httpcore_nio_4_4_6.xml │ ├── Maven__com_github_stefanbirkner_system_rules_1_16_1.xml │ ├── Maven__org_apache_curator_curator_framework_4_0_1.xml │ ├── Maven__org_apache_lucene_lucene_queryparser_7_4_0.xml │ ├── Maven__org_springframework_spring_tx_5_2_5_RELEASE.xml │ ├── Maven__com_alibaba_csp_sentinel_web_servlet_1_7_2.xml │ ├── Maven__com_ctrip_framework_apollo_apollo_openapi_1_2_0.xml │ ├── Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_33.xml │ ├── Maven__com_google_protobuf_protobuf_java_util_3_12_0.xml │ ├── Maven__org_apache_httpcomponents_httpasyncclient_4_1_3.xml │ ├── Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_17_0.xml │ ├── Maven__org_springframework_springloaded_1_2_8_RELEASE.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_33.xml │ ├── Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml │ ├── Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml │ ├── Maven__org_apache_lucene_lucene_analyzers_common_7_4_0.xml │ ├── Maven__org_apache_tomcat_tomcat_annotations_api_9_0_33.xml │ ├── Maven__com_alibaba_csp_sentinel_datasource_nacos_1_7_2.xml │ ├── Maven__com_alibaba_csp_sentinel_transport_common_1_7_2.xml │ ├── Maven__org_apache_tomcat_embed_tomcat_embed_jasper_9_0_33.xml │ ├── Maven__org_codehaus_mojo_animal_sniffer_annotations_1_14.xml │ ├── Maven__org_codehaus_mojo_animal_sniffer_annotations_1_18.xml │ ├── Maven__com_alibaba_csp_sentinel_annotation_aspectj_1_7_2.xml │ ├── Maven__com_google_errorprone_error_prone_annotations_2_3_4.xml │ ├── Maven__com_google_errorprone_error_prone_annotations_2_0_18.xml │ ├── Maven__com_alibaba_csp_sentinel_datasource_extension_1_7_2.xml │ ├── Maven__com_google_api_grpc_proto_google_common_protos_1_17_0.xml │ ├── Maven__com_alibaba_csp_sentinel_transport_simple_http_1_7_2.xml │ ├── Maven__com_alibaba_csp_sentinel_parameter_flow_control_1_7_2.xml │ ├── Maven__com_google_auto_service_auto_service_annotations_1_0_rc7.xml │ ├── Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml │ ├── Maven__com_alibaba_csp_sentinel_api_gateway_adapter_common_1_7_2.xml │ ├── Maven__com_googlecode_concurrentlinkedhashmap_concurrentlinkedhashmap_lru_1_4_2.xml │ └── Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml └── artifacts │ ├── autolimiter_client_demo_war.xml │ ├── autolimiter_dashboard_cluster_war.xml │ ├── autolimiter_cluster_server__1__war.xml │ └── autolimiter_cluster_server__1__war_exploded.xml ├── autolimiter-client ├── README.md ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.alibaba.csp.sentinel.slotchain.SlotChainBuilder │ │ │ └── com.alibaba.csp.sentinel.transport.HeartbeatSender │ │ └── java │ │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── client │ │ ├── rule │ │ └── RuleChangedListener.java │ │ └── AutoLimiterException.java └── target │ ├── classes │ ├── META-INF │ │ └── services │ │ │ └── com.alibaba.csp.sentinel.transport.HeartbeatSender │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── client │ │ ├── ConfigListener.class │ │ ├── AutoLimiterException.class │ │ └── heartbeat │ │ └── PollHttpHeartbeatSender.class │ ├── autolimiter-client-1.0-SNAPSHOT.jar │ ├── maven-archiver │ └── pom.properties │ └── maven-status │ └── maven-compiler-plugin │ └── compile │ └── default-compile │ ├── createdFiles.lst │ └── inputFiles.lst ├── autolimiter-client-demo ├── target │ ├── classes │ │ ├── reloadtrigger │ │ ├── WEB-INF │ │ │ └── web.xml │ │ └── application.properties │ └── maven-status │ │ └── maven-compiler-plugin │ │ └── compile │ │ └── default-compile │ │ ├── createdFiles.lst │ │ └── inputFiles.lst ├── README.md └── src │ └── main │ ├── resources │ ├── reloadtrigger │ └── application.properties │ ├── java │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── demo │ │ └── client │ │ └── Constants.java │ └── webapp │ └── WEB-INF │ └── web.xml ├── autolimiter-dashboard-cluster ├── src │ ├── main │ │ ├── webapp │ │ │ ├── resources │ │ │ │ ├── .gitignore │ │ │ │ ├── assets │ │ │ │ │ └── img │ │ │ │ │ │ └── sentinel-logo.png │ │ │ │ ├── lib │ │ │ │ │ └── fonts │ │ │ │ │ │ ├── fontawesome-webfont.ttf │ │ │ │ │ │ ├── fontawesome-webfont.woff │ │ │ │ │ │ ├── fontawesome-webfont.woff2 │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf │ │ │ │ │ │ └── glyphicons-halflings-regular.woff │ │ │ │ ├── app │ │ │ │ │ ├── views │ │ │ │ │ │ ├── dashboard │ │ │ │ │ │ │ ├── main.html │ │ │ │ │ │ │ └── home.html │ │ │ │ │ │ ├── dialog │ │ │ │ │ │ │ └── confirm-dialog.html │ │ │ │ │ │ └── pagination.tpl.html │ │ │ │ │ └── scripts │ │ │ │ │ │ ├── services │ │ │ │ │ │ ├── version_service.js │ │ │ │ │ │ ├── appservice.js │ │ │ │ │ │ ├── auth_service.js │ │ │ │ │ │ ├── identityservice.js │ │ │ │ │ │ ├── machineservice.js │ │ │ │ │ │ └── metricservice.js │ │ │ │ │ │ ├── controllers │ │ │ │ │ │ ├── main.js │ │ │ │ │ │ ├── home.js │ │ │ │ │ │ └── login.js │ │ │ │ │ │ ├── directives │ │ │ │ │ │ ├── sidebar │ │ │ │ │ │ │ └── sidebar-search │ │ │ │ │ │ │ │ ├── sidebar-search.html │ │ │ │ │ │ │ │ └── sidebar-search.js │ │ │ │ │ │ └── header │ │ │ │ │ │ │ └── header.html │ │ │ │ │ │ └── filters │ │ │ │ │ │ └── filters.js │ │ │ │ ├── README_zh.md │ │ │ │ ├── README.md │ │ │ │ ├── index.htm │ │ │ │ ├── license-stat.csv │ │ │ │ └── index_dev.htm │ │ │ └── WEB-INF │ │ │ │ └── web.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── lifeofcoder │ │ │ │ └── autolimiter │ │ │ │ └── dashboard │ │ │ │ ├── init │ │ │ │ ├── Starter.java │ │ │ │ └── impl │ │ │ │ │ └── IgniteListenerStarter.java │ │ │ │ ├── mapping │ │ │ │ ├── converter │ │ │ │ │ ├── Converter.java │ │ │ │ │ ├── impl │ │ │ │ │ │ └── Long2DateConverter.java │ │ │ │ │ ├── ConverterRegistey.java │ │ │ │ │ └── BaseConverter.java │ │ │ │ └── FieldMapping.java │ │ │ │ ├── config │ │ │ │ ├── NodeConfigService.java │ │ │ │ └── impl │ │ │ │ │ └── DefaultNodeConfigService.java │ │ │ │ ├── ignite │ │ │ │ ├── dao │ │ │ │ │ ├── AuthDao.java │ │ │ │ │ ├── MachineDao.java │ │ │ │ │ ├── BaseIgniteDao.java │ │ │ │ │ └── MetricsDao.java │ │ │ │ ├── node │ │ │ │ │ └── NodeManger.java │ │ │ │ └── listener │ │ │ │ │ └── NodeChangedListener.java │ │ │ │ ├── sentinel │ │ │ │ ├── dashboard │ │ │ │ │ ├── rule │ │ │ │ │ │ ├── DynamicRuleProvider.java │ │ │ │ │ │ └── DynamicRulePublisher.java │ │ │ │ │ ├── domain │ │ │ │ │ │ └── cluster │ │ │ │ │ │ │ └── request │ │ │ │ │ │ │ └── ClusterModifyRequest.java │ │ │ │ │ ├── client │ │ │ │ │ │ ├── CommandFailedException.java │ │ │ │ │ │ └── CommandNotFoundException.java │ │ │ │ │ ├── datasource │ │ │ │ │ │ └── entity │ │ │ │ │ │ │ └── rule │ │ │ │ │ │ │ └── RuleEntity.java │ │ │ │ │ ├── repository │ │ │ │ │ │ └── rule │ │ │ │ │ │ │ ├── InMemSystemRuleStore.java │ │ │ │ │ │ │ └── InMemDegradeRuleStore.java │ │ │ │ │ └── auth │ │ │ │ │ │ └── AuthAction.java │ │ │ │ └── customized │ │ │ │ │ └── rule │ │ │ │ │ ├── IgniteSystemRuleStore.java │ │ │ │ │ ├── IgniteDegradeRuleStore.java │ │ │ │ │ ├── IgniteAuthorityRuleStore.java │ │ │ │ │ ├── IgniteGatewayFlowRuleStore.java │ │ │ │ │ └── IgniteApiDefinitionStore.java │ │ │ │ ├── JsonUtils.java │ │ │ │ └── model │ │ │ │ └── BaseIgniteModel.java │ │ └── resources │ │ │ └── application.properties │ └── test │ │ └── java │ │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── dashboard │ │ └── mapping │ │ ├── converter │ │ └── ConverterRegisteyTest.java │ │ └── MappingUtilTest.java └── README.md ├── .gitignore ├── autolimiter-cluster-parent ├── README.md ├── autolimiter-cluster-server │ └── src │ │ └── main │ │ ├── resources │ │ ├── important.properties │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.alibaba.csp.sentinel.cluster.TokenService │ │ │ ├── com.alibaba.csp.sentinel.init.InitFunc │ │ │ ├── com.lifeofcoder.autolimiter.cluster.common.codec.request.RequestEntityDecoder │ │ │ ├── com.lifeofcoder.autolimiter.cluster.common.codec.response.ResponseEntityWriter │ │ │ ├── com.lifeofcoder.autolimiter.cluster.server.processor.RequestProcessor │ │ │ └── com.alibaba.csp.sentinel.command.CommandHandler │ │ ├── webapp │ │ └── WEB-INF │ │ │ └── web.xml │ │ └── java │ │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── cluster │ │ ├── web │ │ ├── config │ │ │ └── ClusterConfigChangedListener.java │ │ ├── consts │ │ │ └── FlowConsts.java │ │ └── controller │ │ │ └── ClusterController.java │ │ ├── flow │ │ ├── rule │ │ │ └── ClusterFlowRuleWrapper.java │ │ └── client │ │ │ └── ClientsInfo.java │ │ └── server │ │ ├── util │ │ └── ClusterRuleUtil.java │ │ ├── config │ │ └── ServerTransportConfigObserver.java │ │ ├── ServerConstants.java │ │ ├── connection │ │ └── Connection.java │ │ └── codec │ │ └── data │ │ ├── PingResponseDataWriter.java │ │ ├── DynamicFlowResponseDataWriter.java │ │ └── FlowResponseDataWriter.java ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ └── maven-wrapper.properties ├── autolimiter-cluster-client │ └── src │ │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── services │ │ │ ├── com.alibaba.csp.sentinel.init.InitFunc │ │ │ ├── com.alibaba.csp.sentinel.cluster.client.ClusterTokenClient │ │ │ ├── com.alibaba.csp.sentinel.slots.block.flow.FlowRuleChecker │ │ │ ├── com.lifeofcoder.autolimiter.client.rule.RuleChangedListener │ │ │ ├── com.lifeofcoder.autolimiter.cluster.common.codec.request.RequestEntityWriter │ │ │ ├── com.lifeofcoder.autolimiter.cluster.common.codec.response.ResponseEntityDecoder │ │ │ ├── com.lifeofcoder.autolimiter.common.config.ClusterConfigChangedHandler │ │ │ └── com.alibaba.csp.sentinel.command.CommandHandler │ │ └── java │ │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── cluster │ │ └── client │ │ ├── consts │ │ ├── ClusterCheckResult.java │ │ └── CommonParams.java │ │ ├── dynamic │ │ ├── DynamicClusterTokenClient.java │ │ └── DynamicFlowController.java │ │ ├── config │ │ ├── ClusterClientConfigInfo.java │ │ └── ClusterClientConfigCenter.java │ │ ├── toleranter │ │ └── FaultToleranterManager.java │ │ ├── rule │ │ └── DynamicClusterFlowRuleChecker.java │ │ ├── ClientConstants.java │ │ └── common │ │ └── config │ │ └── ServerChangeObserver.java ├── pom.xml ├── autolimiter-cluster-common │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── lifeofcoder │ │ │ └── autolimiter │ │ │ └── cluster │ │ │ └── common │ │ │ ├── response │ │ │ ├── data │ │ │ │ └── DynamicFlowTokenResponseData.java │ │ │ └── Response.java │ │ │ ├── codec │ │ │ ├── request │ │ │ │ ├── RequestEntityDecoder.java │ │ │ │ └── RequestEntityWriter.java │ │ │ ├── response │ │ │ │ ├── ResponseEntityDecoder.java │ │ │ │ └── ResponseEntityWriter.java │ │ │ ├── EntityDecoder.java │ │ │ └── EntityWriter.java │ │ │ ├── exception │ │ │ └── SentinelClusterException.java │ │ │ ├── request │ │ │ └── Request.java │ │ │ ├── result │ │ │ └── DynamicTokenResult.java │ │ │ └── annotation │ │ │ └── RequestType.java │ └── pom.xml └── HELP.md ├── autolimiter-common ├── src │ └── main │ │ └── java │ │ └── com │ │ └── lifeofcoder │ │ └── autolimiter │ │ └── common │ │ ├── config │ │ ├── HashNode.java │ │ └── ClusterConfigChangedHandler.java │ │ ├── model │ │ └── RouteMode.java │ │ └── utils │ │ ├── NetworkHelper.java │ │ └── OsHelper.java └── pom.xml └── autolimiter-parent.iml /.idea/.name: -------------------------------------------------------------------------------- 1 | autolimiter-parent -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /workspace.xml -------------------------------------------------------------------------------- /autolimiter-client/README.md: -------------------------------------------------------------------------------- 1 | # 自动限流核心类库 2 | 提供部分核心类库,比如心跳实现等 -------------------------------------------------------------------------------- /autolimiter-client-demo/target/classes/reloadtrigger: -------------------------------------------------------------------------------- 1 | 22222aaa222223332323adfad -------------------------------------------------------------------------------- /autolimiter-client-demo/README.md: -------------------------------------------------------------------------------- 1 | # 自动限流测试客户端 2 | 模拟现实请求客户端,无需通过http发起请求,后台自动请求。 -------------------------------------------------------------------------------- /autolimiter-client-demo/src/main/resources/reloadtrigger: -------------------------------------------------------------------------------- 1 | 22222aaa222223332323adfad -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | tmp/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | /.idea/ 3 | */target/ 4 | /**/target 5 | /**/*.iml 6 | /**/.DS_Store -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/README.md: -------------------------------------------------------------------------------- 1 | # 控制台集群 2 | Sentinel的控制台集群方案。通过Ignite实现,解决了原生Sentinel的单点故障问题。 -------------------------------------------------------------------------------- /autolimiter-cluster-parent/README.md: -------------------------------------------------------------------------------- 1 | # 集群服务端 2 | Sentinel原生只支持单机限流。如果需要支持集群限流则需要自己实现Token Server。 3 | 本集群服务端通过raft协议,实现了高可用高性能的Token Server -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/important.properties: -------------------------------------------------------------------------------- 1 | spring.datasource.password=abc 2 | spring.datasource.username=xbc -------------------------------------------------------------------------------- /autolimiter-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slotchain.SlotChainBuilder: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.client.CustomizedSlotChainBuilder -------------------------------------------------------------------------------- /autolimiter-client/target/classes/META-INF/services/com.alibaba.csp.sentinel.transport.HeartbeatSender: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.client.heartbeat.PollHttpHeartbeatSender -------------------------------------------------------------------------------- /autolimiter-cluster-parent/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-cluster-parent/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /autolimiter-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.transport.HeartbeatSender: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.client.heartbeat.PollHttpHeartbeatSender -------------------------------------------------------------------------------- /autolimiter-client/target/autolimiter-client-1.0-SNAPSHOT.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-client/target/autolimiter-client-1.0-SNAPSHOT.jar -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.cluster.TokenService: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.flow.DefaultTokenService -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.init.InitFunc: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.init.DefaultClusterClientInitFunc -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.init.InitFunc: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.server.init.DefaultClusterServerInitFunc -------------------------------------------------------------------------------- /autolimiter-client/target/maven-archiver/pom.properties: -------------------------------------------------------------------------------- 1 | #Generated by Maven 2 | #Wed Apr 06 11:27:13 CST 2022 3 | version=1.0-SNAPSHOT 4 | groupId=com.lifeofcoder.autolimiter 5 | artifactId=autolimiter-client 6 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.cluster.client.ClusterTokenClient: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.ClusterTokenClientProxy -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.slots.block.flow.FlowRuleChecker: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.rule.ClusterFlowRuleCheckerProxy -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.client.rule.RuleChangedListener: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.dynamic.FlowRuleChangedListener -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/assets/img/sentinel-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/assets/img/sentinel-logo.png -------------------------------------------------------------------------------- /autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/ConfigListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/ConfigListener.class -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.cluster.common.codec.request.RequestEntityWriter: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.codec.DefaultRequestEntityWriter -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/fontawesome-webfont.woff2 -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.cluster.common.codec.response.ResponseEntityDecoder: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.codec.DefaultResponseEntityDecoder -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.cluster.common.codec.request.RequestEntityDecoder: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.server.codec.DefaultRequestEntityDecoder -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.cluster.common.codec.response.ResponseEntityWriter: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.server.codec.DefaultResponseEntityWriter -------------------------------------------------------------------------------- /autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/AutoLimiterException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/AutoLimiterException.class -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.common.config.ClusterConfigChangedHandler: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.client.config.ClusterClientClusterConfigChangedHandler -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-dashboard-cluster/src/main/webapp/resources/lib/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/heartbeat/PollHttpHeartbeatSender.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lifeofcoder/AutoLimiter/HEAD/autolimiter-client/target/classes/com/lifeofcoder/autolimiter/client/heartbeat/PollHttpHeartbeatSender.class -------------------------------------------------------------------------------- /autolimiter-cluster-parent/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.4/apache-maven-3.8.4-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.0/maven-wrapper-3.1.0.jar 3 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.command.handler.ModifyClusterClientConfigHandler 2 | com.lifeofcoder.autolimiter.cluster.command.handler.FetchClusterClientConfigHandler -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/init/Starter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.init; 2 | 3 | /** 4 | * 容器启动接口 5 | * 6 | * @author xbc 7 | * @date 2020/7/29 8 | */ 9 | public interface Starter { 10 | void start(); 11 | } 12 | -------------------------------------------------------------------------------- /autolimiter-client-demo/src/main/java/com/lifeofcoder/autolimiter/demo/client/Constants.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.demo.client; 2 | 3 | /** 4 | * 常量类 5 | * 6 | * @author xbc 7 | * @date 2020/4/16 8 | */ 9 | public class Constants { 10 | 11 | public final static String RES_HELLO = "hello"; 12 | } 13 | -------------------------------------------------------------------------------- /autolimiter-common/src/main/java/com/lifeofcoder/autolimiter/common/config/HashNode.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.common.config; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 一致性Hash节点 7 | * 8 | * @author xbc 9 | * @date 2022/4/2 10 | */ 11 | public interface HashNode extends Serializable { 12 | String key(); 13 | } 14 | -------------------------------------------------------------------------------- /autolimiter-common/src/main/java/com/lifeofcoder/autolimiter/common/config/ClusterConfigChangedHandler.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.common.config; 2 | 3 | /** 4 | * 配置变更处理类 5 | * 6 | * @author xbc 7 | * @date 2022/4/2 8 | */ 9 | public interface ClusterConfigChangedHandler { 10 | void configChanged(String key, String config); 11 | } -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/views/dashboard/main.html: -------------------------------------------------------------------------------- 1 |
2 | 3 |
4 | 5 | 6 |
7 |
8 |
9 | 10 |
11 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/version_service.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('VersionService', ['$http', function ($http) { 4 | this.version = function () { 5 | return $http({ 6 | url: '/version', 7 | method: 'GET' 8 | }); 9 | }; 10 | }]); 11 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.lifeofcoder.autolimiter.cluster.server.processor.RequestProcessor: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.server.processor.FlowRequestProcessor 2 | com.lifeofcoder.autolimiter.cluster.server.processor.ParamFlowRequestProcessor 3 | com.lifeofcoder.autolimiter.cluster.server.processor.DynamicFlowRequestProcessor -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/consts/ClusterCheckResult.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.consts; 2 | 3 | /** 4 | * 集群结果 5 | * 6 | * @author xbc 7 | * @date 2022/3/17 8 | */ 9 | public enum ClusterCheckResult { 10 | PASS, //通过 11 | BLOCK, //阻塞 12 | FALLBACK; //降级 13 | } 14 | -------------------------------------------------------------------------------- /autolimiter-client-demo/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /autolimiter-client-demo/target/classes/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/controllers/main.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc function 3 | * @name sentinelDashboardApp.controller:MainCtrl 4 | * @description 5 | * # MainCtrl 6 | * Controller of the sentinelDashboardApp 7 | */ 8 | angular.module('sentinelDashboardApp') 9 | .controller('DashboardCtrl', ['$scope', '$position', function ($scope, $position) { 10 | }]); 11 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/views/dashboard/home.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 |

欢迎使用 Sentinel 控制台

5 |
6 | 7 |
8 | 9 | 10 |
11 |
12 | 13 |
14 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/appservice.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('AppService', ['$http', function ($http) { 4 | this.getApps = function () { 5 | return $http({ 6 | // url: 'app/mock_infos', 7 | url: 'app/briefinfos.json', 8 | method: 'GET' 9 | }); 10 | }; 11 | }]); 12 | -------------------------------------------------------------------------------- /autolimiter-client-demo/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/lifeofcoder/autolimiter/demo/client/RequestTimer.class 2 | com/lifeofcoder/autolimiter/demo/client/RequestTimer$1.class 3 | com/lifeofcoder/autolimiter/demo/client/Constants.class 4 | com/lifeofcoder/autolimiter/demo/client/SentinelClientApplication.class 5 | com/lifeofcoder/autolimiter/demo/client/controller/TestController.class 6 | -------------------------------------------------------------------------------- /autolimiter-client/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst: -------------------------------------------------------------------------------- 1 | com/lifeofcoder/autolimiter/client/CustomizedSlotChainBuilder.class 2 | com/lifeofcoder/autolimiter/client/heartbeat/PollHttpHeartbeatSender.class 3 | com/lifeofcoder/autolimiter/client/rule/RuleChangedListener.class 4 | com/lifeofcoder/autolimiter/client/ConfigListener.class 5 | com/lifeofcoder/autolimiter/client/AutoLimiterException.class 6 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/webapp/WEB-INF/web.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/controllers/home.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc function 3 | * @name sentinelDashboardApp.controller:MainCtrl 4 | * @description 5 | * # MainCtrl 6 | * Controller of the sentinelDashboardApp 7 | */ 8 | angular.module('sentinelDashboardApp') 9 | .controller('HomeCtrl', ['$scope', '$position', function ($scope, $position) { 10 | // do noting 11 | }]); 12 | -------------------------------------------------------------------------------- /autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/rule/RuleChangedListener.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.client.rule; 2 | 3 | import com.alibaba.csp.sentinel.slots.block.Rule; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 规则变更监听 9 | * 10 | * @author xbc 11 | * @date 2022/3/17 12 | */ 13 | public interface RuleChangedListener { 14 | void ruleChanged(List newRuleList); 15 | } 16 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/mapping/converter/Converter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping.converter; 2 | 3 | /** 4 | * 格式转换工具 5 | * 6 | * @author xbc 7 | * @date 2020/7/23 8 | */ 9 | public interface Converter { 10 | /** 11 | * 进行格式转换 12 | * @param src 源对象 13 | * @return 目标对象 14 | */ 15 | Object convert(Object src); 16 | } 17 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/config/NodeConfigService.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.config; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.ResponseDto; 4 | 5 | /** 6 | * 节点配置中心服务,可以将ignite节点信息注册到自己的配置中心 7 | * 8 | * @author xbc 9 | * @date 2020/8/4 10 | */ 11 | public interface NodeConfigService { 12 | ResponseDto updateNodeAddrs(String addrs); 13 | } 14 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/dao/AuthDao.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.dao; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.model.IgniteAuth; 4 | 5 | /** 6 | * Auth Dao 7 | * 8 | * @author xbc 9 | * @date 2020/7/29 10 | */ 11 | public interface AuthDao { 12 | void addUser(IgniteAuth authUser); 13 | 14 | IgniteAuth getUser(String sessionId); 15 | } 16 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/filters/filters.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.filter('range', [function () { 4 | return function (input, length) { 5 | if (isNaN(length) || length <= 0) { 6 | return []; 7 | } 8 | 9 | input = []; 10 | for (var index = 1; index <= length; index++) { 11 | input.push(index); 12 | } 13 | 14 | return input; 15 | }; 16 | 17 | }]); 18 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_4_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__log4j_log4j_1_2_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/consts/CommonParams.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.consts; 2 | 3 | /** 4 | * 公共参数 5 | * 6 | * @author xbc 7 | * @date 2022/3/9 8 | */ 9 | public final class CommonParams { 10 | /** 11 | * 客户端延迟关闭时长 12 | */ 13 | public static final long CLOSE_CLIENT_DELAY_SEC = 30; 14 | 15 | /** 16 | * 默认最小可用率 17 | */ 18 | public static final double DEF_MIN_AVAILABLE_RATIO = 0.95D; 19 | } 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_ow2_asm_asm_5_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_h2database_h2_1_4_197.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/node/NodeManger.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.node; 2 | 3 | /** 4 | * 节点管理 5 | * 6 | * @author xbc 7 | * @date 2020/7/30 8 | */ 9 | public class NodeManger { 10 | private static volatile Boolean isMasterNode; 11 | 12 | public static void setMasterNode(Boolean isMaster) { 13 | isMasterNode = isMaster; 14 | } 15 | 16 | public static boolean isMaster() { 17 | return null != isMasterNode && isMasterNode; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_api_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_eclipse_jdt_ecj_3_18_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_guava_22_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_jodah_failsafe_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_io_commons_io_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_etcd_jetcd_core_0_5_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_core_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_stub_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_netty_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_json_smart_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_objenesis_objenesis_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_fastjson_1_2_70.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_cli_commons_cli_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_cache_cache_api_1_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjrt_1_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_slf4j_api_1_7_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_gson_gson_2_8_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_gson_gson_2_8_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_etcd_jetcd_common_0_5_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_grpclb_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/artifacts/autolimiter_client_demo_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/autolimiter-client-demo/target 4 | 5 | 6 | autolimiter-client-demo 7 | war 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_netty_netty_3_10_5_Final.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_lang_commons_lang_2_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_context_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_guava_28_2_jre.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_protobuf_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_hamcrest_hamcrest_core_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_codec_commons_codec_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_opentest4j_opentest4j_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_projectlombok_lombok_1_18_12.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jul_to_slf4j_1_7_30.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/dynamic/DynamicClusterTokenClient.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.dynamic; 2 | 3 | import com.alibaba.csp.sentinel.cluster.client.ClusterTokenClient; 4 | import com.lifeofcoder.autolimiter.cluster.common.result.DynamicTokenResult; 5 | 6 | /** 7 | * 动态集群客户端 8 | * 9 | * @author xbc 10 | * @date 2022/3/17 11 | */ 12 | public interface DynamicClusterTokenClient extends ClusterTokenClient { 13 | DynamicTokenResult requestDynamicToken(long flowId, int maxCount, int lastCount); 14 | } 15 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_nacos_nacos_api_1_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_gridgain_ignite_shmem_1_0_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_skyscreamer_jsonassert_1_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/README_zh.md: -------------------------------------------------------------------------------- 1 | # Sentinel Dashboard Frontend 2 | 3 | ## 环境要求 4 | 5 | - Node.js > 6.x 6 | 7 | ## 编码规范 8 | 9 | - HTML/CSS 遵循 [Bootstrap 编码规范](https://codeguide.bootcss.com/) 10 | - JavaScript 遵循 [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) 以及最新的 ES 6 标准 11 | 12 | ## 安装依赖 13 | 14 | ``` 15 | npm i 16 | ``` 17 | 18 | ## 开始本地开发 19 | 20 | ``` 21 | npm start 22 | ``` 23 | 24 | ## 构建前端资源 25 | 26 | ``` 27 | npm run build 28 | ``` 29 | 30 | ## Credit 31 | 32 | - [sb-admin-angular](https://github.com/start-angular/sb-admin-angular) -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_perfmark_perfmark_api_0_19_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_prometheus_simpleclient_0_5_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__net_minidev_accessors_smart_1_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_aspectj_aspectjweaver_1_9_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_jetbrains_annotations_16_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-parent.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_core_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_findbugs_jsr305_1_3_9.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_code_findbugs_jsr305_3_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_jayway_jsonpath_json_path_2_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_slf4j_jcl_over_slf4j_1_7_25.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ignite_ignite_core_2_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_lucene_lucene_core_7_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/artifacts/autolimiter_dashboard_cluster_war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/autolimiter-dashboard-cluster/target 4 | 5 | 6 | autolimiter-dashboard-cluster 7 | war 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_commons_commons_lang3_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_core_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_nacos_nacos_client_1_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_nacos_nacos_common_1_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ignite_ignite_slf4j_2_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_failureaccess_1_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__io_grpc_grpc_protobuf_lite_1_33_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__ch_qos_logback_logback_classic_1_2_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpcore_4_4_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ignite_ignite_spring_2_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/README.md: -------------------------------------------------------------------------------- 1 | # Sentinel Dashboard Frontend 2 | 3 | ## Env Requirement 4 | 5 | - Node.js > 6.x 6 | 7 | ## Code Guide 8 | 9 | - [Code Style Guide for HTML/CSS](https://codeguide.bootcss.com/) 10 | - [Airbnb JavaScript Style Guide](https://github.com/airbnb/javascript/tree/es5-deprecated/es5) 11 | 12 | ## Install Packages 13 | 14 | ``` 15 | npm install 16 | ``` 17 | 18 | ## Start Development 19 | 20 | ``` 21 | npm start 22 | ``` 23 | 24 | ## Build for production 25 | 26 | ``` 27 | npm run build 28 | ``` 29 | 30 | ## Credit 31 | 32 | - [sb-admin-angular](https://github.com/start-angular/sb-admin-angular) -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_android_annotations_4_1_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_logging_commons_logging_1_0_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_lucene_lucene_queries_7_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_lucene_lucene_sandbox_7_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apiguardian_apiguardian_api_1_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/artifacts/autolimiter_cluster_server__1__war.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/autolimiter-cluster-parent/target 4 | 5 | 6 | autolimiter-cluster-server (1) 7 | war 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__javax_servlet_javax_servlet_api_3_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_curator_curator_client_4_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_api_2_17_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_jul_2_17_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_protobuf_protobuf_java_3_12_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpclient_4_5_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_ignite_ignite_indexing_2_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_core_2_17_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_checkerframework_checker_qual_2_10_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-client-demo/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client-demo/src/main/java/com/lifeofcoder/autolimiter/demo/client/controller/TestController.java 2 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client-demo/src/main/java/com/lifeofcoder/autolimiter/demo/client/RequestTimer.java 3 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client-demo/src/main/java/com/lifeofcoder/autolimiter/demo/client/Constants.java 4 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client-demo/src/main/java/com/lifeofcoder/autolimiter/demo/client/SentinelClientApplication.java 5 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_j2objc_j2objc_annotations_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_curator_curator_recipes_4_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_zookeeper_zookeeper_3_5_3_beta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_ctrip_framework_apollo_apollo_core_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__commons_httpclient_commons_httpclient_3_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpcore_nio_4_4_6.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_github_stefanbirkner_system_rules_1_16_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_curator_curator_framework_4_0_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/dao/MachineDao.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.dao; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.model.IgniteMachine; 4 | 5 | import java.util.List; 6 | 7 | /** 8 | * 机器查询DAO 9 | * 10 | * @author xbc 11 | * @date 2020/7/17 12 | */ 13 | public interface MachineDao { 14 | void addOrUpdate(IgniteMachine machine); 15 | 16 | boolean delete(IgniteMachine machine); 17 | 18 | List getAppNames(); 19 | 20 | List getMachines(String app); 21 | 22 | void deleteApp(String app); 23 | 24 | List listMachines(); 25 | } 26 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/listener/NodeChangedListener.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.listener; 2 | 3 | import org.apache.ignite.events.DiscoveryEvent; 4 | 5 | /** 6 | * 服务端节点变更通知(不包括客户端变更) 7 | * 8 | * @author xbc 9 | * @date 2020/7/24 10 | */ 11 | public interface NodeChangedListener { 12 | /** 13 | * 只要有节点变化就会通知. 14 | * 如果isMasterChanged不为空,则表示是普通的节点变更。 15 | * 如果isMasterChanged不为空,则涉及到节点master节点变更。isMaster=true表示当前节点变成了master节点, 16 | * 如果isMasterChanged=fasle,则表示当前节点从master节点变成了普通节点 17 | */ 18 | void nodeChanged(DiscoveryEvent evt, Boolean isMasterChanged); 19 | } 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_lucene_lucene_queryparser_7_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_spring_tx_5_2_5_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/directives/sidebar/sidebar-search/sidebar-search.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @ngdoc directive 3 | * @name izzyposWebApp.directive:adminPosHeader 4 | * @description 5 | * # adminPosHeader 6 | */ 7 | 8 | angular.module('sentinelDashboardApp') 9 | .directive('sidebarSearch', function () { 10 | return { 11 | templateUrl: 'app/scripts/directives/sidebar/sidebar-search/sidebar-search.html', 12 | restrict: 'E', 13 | replace: true, 14 | scope: {}, 15 | controller: function ($scope) { 16 | $scope.selectedMenu = 'home'; 17 | } 18 | } 19 | }); 20 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_web_servlet_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_ctrip_framework_apollo_apollo_openapi_1_2_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_xml_bind_jakarta_xml_bind_api_2_3_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_el_9_0_33.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_protobuf_protobuf_java_util_3_12_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_httpcomponents_httpasyncclient_4_1_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_logging_log4j_log4j_slf4j_impl_2_17_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_springframework_springloaded_1_2_8_RELEASE.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_core_9_0_33.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_activation_jakarta_activation_api_1_2_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__jakarta_annotation_jakarta_annotation_api_1_3_5.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_lucene_lucene_analyzers_common_7_4_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_tomcat_annotations_api_9_0_33.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/auth_service.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('AuthService', ['$http', function ($http) { 4 | this.check = function () { 5 | return $http({ 6 | url: '/auth/check', 7 | method: 'POST' 8 | }); 9 | }; 10 | 11 | this.login = function (param) { 12 | return $http({ 13 | url: '/auth/login', 14 | params: param, 15 | method: 'POST' 16 | }); 17 | }; 18 | 19 | this.logout = function () { 20 | return $http({ 21 | url: '/auth/logout', 22 | method: 'POST' 23 | }); 24 | }; 25 | }]); 26 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_datasource_nacos_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_transport_common_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_apache_tomcat_embed_tomcat_embed_jasper_9_0_33.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_codehaus_mojo_animal_sniffer_annotations_1_14.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__org_codehaus_mojo_animal_sniffer_annotations_1_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_annotation_aspectj_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_3_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/test/java/com/lifeofcoder/autolimiter/dashboard/mapping/converter/ConverterRegisteyTest.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping.converter; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.mapping.converter.impl.Long2DateConverter; 4 | import org.junit.Test; 5 | 6 | import java.util.Date; 7 | 8 | public class ConverterRegisteyTest { 9 | 10 | @Test 11 | public void testConvert() { 12 | ConverterRegistey.register(new Long2DateConverter()); 13 | Converter converter = ConverterRegistey.getConverter(long.class, Date.class); 14 | Object value = converter.convert(1000L); 15 | System.out.println(value); 16 | System.out.println(long.class.getName()); 17 | } 18 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_errorprone_error_prone_annotations_2_0_18.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_datasource_extension_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_api_grpc_proto_google_common_protos_1_17_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/config/ClusterClientConfigInfo.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.config; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 7 | * 8 | * @author xbc 9 | * @date 2022/3/29 10 | */ 11 | public class ClusterClientConfigInfo implements Serializable { 12 | 13 | private static final long serialVersionUID = -5465994303376042691L; 14 | 15 | /** 16 | * 关闭集群限流 17 | */ 18 | private boolean closeCluster; 19 | 20 | public boolean isCloseCluster() { 21 | return closeCluster; 22 | } 23 | 24 | public void setCloseCluster(boolean closeCluster) { 25 | this.closeCluster = closeCluster; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_transport_simple_http_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/directives/header/header.html: -------------------------------------------------------------------------------- 1 |
2 | 13 | 14 | 15 |
-------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_parameter_flow_control_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_auto_service_auto_service_annotations_1_0_rc7.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-client/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst: -------------------------------------------------------------------------------- 1 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/rule/RuleChangedListener.java 2 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/heartbeat/PollHttpHeartbeatSender.java 3 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/AutoLimiterException.java 4 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/ConfigListener.java 5 | /bocai/learn/code/lifeofcoder/AutoLimiter/autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/CustomizedSlotChainBuilder.java 6 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/toleranter/FaultToleranterManager.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.toleranter; 2 | 3 | import com.lifeofcoder.autolimiter.common.config.ClusterServerTopoConfig; 4 | 5 | /** 6 | * 容错策略管理 7 | * 8 | * @author xbc 9 | * @date 2022/3/10 10 | */ 11 | public interface FaultToleranterManager { 12 | /** 13 | * 选择容错策略 14 | */ 15 | DiagnoseFaultToleranter selectDiagnoseFaultToleranter(String host, int port); 16 | 17 | /** 18 | * Topo结构变更 19 | */ 20 | void clusterServerTopoConfigChanged(ClusterServerTopoConfig clusterServerTopoConfig); 21 | 22 | /** 23 | * 可用率变更 24 | */ 25 | void availableRatioChanged(Double availableRatio); 26 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_vaadin_external_google_android_json_0_0_20131108_vaadin1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_alibaba_csp_sentinel_api_gateway_adapter_common_1_7_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/config/ClusterClientConfigCenter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.config; 2 | 3 | /** 4 | * 集群客户端配置管理 5 | * 6 | * @author xbc 7 | * @date 2022/3/29 8 | */ 9 | public class ClusterClientConfigCenter { 10 | /** 11 | * 已经关闭机器流控 12 | */ 13 | private static volatile boolean closeClusterLimit; 14 | 15 | /** 16 | * 设置集群限流开关 17 | */ 18 | public static void setCloseClusterLimit(boolean closeClusterLimit) { 19 | ClusterClientConfigCenter.closeClusterLimit = closeClusterLimit; 20 | } 21 | 22 | /** 23 | * 集群限流关闭 24 | */ 25 | public static boolean isClusterLimitClosed() { 26 | return closeClusterLimit; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/web/config/ClusterConfigChangedListener.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.web.config; 2 | 3 | import com.lifeofcoder.autolimiter.cluster.server.config.ClusterServerConfigModifier; 4 | import com.lifeofcoder.autolimiter.cluster.web.consts.FlowConsts; 5 | import org.springframework.stereotype.Component; 6 | 7 | /** 8 | * 集群控制参数 9 | * 10 | * @author xbc 11 | * @date 2021/7/2 12 | */ 13 | @Component 14 | public class ClusterConfigChangedListener { 15 | protected void valueChanged(String s) { 16 | ClusterServerConfigModifier.updateClusterConfig(FlowConsts.DEFAULT_NAMESPACE, s); 17 | } 18 | 19 | protected String key() { 20 | return FlowConsts.CLUSTER_CONFIG_KEY; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/web/consts/FlowConsts.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.web.consts; 2 | 3 | /** 4 | * 流控相关 5 | * 6 | * @author xbc 7 | * @date 2021/6/10 8 | */ 9 | public class FlowConsts { 10 | public static final String DEFAULT_NAMESPACE = "default"; 11 | 12 | public static final String CLUSTER_CONFIG_KEY = "cluster_flow_config"; 13 | 14 | public static final String SERVER_TRANSPORT_CONFIG = "server_transport_config"; 15 | 16 | /** 17 | * 计数配置 18 | */ 19 | public static final String COUNTER_SERVER_CONFIG = "counter_server_config"; 20 | 21 | public static final String METRIC_TYPE_UPDATE = "update"; 22 | 23 | public static final float DEF_CLIENT_COUNT_CHANGE_RATIO = 0.05F; 24 | } 25 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/config/impl/DefaultNodeConfigService.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.config.impl; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.ResponseDto; 4 | import com.lifeofcoder.autolimiter.dashboard.config.NodeConfigService; 5 | import org.slf4j.Logger; 6 | import org.slf4j.LoggerFactory; 7 | 8 | /** 9 | * 默认实现,什么也不做 10 | * 11 | * @author xbc 12 | * @date 2020/8/4 13 | */ 14 | public class DefaultNodeConfigService implements NodeConfigService { 15 | private final static Logger LOGGER = LoggerFactory.getLogger(DefaultNodeConfigService.class); 16 | 17 | @Override 18 | public ResponseDto updateNodeAddrs(String addrs) { 19 | LOGGER.info("注册Ignite节点信息到配置中心"); 20 | return ResponseDto.SUCCESS; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | autolimiter-parent 7 | com.lifeofcoder.autolimiter 8 | 1.0-SNAPSHOT 9 | 10 | autolimiter-cluster-parent 11 | autolimiter-cluster-parent 12 | 13 | pom 14 | 15 | 16 | autolimiter-cluster-client 17 | autolimiter-cluster-common 18 | autolimiter-cluster-server 19 | 20 | 21 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/mapping/converter/impl/Long2DateConverter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping.converter.impl; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.mapping.converter.BaseConverter; 4 | 5 | import java.util.Date; 6 | 7 | /** 8 | * Long转换为时间 9 | * 用sql的方式查询出来的都是对象类型,而不会是long,所以直接用Long转Date即可 10 | * 11 | * @author xbc 12 | * @date 2020/7/23 13 | */ 14 | public class Long2DateConverter extends BaseConverter { 15 | public Long2DateConverter() { 16 | super(Long.class, Date.class); 17 | } 18 | 19 | @Override 20 | public Date doConvert(Long srcObject) { 21 | if (null == srcObject) { 22 | return null; 23 | } 24 | 25 | return new Date(srcObject.longValue()); 26 | } 27 | } -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_googlecode_concurrentlinkedhashmap_concurrentlinkedhashmap_lru_1_4_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-client/src/main/java/com/lifeofcoder/autolimiter/client/AutoLimiterException.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.client; 2 | 3 | /** 4 | * 自动限流项目异常 5 | * 6 | * @author xbc 7 | * @date 2020/4/23 8 | */ 9 | public class AutoLimiterException extends RuntimeException { 10 | public AutoLimiterException() { 11 | } 12 | 13 | public AutoLimiterException(String message) { 14 | super(message); 15 | } 16 | 17 | public AutoLimiterException(String message, Throwable cause) { 18 | super(message, cause); 19 | } 20 | 21 | public AutoLimiterException(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | public AutoLimiterException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 26 | super(message, cause, enableSuppression, writableStackTrace); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/flow/rule/ClusterFlowRuleWrapper.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.flow.rule; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 集群限流规则 7 | * 8 | * @author xbc 9 | * @date 2021/6/30 10 | */ 11 | public class ClusterFlowRuleWrapper implements Serializable { 12 | private Long ruleId; 13 | 14 | /** 15 | * 如果没有flowRule,则表示删除 16 | */ 17 | private ClusterFlowRule flowRule; 18 | 19 | public Long getRuleId() { 20 | return ruleId; 21 | } 22 | 23 | public void setRuleId(Long ruleId) { 24 | this.ruleId = ruleId; 25 | } 26 | 27 | public ClusterFlowRule getFlowRule() { 28 | return flowRule; 29 | } 30 | 31 | public void setFlowRule(ClusterFlowRule flowRule) { 32 | this.flowRule = flowRule; 33 | } 34 | } -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/mapping/FieldMapping.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping; 2 | 3 | import java.lang.reflect.Field; 4 | import java.lang.reflect.Method; 5 | 6 | /** 7 | * 8 | * 9 | * @author xbc 10 | * @date 2020/7/21 11 | */ 12 | public class FieldMapping { 13 | private Field field; 14 | private Method setter; 15 | 16 | public FieldMapping(Field field, Method setter) { 17 | this.field = field; 18 | this.setter = setter; 19 | } 20 | 21 | public Field getField() { 22 | return field; 23 | } 24 | 25 | public void setField(Field field) { 26 | this.field = field; 27 | } 28 | 29 | public Method getSetter() { 30 | return setter; 31 | } 32 | 33 | public void setSetter(Method setter) { 34 | this.setter = setter; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /autolimiter-common/src/main/java/com/lifeofcoder/autolimiter/common/model/RouteMode.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.common.model; 2 | 3 | import com.alibaba.csp.sentinel.util.StringUtil; 4 | 5 | import java.util.Objects; 6 | 7 | /** 8 | * 路由模式枚举 9 | * 10 | * @author xbc 11 | * @date 2022/3/15 12 | */ 13 | public enum RouteMode { 14 | SYSTEM("system"), RULE("rule"); 15 | 16 | /** 17 | * 路由模式 18 | */ 19 | private String mode; 20 | 21 | RouteMode(String mode) { 22 | this.mode = mode; 23 | } 24 | 25 | public static RouteMode of(String mode) { 26 | if (StringUtil.isEmpty(mode)) { 27 | return SYSTEM; 28 | } 29 | 30 | for (RouteMode value : values()) { 31 | if (Objects.equals(value.mode, mode)) { 32 | return value; 33 | } 34 | } 35 | 36 | return SYSTEM; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /autolimiter-client-demo/target/classes/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | logging.level.root=info 3 | logging.level.com.lifeofcoder.autolimiter=debug 4 | logging.file.name=log.log 5 | logging.file.path=/export/Logs/autolimiter 6 | logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 7 | #hot load 8 | #\u70ED\u90E8\u7F72\u751F\u6548 9 | #spring.devtools.restart.enabled=true 10 | #classpath\u76EE\u5F55\u4E0B\u7684WEB-INF\u6587\u4EF6\u5939\u5185\u5BB9\u4FEE\u6539\u4E0D\u91CD\u542F 11 | #spring.devtools.restart.exclude=META-INF/* 12 | #\u8BBE\u7F6E\u89E6\u53D1\u542F\u52A8\u7684trigger\u6587\u4EF6\uFF0C\u53EA\u6709\u8FD9\u4E2A\u6587\u4EF6\u53D8\u66F4\u4E86\u624D\u4F1Arestart 13 | #spring.devtools.restart.trigger-file=reloadtrigger 14 | #\u81EA\u52A8\u9650\u6D41\u5668\u63A7\u5236\u53F0\u5730\u5740(\u591A\u4E2A\u7528\u9017\u53F7\u9694\u5F00) 15 | autolimiter.dashboard.addresses=127.0.0.1:80 16 | -------------------------------------------------------------------------------- /autolimiter-client-demo/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=8080 2 | logging.level.root=info 3 | logging.level.com.lifeofcoder.autolimiter=debug 4 | logging.file.name=log.log 5 | logging.file.path=/export/Logs/autolimiter 6 | logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 7 | #hot load 8 | #\u70ED\u90E8\u7F72\u751F\u6548 9 | #spring.devtools.restart.enabled=true 10 | #classpath\u76EE\u5F55\u4E0B\u7684WEB-INF\u6587\u4EF6\u5939\u5185\u5BB9\u4FEE\u6539\u4E0D\u91CD\u542F 11 | #spring.devtools.restart.exclude=META-INF/* 12 | #\u8BBE\u7F6E\u89E6\u53D1\u542F\u52A8\u7684trigger\u6587\u4EF6\uFF0C\u53EA\u6709\u8FD9\u4E2A\u6587\u4EF6\u53D8\u66F4\u4E86\u624D\u4F1Arestart 13 | #spring.devtools.restart.trigger-file=reloadtrigger 14 | #\u81EA\u52A8\u9650\u6D41\u5668\u63A7\u5236\u53F0\u5730\u5740(\u591A\u4E2A\u7528\u9017\u53F7\u9694\u5F00) 15 | autolimiter.dashboard.addresses=127.0.0.1:80 16 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__com_google_guava_listenablefuture_9999_0_empty_to_avoid_conflict_with_guava.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/mapping/converter/ConverterRegistey.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping.converter; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | /** 7 | * 转换类注册器 8 | * 9 | * @author xbc 10 | * @date 2020/7/23 11 | */ 12 | public class ConverterRegistey { 13 | private static List converterList = new ArrayList<>(2); 14 | 15 | public static void register(BaseConverter converter) { 16 | converterList.add(converter); 17 | } 18 | 19 | public static Converter getConverter(Class srcType, Class targetType) { 20 | for (BaseConverter baseConverter : converterList) { 21 | if (baseConverter.getSrcType().equals(srcType) && baseConverter.getTargetType().equals(targetType)) { 22 | return baseConverter; 23 | } 24 | } 25 | 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/response/data/DynamicFlowTokenResponseData.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.common.response.data; 2 | 3 | /** 4 | * 动态限流响应数据 5 | * 6 | * @author xbc 7 | * @date 2022/3/17 8 | */ 9 | public class DynamicFlowTokenResponseData { 10 | /** 11 | * 最新的流控数据 12 | */ 13 | private int count; 14 | 15 | /** 16 | * 等待多久之后再次请求(单位毫秒) 17 | */ 18 | private int waitInMs; 19 | 20 | public int getCount() { 21 | return count; 22 | } 23 | 24 | public DynamicFlowTokenResponseData setCount(int count) { 25 | this.count = count; 26 | return this; 27 | } 28 | 29 | public int getWaitInMs() { 30 | return waitInMs; 31 | } 32 | 33 | public DynamicFlowTokenResponseData setWaitInMs(int waitInMs) { 34 | this.waitInMs = waitInMs; 35 | return this; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/index.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sentinel Dashboard 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/HELP.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | ### Reference Documentation 4 | For further reference, please consider the following sections: 5 | 6 | * [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) 7 | * [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.6.6/maven-plugin/reference/html/) 8 | * [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.6.6/maven-plugin/reference/html/#build-image) 9 | * [Spring Web](https://docs.spring.io/spring-boot/docs/2.6.6/reference/htmlsingle/#boot-features-developing-web-applications) 10 | 11 | ### Guides 12 | The following guides illustrate how to use some features concretely: 13 | 14 | * [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) 15 | * [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) 16 | * [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) 17 | 18 | -------------------------------------------------------------------------------- /autolimiter-common/src/main/java/com/lifeofcoder/autolimiter/common/utils/NetworkHelper.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.common.utils; 2 | 3 | /** 4 | * 5 | * 6 | * @author xbc 7 | * @date 2022/4/2 8 | */ 9 | public class NetworkHelper { 10 | public NetworkHelper() { 11 | } 12 | 13 | public static long ipToLong(String strIp) throws RuntimeException { 14 | try { 15 | String[] ip = strIp.split("\\."); 16 | return (Long.parseLong(ip[0]) << 24) + (Long.parseLong(ip[1]) << 16) + (Long.parseLong(ip[2]) << 8) + Long.parseLong(ip[3]); 17 | } 18 | catch (Exception var2) { 19 | throw new RuntimeException("Failed to parse ip string to number.", var2); 20 | } 21 | } 22 | 23 | public static long ipToLong(String strIp, long defValue) { 24 | try { 25 | return ipToLong(strIp); 26 | } 27 | catch (RuntimeException var4) { 28 | return defValue; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/dao/BaseIgniteDao.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.dao; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.ignite.IgniteDao; 4 | import org.apache.ignite.cache.query.SqlFieldsQuery; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * BaseIgniteDao 10 | * 11 | * @author xbc 12 | * @date 2020/7/21 13 | */ 14 | public abstract class BaseIgniteDao { 15 | protected IgniteDao igniteDao; 16 | 17 | private Class modeClass; 18 | 19 | public BaseIgniteDao(IgniteDao igniteDao) { 20 | this.igniteDao = igniteDao; 21 | } 22 | 23 | public List queryObject(SqlFieldsQuery sqlFieldsQuery) { 24 | T t = null; 25 | try { 26 | t = modeClass.newInstance(); 27 | } 28 | catch (InstantiationException e) { 29 | } 30 | catch (IllegalAccessException e) { 31 | } 32 | 33 | return null; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/identityservice.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('IdentityService', ['$http', function ($http) { 4 | 5 | this.fetchIdentityOfMachine = function (ip, port, searchKey) { 6 | var param = { 7 | ip: ip, 8 | port: port, 9 | searchKey: searchKey 10 | }; 11 | return $http({ 12 | url: 'resource/machineResource.json', 13 | params: param, 14 | method: 'GET' 15 | }); 16 | }; 17 | this.fetchClusterNodeOfMachine = function (ip, port, searchKey) { 18 | var param = { 19 | ip: ip, 20 | port: port, 21 | type: 'cluster', 22 | searchKey: searchKey 23 | }; 24 | return $http({ 25 | url: 'resource/machineResource.json', 26 | params: param, 27 | method: 'GET' 28 | }); 29 | }; 30 | }]); 31 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/machineservice.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('MachineService', ['$http', '$httpParamSerializerJQLike', 4 | function ($http, $httpParamSerializerJQLike) { 5 | this.getAppMachines = function (app) { 6 | return $http({ 7 | url: 'app/' + app + '/machines.json', 8 | method: 'GET' 9 | }); 10 | }; 11 | this.removeAppMachine = function (app, ip, port) { 12 | return $http({ 13 | url: 'app/' + app + '/machine/remove.json', 14 | method: 'POST', 15 | headers: { 16 | 'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8' 17 | }, 18 | data: $httpParamSerializerJQLike({ 19 | ip: ip, 20 | port: port 21 | }) 22 | }); 23 | }; 24 | }] 25 | ); 26 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/license-stat.csv: -------------------------------------------------------------------------------- 1 | Type,Package,License 2 | npm,angular,MIT License 3 | npm,angular-animate,MIT License 4 | npm,angular-bootstrap,MIT License 5 | npm,angular-clipboard,MIT License 6 | npm,angular-cookies,MIT License 7 | npm,angular-date-time-input,MIT License 8 | npm,angular-loading-bar,MIT License 9 | npm,angular-mocks,MIT License 10 | npm,angular-resource,MIT License 11 | npm,angular-route,MIT License 12 | npm,angular-selectize2,MIT License 13 | npm,angular-table-resize,MIT License 14 | npm,angular-touch,MIT License 15 | npm,angular-ui-notification,MIT License 16 | npm,angular-ui-router,MIT License 17 | npm,angular-utils-pagination,MIT License 18 | npm,angularjs-bootstrap-datetimepicker,MIT License 19 | npm,bootstrap-switch,Apache License 2.0 20 | npm,bootstrap-tagsinput,MIT License 21 | npm,moment,MIT License 22 | npm,ng-dialog,MIT License 23 | npm,ng-tags-input,MIT License 24 | npm,oclazyload,MIT License 25 | npm,selectize,Apache License 2.0 26 | lib,jsTreeTable,MIT License -------------------------------------------------------------------------------- /autolimiter-common/src/main/java/com/lifeofcoder/autolimiter/common/utils/OsHelper.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.common.utils; 2 | 3 | import io.netty.util.internal.SystemPropertyUtil; 4 | 5 | import java.util.Locale; 6 | 7 | /** 8 | * 操作系统工具 9 | * 10 | * @author xbc 11 | * @date 2022/4/2 12 | */ 13 | public class OsHelper { 14 | public OsHelper() { 15 | } 16 | 17 | public static OsHelper.OsType getOsType() { 18 | String name = SystemPropertyUtil.get("os.name").toLowerCase(Locale.UK).trim(); 19 | if (name.startsWith("linux")) { 20 | return OsHelper.OsType.LINUX; 21 | } 22 | else if (name.startsWith("mac")) { 23 | return OsHelper.OsType.MAC; 24 | } 25 | else { 26 | return name.startsWith("windows") ? OsHelper.OsType.WIN : OsHelper.OsType.OTHER; 27 | } 28 | } 29 | 30 | public static enum OsType { 31 | MAC, WIN, LINUX, OTHER; 32 | 33 | private OsType() { 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/rule/DynamicRuleProvider.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.rule; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public interface DynamicRuleProvider { 23 | 24 | T getRules(String appName) throws Exception; 25 | } 26 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/rule/DynamicClusterFlowRuleChecker.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.rule; 2 | 3 | import com.alibaba.csp.sentinel.context.Context; 4 | import com.alibaba.csp.sentinel.node.DefaultNode; 5 | import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; 6 | import com.lifeofcoder.autolimiter.cluster.client.consts.ClusterCheckResult; 7 | import com.lifeofcoder.autolimiter.cluster.client.dynamic.DynamicFlowController; 8 | 9 | /** 10 | * 动态集群规则检测 11 | */ 12 | public class DynamicClusterFlowRuleChecker extends AbstractClusterFlowRuleChecker { 13 | /** 14 | * 动态流控控制器 15 | */ 16 | private DynamicFlowController dynamicFlowController = new DynamicFlowController(); 17 | 18 | @Override 19 | protected ClusterCheckResult passClusterCheck0(FlowRule rule, Context context, DefaultNode node, int acquireCount, boolean prioritized) { 20 | return dynamicFlowController.clusterFlowCheck(rule.getClusterConfig().getFlowId()); 21 | } 22 | } -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | autolimiter-cluster-common 7 | jar 8 | 9 | 10 | autolimiter-cluster-parent 11 | com.lifeofcoder.autolimiter 12 | 1.0-SNAPSHOT 13 | 14 | 15 | 16 | 17 | com.alibaba.csp 18 | sentinel-core 19 | 20 | 21 | org.slf4j 22 | slf4j-api 23 | provided 24 | 25 | 26 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/ignite/dao/MetricsDao.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.ignite.dao; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.model.IgniteMetrics; 4 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.MetricEntity; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * 10 | * 11 | * @author xbc 12 | * @date 2020/7/22 13 | */ 14 | public interface MetricsDao { 15 | /** 16 | * 新增Metric 17 | * @param igniteMetrics 待新增的Metric 18 | */ 19 | void save(IgniteMetrics igniteMetrics); 20 | 21 | /** 22 | * 根据条件查询Metric 23 | * @param app app名称 24 | * @param resource 资源名称 25 | * @param startTime 开始时间 26 | * @param endTime 结束时间 27 | * @return 查询结果 28 | */ 29 | List queryByAppAndResourceBetween(String app, String resource, long startTime, long endTime); 30 | 31 | /** 32 | * 查询APP下所有的Metric 33 | * @param app app名称 34 | * @return 查询结果 35 | */ 36 | List listOfApp(String app); 37 | } 38 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/web/controller/ClusterController.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.web.controller; 2 | 3 | import com.lifeofcoder.autolimiter.cluster.flow.client.ClientsInfo; 4 | import com.lifeofcoder.autolimiter.cluster.flow.statistic.ClusterMetricStatistics; 5 | import com.lifeofcoder.autolimiter.cluster.flow.statistic.metric.ClusterMetric; 6 | import org.springframework.web.bind.annotation.RequestMapping; 7 | import org.springframework.web.bind.annotation.RestController; 8 | 9 | /** 10 | * 11 | * 12 | * @author xbc 13 | * @date 2022/3/23 14 | */ 15 | @RestController 16 | @RequestMapping("/cluster") 17 | public class ClusterController { 18 | 19 | @RequestMapping("/getClientsInfo") 20 | public ClientsInfo getClientsInfo(Long ruleId) { 21 | ClusterMetric metric = ClusterMetricStatistics.getMetricAndRecordHistory(ruleId); 22 | if (null == metric) { 23 | return null; 24 | } 25 | 26 | return metric.getClusterRuleClients().getClientsInfo(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/test/java/com/lifeofcoder/autolimiter/dashboard/mapping/MappingUtilTest.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.discovery.MachineInfo; 4 | import org.junit.Assert; 5 | import org.junit.Test; 6 | 7 | public class MappingUtilTest { 8 | @Test 9 | public void getOrCreate() { 10 | FieldWrapper machineFieldWrapper = MappingUtil.getOrCreate(MachineInfo.class); 11 | MachineInfo machineInfo = new MachineInfo(); 12 | machineFieldWrapper.set(machineInfo, "LAST_HEARTBEAT", 100); 13 | machineFieldWrapper.set(machineInfo, "APP", "bocai"); 14 | machineFieldWrapper.set(machineInfo, "HEARTBEAT_VERSION", 12); 15 | machineFieldWrapper.set(machineInfo, "VERSION", "13L"); 16 | Assert.assertEquals(100, machineInfo.getLastHeartbeat()); 17 | Assert.assertEquals("bocai", machineInfo.getApp()); 18 | Assert.assertEquals(12, machineInfo.getHeartbeatVersion()); 19 | Assert.assertEquals("13L", machineInfo.getVersion()); 20 | 21 | } 22 | } -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/util/ClusterRuleUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.util; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public final class ClusterRuleUtil { 23 | 24 | public static boolean validId(Long id) { 25 | return id != null && id > 0; 26 | } 27 | 28 | private ClusterRuleUtil() { 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/mapping/converter/BaseConverter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.mapping.converter; 2 | 3 | /** 4 | * 5 | * 6 | * @author xbc 7 | * @date 2020/7/23 8 | */ 9 | public abstract class BaseConverter implements Converter { 10 | private Class srcType; 11 | private Class targetType; 12 | 13 | public BaseConverter(Class srcType, Class targetType) { 14 | this.srcType = srcType; 15 | this.targetType = targetType; 16 | } 17 | 18 | @Override 19 | public Object convert(Object src) { 20 | return doConvert((S) src); 21 | } 22 | 23 | public abstract T doConvert(S srcObject); 24 | 25 | public Class getSrcType() { 26 | return srcType; 27 | } 28 | 29 | public void setSrcType(Class srcType) { 30 | this.srcType = srcType; 31 | } 32 | 33 | public Class getTargetType() { 34 | return targetType; 35 | } 36 | 37 | public void setTargetType(Class targetType) { 38 | this.targetType = targetType; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/domain/cluster/request/ClusterModifyRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.domain.cluster.request; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public interface ClusterModifyRequest { 23 | 24 | String getApp(); 25 | 26 | String getIp(); 27 | 28 | Integer getPort(); 29 | 30 | Integer getMode(); 31 | } 32 | -------------------------------------------------------------------------------- /.idea/artifacts/autolimiter_cluster_server__1__war_exploded.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/autolimiter-cluster-parent/target/autolimiter-cluster-server-1.0-SNAPSHOT 4 | 5 | 6 | true 7 | autolimiter-cluster-server (1) 8 | war 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/JsonUtils.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package com.lifeofcoder.autolimiter.dashboard; 5 | 6 | import com.alibaba.fastjson.JSON; 7 | import com.alibaba.fastjson.TypeReference; 8 | import org.slf4j.Logger; 9 | import org.slf4j.LoggerFactory; 10 | 11 | import java.util.List; 12 | 13 | /** 14 | * Json工具类 15 | * @author xbc 16 | */ 17 | public class JsonUtils { 18 | 19 | private static final Logger log = LoggerFactory.getLogger(JsonUtils.class); 20 | 21 | public static T parseObject(String json, Class cls) { 22 | return JSON.parseObject(json, cls); 23 | } 24 | 25 | public static T parseObject(String json, TypeReference cls) { 26 | return JSON.parseObject(json, cls); 27 | } 28 | 29 | public static List parseArray(String json, Class tClass) { 30 | return JSON.parseArray(json, tClass); 31 | } 32 | 33 | /** 34 | * 将对象转换成json 字符串 35 | * @param obj 36 | * @return 37 | */ 38 | public static String toJson(Object obj) { 39 | return JSON.toJSONString(obj); 40 | } 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/views/dialog/confirm-dialog.html: -------------------------------------------------------------------------------- 1 |
2 | {{confirmDialog.title}} 3 |
4 |
5 |
6 |

7 | {{confirmDialog.attentionTitle}}: 8 |
9 |
10 | {{confirmDialog.attention}} 11 |

12 |
13 |
14 |
15 | 16 | 17 |
18 |
19 |
20 |
21 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/index_dev.htm: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Sentinel 控制台 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /autolimiter-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | autolimiter-parent 7 | com.lifeofcoder.autolimiter 8 | 1.0-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | autolimiter-common 13 | 14 | 15 | 16 | org.slf4j 17 | slf4j-api 18 | 1.7.30 19 | provided 20 | 21 | 22 | io.netty 23 | netty-all 24 | 25 | 26 | com.alibaba.csp 27 | sentinel-core 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/model/BaseIgniteModel.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.model; 2 | 3 | import java.io.Serializable; 4 | import java.util.Date; 5 | 6 | public interface BaseIgniteModel extends Serializable { 7 | String SCHEMA = "al"; 8 | 9 | /** 10 | * 缓存存放的key 11 | */ 12 | String key(); 13 | 14 | default long longValue(Long val) { 15 | if (null == val) { 16 | return 0; 17 | } 18 | 19 | return val.longValue(); 20 | } 21 | 22 | default long date2Long(Date val) { 23 | if (null == val) { 24 | return 0; 25 | } 26 | 27 | return val.getTime(); 28 | } 29 | 30 | default Date long2Date(long val) { 31 | return new Date(val); 32 | } 33 | 34 | default int intValue(Integer val) { 35 | if (null == val) { 36 | return 0; 37 | } 38 | 39 | return val.intValue(); 40 | } 41 | 42 | default double doubleValue(Double val) { 43 | if (null == val) { 44 | return 0; 45 | } 46 | 47 | return val.doubleValue(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/services/metricservice.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.service('MetricService', ['$http', function ($http) { 4 | 5 | this.queryAppSortedIdentities = function (params) { 6 | return $http({ 7 | url: '/metric/queryTopResourceMetric.json', 8 | params: params, 9 | method: 'GET' 10 | }); 11 | }; 12 | 13 | this.queryByAppAndIdentity = function (params) { 14 | return $http({ 15 | url: '/metric/queryByAppAndResource.json', 16 | params: params, 17 | method: 'GET' 18 | }); 19 | }; 20 | 21 | this.queryByMachineAndIdentity = function (ip, port, identity, startTime, endTime) { 22 | var param = { 23 | ip: ip, 24 | port: port, 25 | identity: identity, 26 | startTime: startTime.getTime(), 27 | endTime: endTime.getTime() 28 | }; 29 | 30 | return $http({ 31 | url: '/metric/queryByAppAndResource.json', 32 | params: param, 33 | method: 'GET' 34 | }); 35 | }; 36 | }]); 37 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/request/RequestEntityDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec.request; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityDecoder; 19 | import com.lifeofcoder.autolimiter.cluster.common.request.Request; 20 | 21 | /** 22 | * @author Eric Zhao 23 | * @since 1.4.0 24 | */ 25 | public interface RequestEntityDecoder extends EntityDecoder { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/response/ResponseEntityDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec.response; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityDecoder; 19 | import com.lifeofcoder.autolimiter.cluster.common.response.Response; 20 | 21 | /** 22 | * @author Eric Zhao 23 | * @since 1.4.0 24 | */ 25 | public interface ResponseEntityDecoder extends EntityDecoder { 26 | 27 | } 28 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/exception/SentinelClusterException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.exception; 17 | 18 | /** 19 | * @author jialiang.ljl 20 | * @since 1.4.0 21 | */ 22 | public class SentinelClusterException extends Exception { 23 | public SentinelClusterException(String errorMsg) { 24 | super(errorMsg); 25 | } 26 | 27 | @Override 28 | public Throwable fillInStackTrace() { 29 | return this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/config/ServerTransportConfigObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.config; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public interface ServerTransportConfigObserver { 23 | 24 | /** 25 | * Callback on server transport config (e.g. port) change. 26 | * 27 | * @param config new server transport config 28 | */ 29 | void onTransportConfigChange(ServerTransportConfig config); 30 | } 31 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/EntityDecoder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec; 17 | 18 | /** 19 | * @param source stream type 20 | * @param target entity type 21 | * @author Eric Zhao 22 | * @since 1.4.0 23 | */ 24 | public interface EntityDecoder { 25 | /** 26 | * Decode target object from source stream. 27 | * 28 | * @param source source stream 29 | * @return decoded target object 30 | */ 31 | T decode(S source); 32 | } 33 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/request/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.request; 17 | 18 | /** 19 | * Cluster transport request interface. 20 | * 21 | * @author Eric Zhao 22 | * @since 1.4.0 23 | */ 24 | public interface Request { 25 | /** 26 | * Get request type. 27 | * 28 | * @return request type 29 | */ 30 | int getType(); 31 | 32 | /** 33 | * Get request ID. 34 | * 35 | * @return unique request ID 36 | */ 37 | int getId(); 38 | } 39 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/scripts/controllers/login.js: -------------------------------------------------------------------------------- 1 | var app = angular.module('sentinelDashboardApp'); 2 | 3 | app.controller('LoginCtl', ['$scope', '$state', '$window', 'AuthService', 4 | function ($scope, $state, $window, AuthService) { 5 | // If auth passed, jump to the index page directly 6 | if ($window.localStorage.getItem('session_sentinel_admin')) { 7 | $state.go('dashboard'); 8 | } 9 | 10 | $scope.login = function () { 11 | if (!$scope.username) { 12 | alert('请输入用户名'); 13 | return; 14 | } 15 | 16 | if (!$scope.password) { 17 | alert('请输入密码'); 18 | return; 19 | } 20 | 21 | var param = {"username": $scope.username, "password": $scope.password}; 22 | 23 | AuthService.login(param).success(function (data) { 24 | if (data.code == 0) { 25 | $window.localStorage.setItem('session_sentinel_admin', JSON.stringify(data.data)); 26 | $state.go('dashboard'); 27 | } else { 28 | alert(data.msg); 29 | } 30 | }); 31 | }; 32 | }] 33 | ); -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/flow/client/ClientsInfo.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.flow.client; 2 | 3 | import java.io.Serializable; 4 | 5 | /** 6 | * 客户端信息 7 | * 8 | * @author xbc 9 | * @date 2022/3/23 10 | */ 11 | public class ClientsInfo implements Serializable { 12 | private int clientNum; 13 | 14 | private int totalCount; 15 | 16 | private int deadClient; 17 | 18 | public ClientsInfo(int clientNum, int totalCount, int deadClient) { 19 | this.clientNum = clientNum; 20 | this.totalCount = totalCount; 21 | this.deadClient = deadClient; 22 | } 23 | 24 | public int getClientNum() { 25 | return clientNum; 26 | } 27 | 28 | public void setClientNum(int clientNum) { 29 | this.clientNum = clientNum; 30 | } 31 | 32 | public int getTotalCount() { 33 | return totalCount; 34 | } 35 | 36 | public void setTotalCount(int totalCount) { 37 | this.totalCount = totalCount; 38 | } 39 | 40 | public int getDeadClient() { 41 | return deadClient; 42 | } 43 | 44 | public void setDeadClient(int deadClient) { 45 | this.deadClient = deadClient; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/ServerConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public final class ServerConstants { 23 | 24 | public static final int SERVER_STATUS_OFF = 0; 25 | public static final int SERVER_STATUS_STARTING = 1; 26 | public static final int SERVER_STATUS_STARTED = 2; 27 | 28 | public static final String DEFAULT_NAMESPACE = "default"; 29 | 30 | private ServerConstants() { 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/result/DynamicTokenResult.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.common.result; 2 | 3 | /** 4 | * 动态请求结果 5 | * 6 | * @author xbc 7 | * @date 2022/3/17 8 | */ 9 | public class DynamicTokenResult { 10 | private Integer status; 11 | 12 | /** 13 | * 最新的流控数据 14 | */ 15 | private int count; 16 | 17 | /** 18 | * 等待多久之后再次请求(单位毫秒) 19 | */ 20 | private int waitInMs; 21 | 22 | public int getCount() { 23 | return count; 24 | } 25 | 26 | public DynamicTokenResult setCount(int count) { 27 | this.count = count; 28 | return this; 29 | } 30 | 31 | public int getWaitInMs() { 32 | return waitInMs; 33 | } 34 | 35 | public DynamicTokenResult setWaitInMs(int waitInMs) { 36 | this.waitInMs = waitInMs; 37 | return this; 38 | } 39 | 40 | public DynamicTokenResult(Integer status) { 41 | this.status = status; 42 | } 43 | 44 | public Integer getStatus() { 45 | return status; 46 | } 47 | 48 | public DynamicTokenResult setStatus(Integer status) { 49 | this.status = status; 50 | return this; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/client/CommandFailedException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.client; 17 | 18 | /** 19 | * @author Eric Zhao 20 | */ 21 | public class CommandFailedException extends RuntimeException { 22 | 23 | public CommandFailedException() { 24 | } 25 | 26 | public CommandFailedException(String message) { 27 | super(message); 28 | } 29 | 30 | @Override 31 | public synchronized Throwable fillInStackTrace() { 32 | return this; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/resources/META-INF/services/com.alibaba.csp.sentinel.command.CommandHandler: -------------------------------------------------------------------------------- 1 | com.lifeofcoder.autolimiter.cluster.server.command.handler.ModifyClusterServerFlowConfigHandler 2 | com.lifeofcoder.autolimiter.cluster.server.command.handler.FetchClusterFlowRulesCommandHandler 3 | com.lifeofcoder.autolimiter.cluster.server.command.handler.FetchClusterParamFlowRulesCommandHandler 4 | com.lifeofcoder.autolimiter.cluster.server.command.handler.FetchClusterServerConfigHandler 5 | com.lifeofcoder.autolimiter.cluster.server.command.handler.ModifyClusterServerTransportConfigHandler 6 | com.lifeofcoder.autolimiter.cluster.server.command.handler.ModifyServerNamespaceSetHandler 7 | com.lifeofcoder.autolimiter.cluster.server.command.handler.ModifyClusterFlowRulesCommandHandler 8 | com.lifeofcoder.autolimiter.cluster.server.command.handler.ModifyClusterParamFlowRulesCommandHandler 9 | com.lifeofcoder.autolimiter.cluster.server.command.handler.FetchClusterServerInfoCommandHandler 10 | com.lifeofcoder.autolimiter.cluster.server.command.handler.FetchClusterMetricCommandHandler 11 | com.lifeofcoder.autolimiter.cluster.server.command.handler.SendClusterMetricCommandHandler 12 | com.lifeofcoder.autolimiter.cluster.server.command.handler.GetClusterClientsCommandHandler -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/client/CommandNotFoundException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.client; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 0.2.1 21 | */ 22 | public class CommandNotFoundException extends Exception { 23 | 24 | public CommandNotFoundException() { 25 | } 26 | 27 | public CommandNotFoundException(String message) { 28 | super(message); 29 | } 30 | 31 | @Override 32 | public synchronized Throwable fillInStackTrace() { 33 | return this; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/datasource/entity/rule/RuleEntity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule; 17 | 18 | import com.alibaba.csp.sentinel.slots.block.Rule; 19 | 20 | import java.util.Date; 21 | 22 | /** 23 | * @author leyou 24 | */ 25 | public interface RuleEntity { 26 | 27 | Long getId(); 28 | 29 | void setId(Long id); 30 | 31 | String getApp(); 32 | 33 | String getIp(); 34 | 35 | Integer getPort(); 36 | 37 | Date getGmtCreate(); 38 | 39 | Rule toRule(); 40 | } 41 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/request/RequestEntityWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec.request; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityWriter; 19 | import com.lifeofcoder.autolimiter.cluster.common.request.Request; 20 | 21 | /** 22 | * A universal {@link EntityWriter} interface for publishing {@link Request} to a target stream. 23 | * 24 | * @author Eric Zhao 25 | * @since 1.4.0 26 | */ 27 | public interface RequestEntityWriter extends EntityWriter { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/rule/DynamicRulePublisher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.rule; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public interface DynamicRulePublisher { 23 | 24 | /** 25 | * Publish rules to remote rule configuration center for given application name. 26 | * 27 | * @param app app name 28 | * @param rules list of rules to push 29 | * @throws Exception if some error occurs 30 | */ 31 | void publish(String app, T rules) throws Exception; 32 | } 33 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/annotation/RequestType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.annotation; 17 | 18 | import java.lang.annotation.*; 19 | 20 | /** 21 | * Request type annotation for handlers, codes, etc. 22 | * 23 | * @author Eric Zhao 24 | * @since 1.4.0 25 | */ 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ElementType.TYPE}) 28 | @Documented 29 | public @interface RequestType { 30 | /** 31 | * Type of the request to handle. 32 | * 33 | * @return type of the request 34 | */ 35 | int value(); 36 | } 37 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/connection/Connection.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.connection; 17 | 18 | import java.net.SocketAddress; 19 | 20 | /** 21 | * @author xuyue 22 | * @author Eric Zhao 23 | * @since 1.4.0 24 | */ 25 | public interface Connection extends AutoCloseable { 26 | 27 | SocketAddress getLocalAddress(); 28 | 29 | int getRemotePort(); 30 | 31 | String getRemoteIP(); 32 | 33 | void refreshLastReadTime(long lastReadTime); 34 | 35 | long getLastReadTime(); 36 | 37 | String getConnectionKey(); 38 | } 39 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/response/ResponseEntityWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec.response; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityWriter; 19 | import com.lifeofcoder.autolimiter.cluster.common.response.Response; 20 | 21 | /** 22 | * A universal {@link EntityWriter} interface for publishing {@link Response} to a target stream. 23 | * 24 | * @author Eric Zhao 25 | * @since 1.4.0 26 | */ 27 | public interface ResponseEntityWriter extends EntityWriter { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/customized/rule/IgniteSystemRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.customized.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity; 19 | import org.springframework.context.annotation.Primary; 20 | import org.springframework.stereotype.Component; 21 | 22 | @Primary 23 | @Component 24 | public class IgniteSystemRuleStore extends IgniteRuleRepositoryAdapter { 25 | @Override 26 | protected String cacheName() { 27 | return "SystemRuleEntity"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/codec/EntityWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.codec; 17 | 18 | /** 19 | * A universal interface for publishing entities to a target stream. 20 | * 21 | * @param entity type 22 | * @param target stream type 23 | * @author Eric Zhao 24 | * @since 1.4.0 25 | */ 26 | public interface EntityWriter { 27 | /** 28 | * Write the provided entity to target stream. 29 | * 30 | * @param entity entity to publish 31 | * @param target the target stream 32 | */ 33 | void writeTo(E entity, T target); 34 | } 35 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/customized/rule/IgniteDegradeRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.customized.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity; 19 | import org.springframework.context.annotation.Primary; 20 | import org.springframework.stereotype.Component; 21 | 22 | @Primary 23 | @Component 24 | public class IgniteDegradeRuleStore extends IgniteRuleRepositoryAdapter { 25 | @Override 26 | protected String cacheName() { 27 | return "DegradeRuleEntity"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/customized/rule/IgniteAuthorityRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.customized.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule.AuthorityRuleEntity; 19 | import org.springframework.context.annotation.Primary; 20 | import org.springframework.stereotype.Component; 21 | 22 | @Primary 23 | @Component 24 | public class IgniteAuthorityRuleStore extends IgniteRuleRepositoryAdapter { 25 | @Override 26 | protected String cacheName() { 27 | return "AuthorityRuleEntity"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/webapp/resources/app/views/pagination.tpl.html: -------------------------------------------------------------------------------- 1 | 19 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/customized/rule/IgniteGatewayFlowRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.customized.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.gateway.GatewayFlowRuleEntity; 19 | import org.springframework.context.annotation.Primary; 20 | import org.springframework.stereotype.Component; 21 | 22 | @Primary 23 | @Component 24 | public class IgniteGatewayFlowRuleStore extends IgniteRuleRepositoryAdapter { 25 | @Override 26 | protected String cacheName() { 27 | return "GatewayFlowRuleEntity"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/codec/data/PingResponseDataWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.codec.data; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityWriter; 19 | import io.netty.buffer.ByteBuf; 20 | 21 | /** 22 | * @author Eric Zhao 23 | * @since 1.4.0 24 | */ 25 | public class PingResponseDataWriter implements EntityWriter { 26 | 27 | @Override 28 | public void writeTo(Integer entity, ByteBuf target) { 29 | if (entity == null || target == null) { 30 | return; 31 | } 32 | target.writeInt(entity); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/init/impl/IgniteListenerStarter.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.dashboard.init.impl; 2 | 3 | import com.lifeofcoder.autolimiter.dashboard.ignite.listener.DiscoveryEventListener; 4 | import com.lifeofcoder.autolimiter.dashboard.init.Starter; 5 | import org.apache.ignite.Ignite; 6 | import org.apache.ignite.cluster.ClusterNode; 7 | import org.apache.ignite.events.DiscoveryEvent; 8 | import org.apache.ignite.events.EventType; 9 | import org.springframework.beans.factory.annotation.Autowired; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * Ignite监听启动 14 | * 15 | * @author xbc 16 | * @date 2020/7/29 17 | */ 18 | @Component 19 | public class IgniteListenerStarter implements Starter { 20 | @Autowired 21 | private DiscoveryEventListener listener; 22 | 23 | @Autowired 24 | private Ignite ignite; 25 | 26 | @Override 27 | public void start() { 28 | //主动发起本地事件,因为本地机器启动的时候自己收不到自己的启动事件 29 | ClusterNode clusterNode = ignite.cluster().localNode(); 30 | DiscoveryEvent discoveryEvent = new DiscoveryEvent(); 31 | discoveryEvent.eventNode(clusterNode); 32 | discoveryEvent.type(EventType.EVT_NODE_JOINED); 33 | ignite.events().localListen(listener, EventType.EVTS_DISCOVERY); 34 | listener.apply(discoveryEvent); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | #spring settings 2 | spring.http.encoding.force=true 3 | spring.http.encoding.charset=UTF-8 4 | spring.http.encoding.enabled=true 5 | #logging settings 6 | logging.level.org.springframework=INFO 7 | logging.level.root=INFO 8 | logging.file.name=/export/Logs/csp/sentinel-dashboard.log 9 | logging.pattern.file=%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 10 | #logging.pattern.console= %d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n 11 | #auth settings 12 | auth.filter.exclude-urls=/,/auth/login,/auth/logout,/registry/machine,/version 13 | auth.filter.exclude-url-suffixes=htm,html,js,css,map,ico,ttf,woff,png 14 | # If auth.enabled=false, Sentinel console disable login 15 | auth.username=sentinel 16 | auth.password=sentinel 17 | # Inject the dashboard version. It's required to enable 18 | # filtering in pom.xml for this resource file. 19 | sentinel.dashboard.version=1.7.1 20 | server.port=80 21 | #SpringDevTools 22 | #spring.devtools.restart.enabled=false 23 | #\u96C6\u7FA4\u63A7\u5236\u53F0\u6CE8\u518C\u5730\u5740\uFF08\u586B\u5199\u6240\u6709\u63A7\u5236\u53F0IP\u5730\u5740\uFF0C\u591A\u4E2A\u7528\u9017\u53F7\u9694\u5F00\uFF09 24 | ignite.register.addresses=127.0.0.1 25 | #\u96C6\u7FA4Master\u8282\u70B9\u53D8\u66F4\u8282\u70B9\u4FE1\u606F\u5EF6\u8FDF\u65F6\u957F(\u5355\u4F4D\u79D2) 26 | dashboard.register.delay=30 -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-common/src/main/java/com/lifeofcoder/autolimiter/cluster/common/response/Response.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.common.response; 17 | 18 | /** 19 | * Cluster transport response interface. 20 | * 21 | * @author Eric Zhao 22 | * @since 1.4.0 23 | */ 24 | public interface Response { 25 | /** 26 | * Get response ID. 27 | * 28 | * @return response ID 29 | */ 30 | int getId(); 31 | 32 | /** 33 | * Get response type. 34 | * 35 | * @return response type 36 | */ 37 | int getType(); 38 | 39 | /** 40 | * Get response status. 41 | * 42 | * @return response status 43 | */ 44 | int getStatus(); 45 | } 46 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/ClientConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.client; 17 | 18 | /** 19 | * @author Eric Zhao 20 | * @since 1.4.0 21 | */ 22 | public final class ClientConstants { 23 | public static final int TYPE_PING = 0; 24 | public static final int TYPE_FLOW = 1; 25 | public static final int TYPE_PARAM_FLOW = 2; 26 | //动态流控 27 | public static final int TYPE_DYNAMIC_FLOW = 3; 28 | 29 | public static final int CLIENT_STATUS_OFF = 0; 30 | public static final int CLIENT_STATUS_PENDING = 1; 31 | public static final int CLIENT_STATUS_STARTED = 2; 32 | 33 | private ClientConstants() { 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/common/config/ServerChangeObserver.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.client.common.config; 17 | 18 | import com.lifeofcoder.autolimiter.common.config.ClusterClientConfig; 19 | import com.lifeofcoder.autolimiter.common.config.ClusterServerTopoConfig; 20 | 21 | /** 22 | * @author Eric Zhao 23 | * @since 1.4.0 24 | */ 25 | public interface ServerChangeObserver { 26 | 27 | /** 28 | * 服务端Topo结构变更 29 | */ 30 | void onClusterServerTopoChange(ClusterServerTopoConfig assignConfig); 31 | 32 | /** 33 | * 集群客户端配置变更 34 | */ 35 | void onClusterClientConfigChange(ClusterClientConfig clusterClientConfig); 36 | } 37 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-client/src/main/java/com/lifeofcoder/autolimiter/cluster/client/dynamic/DynamicFlowController.java: -------------------------------------------------------------------------------- 1 | package com.lifeofcoder.autolimiter.cluster.client.dynamic; 2 | 3 | import com.lifeofcoder.autolimiter.cluster.client.consts.ClusterCheckResult; 4 | import org.slf4j.Logger; 5 | import org.slf4j.LoggerFactory; 6 | 7 | /** 8 | * 动态流控控制器 9 | * 动态集群流控策略: 10 | * 1、所有机器流控动态分配到单机上执行单机流控 11 | * 2、客户端每一秒发送一次请求到集群节点去获取最新的流控信息 12 | * 13 | * @author xbc 14 | * @date 2022/3/17 15 | */ 16 | public class DynamicFlowController { 17 | private final static Logger LOGGER = LoggerFactory.getLogger(DynamicFlowController.class); 18 | 19 | /** 20 | * 检测集群流控结果 21 | */ 22 | public ClusterCheckResult clusterFlowCheck(Long flowId) { 23 | if (null == flowId) { 24 | LOGGER.debug("The request is blocked because the Flow Id is null."); 25 | return ClusterCheckResult.BLOCK; 26 | } 27 | 28 | DynamicFlowCounter dynamicFlowCounter = DynamicFlowCounterManager.getDynamicFlowCounter(flowId); 29 | if (null == dynamicFlowCounter) { 30 | if (LOGGER.isDebugEnabled()) { 31 | LOGGER.debug("The request is fallback because the is no DynamicFlowCounter for [" + flowId + "]."); 32 | } 33 | return ClusterCheckResult.FALLBACK; 34 | } 35 | 36 | return dynamicFlowCounter.canPass(); 37 | } 38 | } -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/repository/rule/InMemSystemRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.repository.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule.SystemRuleEntity; 19 | import org.springframework.stereotype.Component; 20 | 21 | import java.util.concurrent.atomic.AtomicLong; 22 | 23 | /** 24 | * @author leyou 25 | */ 26 | @Component 27 | public class InMemSystemRuleStore extends InMemoryRuleRepositoryAdapter { 28 | 29 | private static AtomicLong ids = new AtomicLong(0); 30 | 31 | @Override 32 | protected long nextId() { 33 | return ids.incrementAndGet(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/repository/rule/InMemDegradeRuleStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.repository.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.rule.DegradeRuleEntity; 19 | import org.springframework.stereotype.Component; 20 | 21 | import java.util.concurrent.atomic.AtomicLong; 22 | 23 | /** 24 | * @author leyou 25 | */ 26 | @Component 27 | public class InMemDegradeRuleStore extends InMemoryRuleRepositoryAdapter { 28 | 29 | private static AtomicLong ids = new AtomicLong(0); 30 | 31 | @Override 32 | protected long nextId() { 33 | return ids.incrementAndGet(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/codec/data/DynamicFlowResponseDataWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.codec.data; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityWriter; 19 | import com.lifeofcoder.autolimiter.cluster.common.response.data.DynamicFlowTokenResponseData; 20 | import io.netty.buffer.ByteBuf; 21 | 22 | /** 23 | * @author xbc 24 | */ 25 | public class DynamicFlowResponseDataWriter implements EntityWriter { 26 | 27 | @Override 28 | public void writeTo(DynamicFlowTokenResponseData entity, ByteBuf out) { 29 | out.writeInt(entity.getCount()); 30 | out.writeInt(entity.getWaitInMs()); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /autolimiter-cluster-parent/autolimiter-cluster-server/src/main/java/com/lifeofcoder/autolimiter/cluster/server/codec/data/FlowResponseDataWriter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.cluster.server.codec.data; 17 | 18 | import com.lifeofcoder.autolimiter.cluster.common.codec.EntityWriter; 19 | import com.lifeofcoder.autolimiter.cluster.common.response.data.FlowTokenResponseData; 20 | import io.netty.buffer.ByteBuf; 21 | 22 | /** 23 | * @author Eric Zhao 24 | * @since 1.4.0 25 | */ 26 | public class FlowResponseDataWriter implements EntityWriter { 27 | 28 | @Override 29 | public void writeTo(FlowTokenResponseData entity, ByteBuf out) { 30 | out.writeInt(entity.getRemainingCount()); 31 | out.writeInt(entity.getWaitInMs()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/customized/rule/IgniteApiDefinitionStore.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.customized.rule; 17 | 18 | import com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.datasource.entity.gateway.ApiDefinitionEntity; 19 | import org.springframework.context.annotation.Primary; 20 | import org.springframework.stereotype.Component; 21 | 22 | /** 23 | * Store {@link ApiDefinitionEntity} in memory. 24 | * 25 | * @author cdfive 26 | * @since 1.7.0 27 | */ 28 | @Primary 29 | @Component 30 | public class IgniteApiDefinitionStore extends IgniteRuleRepositoryAdapter { 31 | @Override 32 | protected String cacheName() { 33 | return "ApiDefinitionEntity"; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /autolimiter-dashboard-cluster/src/main/java/com/lifeofcoder/autolimiter/dashboard/sentinel/dashboard/auth/AuthAction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 1999-2018 Alibaba Group Holding Ltd. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.lifeofcoder.autolimiter.dashboard.sentinel.dashboard.auth; 17 | 18 | import java.lang.annotation.*; 19 | 20 | /** 21 | * @author lkxiaolou 22 | * @since 1.7.1 23 | */ 24 | @Retention(RetentionPolicy.RUNTIME) 25 | @Documented 26 | @Target({ElementType.METHOD}) 27 | public @interface AuthAction { 28 | 29 | /** 30 | * @return the privilege type 31 | */ 32 | AuthService.PrivilegeType value(); 33 | 34 | /** 35 | * @return the target name to control 36 | */ 37 | String targetName() default "app"; 38 | 39 | /** 40 | * @return the message when permission is denied 41 | */ 42 | String message() default "Permission denied"; 43 | } 44 | --------------------------------------------------------------------------------