├── admin ├── web │ ├── .env │ ├── public │ │ ├── favicon.ico │ │ └── static │ │ │ ├── .gitkeep │ │ │ └── notice.js │ ├── src │ │ ├── assets │ │ │ ├── logo.png │ │ │ ├── open.png │ │ │ ├── robot.gif │ │ │ ├── login_bg.png │ │ │ └── login_img.png │ │ ├── utils │ │ │ ├── stepTitles.js │ │ │ ├── dictionaries.js │ │ │ ├── rem.js │ │ │ ├── wsConsts.js │ │ │ └── arrayUtils.js │ │ ├── mock │ │ │ ├── mocks.js │ │ │ ├── login.js │ │ │ └── index.js │ │ ├── plugins │ │ │ └── element.js │ │ ├── views │ │ │ ├── dashboard │ │ │ │ └── index.vue │ │ │ └── Screen.vue │ │ ├── element-variables.scss │ │ ├── router │ │ │ ├── manange.js │ │ │ └── screen.js │ │ ├── components │ │ │ └── EmptyTip.vue │ │ ├── api │ │ │ └── menu-config.js │ │ ├── entry │ │ │ ├── manage.js │ │ │ └── screen.js │ │ └── styles │ │ │ └── normalize.css │ ├── remark.txt │ ├── .gitignore │ ├── README.md │ ├── babel.config.js │ ├── postcss.config.js │ ├── tests │ │ └── unit │ │ │ └── example.spec.js │ ├── package.json │ └── jest.config.js ├── utils │ ├── constant.go │ ├── function.go │ └── directory.go ├── config │ ├── system.go │ ├── redis.go │ ├── utils.go │ └── zap.go ├── entity │ └── user.go ├── global │ └── global.go ├── core │ └── server_init.go ├── logic │ └── account │ │ ├── user.go │ │ └── guest.go ├── dao │ └── daos.go └── controller │ └── configInfo │ └── configInfo_test.go ├── docs ├── developer │ ├── concept.md │ ├── README.md │ ├── auto-registy.md │ └── log.md ├── sample │ ├── zh-cn │ │ ├── README.md │ │ └── dubbo │ │ │ ├── dubbo.md │ │ │ └── dubbo-simple-run.md │ ├── README.md │ ├── http │ │ └── http.md │ ├── others │ │ └── jaeger.md │ ├── dubbo │ │ ├── dubbo-incomplete.md │ │ ├── dubbo.md │ │ ├── http-body.md │ │ ├── dubbo-simple-run.md │ │ ├── dubbo-query(http).md │ │ ├── http-query.md │ │ └── dubbo-body(http).md │ ├── mock.md │ └── springcloud │ │ └── README.md ├── images │ ├── admin │ │ ├── 1.png │ │ ├── 2.png │ │ ├── 3.png │ │ ├── 4.png │ │ ├── 5.png │ │ ├── 6.png │ │ ├── 7.png │ │ ├── 8.png │ │ ├── 9.png │ │ ├── 10.png │ │ ├── 11.png │ │ ├── 12.png │ │ └── 13.png │ ├── invite.png │ ├── pixiu-admin.png │ ├── pixiu-logo.png │ ├── pixiu-logo-v4.png │ ├── pixiu-old-logo.png │ ├── dubbogopixiu-procedure.png │ ├── dubbgopixiu-infrastructure.png │ └── dubbogopixiu-new-infrastructure.png ├── common │ ├── README.md │ └── faq.md ├── user │ ├── README.md │ ├── metric.md │ └── start.md └── index.md ├── controllers ├── config │ └── crd │ │ └── kustomization.yaml ├── README.md ├── samples │ ├── pixiugateway.yaml │ ├── plugins │ │ ├── opa.yaml │ │ └── ratelimit.yaml │ └── observability │ │ └── prome.yaml ├── hack │ └── boilerplate.go.txt ├── internal │ ├── utils │ │ ├── error.go │ │ └── utils.go │ ├── controller │ │ └── utils_policy.go │ └── types │ │ └── k8s.go ├── cmd │ └── pgctl │ │ └── main.go └── api │ └── v1alpha1 │ └── groupversion_info.go ├── .gitmodules ├── NOTICE ├── pkg ├── config │ ├── xds │ │ └── model │ │ │ ├── proto │ │ │ ├── README.md │ │ │ ├── adapter.proto │ │ │ ├── extension.proto │ │ │ ├── listener.proto │ │ │ ├── address.proto │ │ │ ├── filter.proto │ │ │ └── route.proto │ │ │ └── model.go │ ├── version.go │ └── api_config_test.go ├── adapter │ ├── springcloud │ │ └── common │ │ │ └── common.go │ ├── llmregistry │ │ ├── common │ │ │ └── common.go │ │ └── registry │ │ │ └── listener.go │ ├── dubboregistry │ │ ├── common │ │ │ └── common.go │ │ └── registry │ │ │ └── listener.go │ └── mcpserver │ │ └── registry │ │ ├── controller.go │ │ └── factory.go ├── common │ ├── yaml │ │ └── testdata │ │ │ └── config.yml │ ├── constant │ │ ├── admin.go │ │ ├── hotreload.go │ │ ├── remote.go │ │ ├── xds.go │ │ ├── env.go │ │ ├── url.go │ │ └── filter.go │ ├── extension │ │ └── filter │ │ │ └── filter_status.go │ ├── grpc │ │ └── RoundTripper.go │ ├── shutdown │ │ ├── graceful_shutdown_signal_windows.go │ │ ├── graceful_shutdown_signal_darwin.go │ │ └── graceful_shutdown_signal_linux.go │ └── mock │ │ └── router.go ├── cmd │ ├── deployer.go │ └── sidecar.go ├── pluginregistry │ └── proxywasm_register.go ├── tracing │ ├── api.go │ ├── http.go │ ├── otlp │ │ └── otlp.go │ ├── trace_manager.go │ └── jaeger │ │ └── jaeger.go ├── model │ ├── metric.go │ ├── pprof.go │ ├── tracing.go │ ├── stream.go │ ├── adapter.go │ ├── wasm.go │ ├── remote.go │ ├── filter.go │ ├── trace.go │ └── match.go ├── filter │ ├── traffic │ │ └── models.go │ ├── http │ │ └── apiconfig │ │ │ └── config.go │ ├── host │ │ └── host_test.go │ └── sentinel │ │ ├── exact.go │ │ ├── ratelimit │ │ └── config.go │ │ └── regex.go ├── wasm │ └── key.go ├── cluster │ ├── healthcheck │ │ ├── tcp.go │ │ ├── http.go │ │ └── https.go │ ├── loadbalancer │ │ ├── rand │ │ │ └── load_balancer_rand.go │ │ └── roundrobin │ │ │ └── round_robin.go │ └── retry │ │ └── noretry │ │ └── no_retry.go ├── configcenter │ └── configclient.go ├── listener │ └── tcp │ │ └── pkg_handler.go ├── logger │ ├── log.yml │ └── output.go ├── server │ └── http.go └── client │ ├── dubbo │ └── default.go │ ├── response.go │ └── client.go ├── .gitignore ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── auto-comment.yml └── ISSUE_TEMPLATE │ └── #4_discussion_zh.yml ├── tools └── benchmark │ ├── main.go │ ├── api │ ├── generate.sh │ └── samples_api.proto │ ├── Makefile │ ├── protocol │ ├── triple │ │ └── pb │ │ │ ├── go-client │ │ │ └── conf │ │ │ │ └── dubbogo.yml │ │ │ └── go-server │ │ │ ├── conf │ │ │ └── dubbogo.yml │ │ │ └── pkg │ │ │ └── greeter.go │ └── dubbo │ │ ├── go-client │ │ └── conf │ │ │ └── dubbogo.yml │ │ └── go-server │ │ └── conf │ │ └── dubbogo.yml │ └── test │ └── test_tool.go ├── configs ├── admin_docker_config.yaml ├── log.yml └── admin_config.yaml ├── .asf.yaml └── docker-entrypoint.sh /admin/web/.env: -------------------------------------------------------------------------------- 1 | VUE_APP_BACKEND_URL=http://127.0.0.1:8081 -------------------------------------------------------------------------------- /docs/developer/concept.md: -------------------------------------------------------------------------------- 1 | # Concept 2 | 3 | ## Term 4 | 5 | The term in dubbo-go-pixiu 6 | -------------------------------------------------------------------------------- /docs/sample/zh-cn/README.md: -------------------------------------------------------------------------------- 1 | # 示例 2 | 3 | [English](../README.md) 4 | * [dubbo](dubbo.md) 5 | -------------------------------------------------------------------------------- /docs/images/admin/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/1.png -------------------------------------------------------------------------------- /docs/images/admin/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/2.png -------------------------------------------------------------------------------- /docs/images/admin/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/3.png -------------------------------------------------------------------------------- /docs/images/admin/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/4.png -------------------------------------------------------------------------------- /docs/images/admin/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/5.png -------------------------------------------------------------------------------- /docs/images/admin/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/6.png -------------------------------------------------------------------------------- /docs/images/admin/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/7.png -------------------------------------------------------------------------------- /docs/images/admin/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/8.png -------------------------------------------------------------------------------- /docs/images/admin/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/9.png -------------------------------------------------------------------------------- /docs/images/invite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/invite.png -------------------------------------------------------------------------------- /docs/images/admin/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/10.png -------------------------------------------------------------------------------- /docs/images/admin/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/11.png -------------------------------------------------------------------------------- /docs/images/admin/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/12.png -------------------------------------------------------------------------------- /docs/images/admin/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/admin/13.png -------------------------------------------------------------------------------- /admin/web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/public/favicon.ico -------------------------------------------------------------------------------- /docs/images/pixiu-admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/pixiu-admin.png -------------------------------------------------------------------------------- /docs/images/pixiu-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/pixiu-logo.png -------------------------------------------------------------------------------- /admin/web/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/src/assets/logo.png -------------------------------------------------------------------------------- /admin/web/src/assets/open.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/src/assets/open.png -------------------------------------------------------------------------------- /admin/web/src/assets/robot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/src/assets/robot.gif -------------------------------------------------------------------------------- /docs/images/pixiu-logo-v4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/pixiu-logo-v4.png -------------------------------------------------------------------------------- /docs/images/pixiu-old-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/pixiu-old-logo.png -------------------------------------------------------------------------------- /admin/web/src/assets/login_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/src/assets/login_bg.png -------------------------------------------------------------------------------- /admin/web/src/assets/login_img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/admin/web/src/assets/login_img.png -------------------------------------------------------------------------------- /docs/common/README.md: -------------------------------------------------------------------------------- 1 | # Common 2 | 3 | * [FAQ](faq.md) 4 | * [Roadmap](roadmap.md) 5 | * [Proxy arguments](pixiu-arguments.md) 6 | -------------------------------------------------------------------------------- /docs/images/dubbogopixiu-procedure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/dubbogopixiu-procedure.png -------------------------------------------------------------------------------- /docs/images/dubbgopixiu-infrastructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/dubbgopixiu-infrastructure.png -------------------------------------------------------------------------------- /docs/images/dubbogopixiu-new-infrastructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/dubbo-go-pixiu/HEAD/docs/images/dubbogopixiu-new-infrastructure.png -------------------------------------------------------------------------------- /docs/sample/README.md: -------------------------------------------------------------------------------- 1 | # Document Catalog 2 | 3 | [中文文档](./zh-cn/README.md) 4 | * [dubbo](dubbo/dubbo.md) 5 | * [http](http/http.md) 6 | * [mock](mock.md) 7 | -------------------------------------------------------------------------------- /docs/developer/README.md: -------------------------------------------------------------------------------- 1 | # Developer Guide 2 | 3 | * [Concept](concept.md) 4 | * [Auto Registry](auto-registy.md) 5 | * [Filter](filter.md) 6 | * [Log](log.md) 7 | -------------------------------------------------------------------------------- /docs/user/README.md: -------------------------------------------------------------------------------- 1 | # User Guide 2 | 3 | * [Quick Start](start.md) 4 | * [Api Model](api.md) 5 | * [Response](response.md) 6 | * [Installation](installation.md) 7 | -------------------------------------------------------------------------------- /docs/sample/http/http.md: -------------------------------------------------------------------------------- 1 | # HTTP 2 | 3 | Base on sample/http. 4 | 5 | * [http-http](http-http.md) 6 | * [http-gprc](http-grpc.md) 7 | 8 | 9 | [Previous](../README.md) 10 | -------------------------------------------------------------------------------- /admin/web/remark.txt: -------------------------------------------------------------------------------- 1 | 启动之后打开对应的页面: 2 | 登录页面:http://localhost:8080/login.html#/ 3 | 登录页面:http://localhost:8080/manage.html#/ 4 | 无人驾驶页面:http://localhost:8080/screen.html#/ 5 | 6 | vue.config.js 7 | proxy配置对应的接口地址 8 | -------------------------------------------------------------------------------- /controllers/config/crd/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - bases/pixiu.apache.org_pixiugatewaypolicies.yaml 3 | - bases/pixiu.apache.org_pixiufilterpolicies.yaml 4 | - bases/pixiu.apache.org_pixiuclusterpolicies.yaml 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/common/faq.md: -------------------------------------------------------------------------------- 1 | # FAQ 2 | 3 | If you can not get any help from this doc or [closed issues](https://github.com/apache/dubbo-go-pixiu/issues?q=is%3Aissue+is%3Aclosed), please [submit a new issue](https://github.com/apache/dubbo-go-pixiu/issues/new/choose). 4 | -------------------------------------------------------------------------------- /docs/developer/auto-registy.md: -------------------------------------------------------------------------------- 1 | # Auto Registry 2 | 3 | A feature easy for users to use dubbo-go-pixiu. 4 | 5 | ## Dubbo 6 | 7 | Find dubbo rpc interface from dubbo's register, use rules to significantly reduces the amount of manual registration. This feature is doing. 8 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule ".github/actions/actions-ding"] 2 | path = .github/actions/actions-ding 3 | url = https://github.com/zcong1993/actions-ding 4 | [submodule ".github/actions/review-dog"] 5 | path = .github/actions/review-dog 6 | url = https://github.com/reviewdog/action-golangci-lint 7 | -------------------------------------------------------------------------------- /docs/user/metric.md: -------------------------------------------------------------------------------- 1 | # Metric 2 | 3 | ## Enable 4 | 5 | You can enable the metric in config.yaml as follows. 6 | Config pixiu's ip and prometheus_port below in your prometheus config file 7 | will allow prometheus to scrape the metric generated by pixiu. 8 | 9 | ```yaml 10 | metric: 11 | enable: true 12 | prometheus_port: 2222 13 | ``` 14 | -------------------------------------------------------------------------------- /admin/web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | 25 | 26 | dist 27 | dist/ 28 | dist/* 29 | -------------------------------------------------------------------------------- /docs/sample/others/jaeger.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | #### Tracing with Jaeger 4 | 5 | 6 | There is a tracing filter, by which we can add tracing function for pixiu 7 | 8 | 9 | ```go 10 | http_filters: 11 | - name: dgp.filters.tracing 12 | config: 13 | url: http://127.0.0.1:14268/api/traces 14 | type: jaeger 15 | ``` 16 | 17 | you can quick start the demo in samples/dubbogo/simple/jaeger for experience 18 | -------------------------------------------------------------------------------- /controllers/README.md: -------------------------------------------------------------------------------- 1 | # Pixiu Gateway Controller 2 | 3 | The Pixiu Gateway manages Pixiu Proxy, whether it runs as a standalone application gateway or as an application gateway within Kubernetes. Gateway API resources are used to deploy and operate Pixiu Proxy instances under its management. 4 | 5 | ## Documentation 6 | 7 | Please refer to [Pixiu Gateway Docs](https://cn.dubbo.apache.org/zh-cn/overview/reference/pixiu/) 8 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Apache Dubbo-go-pixiu 2 | Copyright 2020-2023 The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). 6 | 7 | This product contains modified code form the gRPC Project: 8 | 9 | The gRPC Project 10 | ================= 11 | Please visit the gRPC web site for more information: 12 | * https://grpc.io/ 13 | 14 | Copyright 2014 gRPC authors. 15 | -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/README.md: -------------------------------------------------------------------------------- 1 | To generate the file run command: 2 | ```shell 3 | 4 | protoc -I=. \ 5 | --go_opt=Madapter.proto=./model \ 6 | --go_opt=Maddress.proto=./model \ 7 | --go_opt=Mbootstrap.proto=./model \ 8 | --go_opt=Mcluster.proto=./model \ 9 | --go_opt=Mextension.proto=./model \ 10 | --go_opt=Mfilter.proto=./model \ 11 | --go_opt=Mlistener.proto=./model \ 12 | --go_opt=Mroute.proto=./model \ 13 | --go_opt=Mhealth_check.proto=./model \ 14 | --go_out=../../ ./*.proto 15 | ``` -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | logs/ 2 | .idea 3 | .vscode 4 | .mvn/ 5 | 6 | # admin 7 | etcd-data/ 8 | 9 | # app 10 | dubbo-go-pixiu 11 | dubbo-go-pixiu.exe 12 | dubbgo_server.out 13 | samples/dubbogo/simple/server/app/app 14 | .scannerwork 15 | /logs 16 | /.idea 17 | /.vscode 18 | .cache 19 | .log 20 | 21 | .DS_Store 22 | vendor/ 23 | 24 | coverage.txt 25 | 26 | *.iml 27 | 28 | *.exe 29 | !samples/springcloud/zookeeper/test 30 | !samples/springcloud/nacos/test 31 | 32 | target/ 33 | samples/**/dist 34 | 35 | out/ 36 | /test -------------------------------------------------------------------------------- /docs/developer/log.md: -------------------------------------------------------------------------------- 1 | # Log 2 | 3 | How to view logs in dubbo-go-pixiu. 4 | 5 | ## DEBUG log 6 | 7 | ### Dubbo request log 8 | 9 | ```bash 10 | 2020-11-17T11:31:05.716+0800 DEBUG dubbo/dubbo.go:150 [dubbo-go-pixiu] dubbo invoke, method:GetUserByName, types:[java.lang.String], reqData:[tiecheng] 11 | ``` 12 | 13 | ### Dubbo response log 14 | 15 | ```bash 16 | 2020-11-17T11:31:05.718+0800 DEBUG dubbo/dubbo.go:160 [dubbo-go-pixiu] dubbo client resp:map[age:88 iD:3213 name:tiecheng time:] 17 | ``` 18 | 19 | -------------------------------------------------------------------------------- /docs/sample/dubbo/dubbo-incomplete.md: -------------------------------------------------------------------------------- 1 | # Dubbo incomplete 2 | 3 | ## Args will nil 4 | 5 | > fix in dubbogo 1.5.4 6 | 7 | When the response is `User`, see below code: 8 | 9 | ```go 10 | type User struct { 11 | ID string 12 | Name string 13 | Age int32 14 | Time time.Time 15 | } 16 | ``` 17 | 18 | Although User struct has Time value, generic invoke will return nil. [the simple response](dubbo-query.md#simple) time field is disappear. 19 | 20 | So I suggest you can use string to time type for a short time. 21 | 22 | [Previous](dubbo.md) 23 | -------------------------------------------------------------------------------- /docs/sample/zh-cn/dubbo/dubbo.md: -------------------------------------------------------------------------------- 1 | # Dubbo 2 | 3 | * [dubbo-query](dubbo-query.md) 4 | * [dubbo-body](dubbo-body.md) 5 | * [dubbo-uri](dubbo-uri.md) 6 | * [dubbo-mix...params from uri,query,body](dubbo-mix.md) 7 | * [dubbo-universality...dubbo proxy model](dubbo-universality.md) 8 | * [dubbo-error](../dubbo-error.md) 9 | * [dubbo-incomplete](../dubbo-incomplete.md) 10 | 11 | > 基于的例子 [samples](https://github.com/apache/dubbo-go-pixiu-samples/tree/main/dubbogo/simple) 12 | 13 | 如何运行简单的测试例子[文档](dubbo-simple-run.md) 14 | 15 | [上一页](../README.md) 16 | 17 | -------------------------------------------------------------------------------- /admin/web/README.md: -------------------------------------------------------------------------------- 1 | # my-project 2 | 3 | ## Project setup 4 | ``` 5 | yarn install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | yarn run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | yarn run build 16 | ``` 17 | 18 | ### Run your tests 19 | ``` 20 | yarn run test 21 | ``` 22 | 23 | ### Lints and fixes files 24 | ``` 25 | yarn run lint 26 | ``` 27 | 28 | ### Run your unit tests 29 | ``` 30 | yarn run test:unit 31 | ``` 32 | 33 | ### Customize configuration 34 | See [Configuration Reference](https://cli.vuejs.org/config/). 35 | -------------------------------------------------------------------------------- /controllers/samples/pixiugateway.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: gateway.networking.k8s.io/v1 2 | kind: GatewayClass 3 | metadata: 4 | name: pg 5 | spec: 6 | controllerName: pixiu.apache.org/pixiu-gateway-controller 7 | --- 8 | apiVersion: gateway.networking.k8s.io/v1 9 | kind: Gateway 10 | metadata: 11 | name: pixiu-listeners 12 | namespace: pixiu-gateway-system 13 | spec: 14 | gatewayClassName: pg 15 | listeners: 16 | - name: http 17 | protocol: HTTP 18 | port: 8888 19 | - name: dubbo 20 | protocol: TCP 21 | port: 8889 22 | - name: triple 23 | protocol: GRPC 24 | port: 9999 25 | - name: http2 26 | protocol: HTTP2 27 | port: 8881 28 | -------------------------------------------------------------------------------- /controllers/samples/plugins/opa.yaml: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | apiVersion: gateway.networking.k8s.io/v1 4 | kind: HTTPRoute 5 | metadata: 6 | name: backend 7 | namespace: default 8 | spec: 9 | parentRefs: 10 | - name: pg 11 | namespace: pixiu-gateway-system 12 | hostnames: 13 | - "www.example.com" 14 | rules: 15 | - backendRefs: 16 | - group: "" 17 | kind: Service 18 | name: backend 19 | port: 3000 20 | weight: 1 21 | matches: 22 | - path: 23 | type: PathPrefix 24 | value: / 25 | filters: 26 | - type: ExtensionRef 27 | extensionRef: 28 | group: pixiu.apache.org 29 | kind: PixiuFilterPolicy 30 | name: opa-plugin-policy -------------------------------------------------------------------------------- /docs/sample/mock.md: -------------------------------------------------------------------------------- 1 | # Mock request 2 | 3 | ## Simple Demo 4 | 5 | ### Api Config 6 | 7 | ```yaml 8 | name: pixiu 9 | description: pixiu sample 10 | resources: 11 | - path: '/api/v1/test-dubbo/mock' 12 | type: restful 13 | description: mock 14 | methods: 15 | - httpVerb: GET 16 | enable: true 17 | mock: true 18 | timeout: 1000ms 19 | inboundRequest: 20 | requestType: http 21 | ``` 22 | 23 | ### Request 24 | 25 | ```bash 26 | curl localhost:8888/api/v1/test-dubbo/mock -X GET 27 | ``` 28 | 29 | ### Response 30 | 31 | ```json 32 | { 33 | "message": "mock success" 34 | } 35 | ``` 36 | 37 | ## TODO 38 | 39 | We plan use can config custom result in the future. Not only api config way, but also create a match rule. 40 | 41 | [Previous](README.md) 42 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | # dubbo-go-pixiu Documentation 2 | 3 | ## [User Guide](user/README.md) 4 | 5 | * [Quick Start](user/start.md) 6 | * [Config](user/config.md) 7 | * [Metric](user/metric.md) 8 | 9 | ## [Samples](sample/README.md) 10 | 11 | * [dubbo](sample/dubbo/dubbo.md) 12 | * [http](sample/http/http.md) 13 | * [mock](sample/mock.md) 14 | * [plugins](../samples/plugins/index.md) 15 | * [Tracing](sample/others/jaeger.md) 16 | * [springcloud](sample/springcloud/README.md) 17 | 18 | ## [Developer Guide](developer/README.md) 19 | 20 | * [Concept](developer/concept.md) 21 | * [Auto Registry](developer/auto-registy.md) 22 | * [Filter](developer/filter.md) 23 | * [Log](developer/log.md) 24 | 25 | ## [AI Gateway](ai/README.md) 26 | * [MCP](ai/mcp/mcp.md) 27 | 28 | ## [Common](common/README.md) 29 | 30 | * [FAQ](common/faq.md) 31 | -------------------------------------------------------------------------------- /docs/sample/dubbo/dubbo.md: -------------------------------------------------------------------------------- 1 | # Dubbo Catalog 2 | 3 | ### http to dubbo-protocol-base dubbo request 4 | 5 | * [dubbo-query](dubbo-query.md) 6 | * [dubbo-body](dubbo-body.md) 7 | * [dubbo-uri](dubbo-uri.md) 8 | * [dubbo-mix...params from uri,query,body](dubbo-mix.md) 9 | * [dubbo-universality...dubbo proxy model](dubbo-universality.md) 10 | * [dubbo-error](dubbo-error.md) 11 | * [dubbo-incomplete](dubbo-incomplete.md) 12 | * [dubbo-registry](dubbo-registry.md) 13 | 14 | ### http to http-protocl-base dubbo request 15 | 16 | * [http-body](http-body.md) 17 | * [http-query](http-query.md) 18 | * [http-uri](http-uri.md) 19 | 20 | > Based on [samples](https://github.com/apache/dubbo-go-pixiu-samples/tree/main/dubbogo/simple) 21 | 22 | How do I run a simple test example [document](dubbo-simple-run.md) 23 | 24 | [Previous](../README.md) 25 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 3 | 4 | **What this PR does**: 5 | 6 | **Which issue(s) this PR fixes**: 7 | 12 | Fixes # 13 | 14 | **Special notes for your reviewer**: 15 | 16 | **Does this PR introduce a user-facing change?**: 17 | 22 | ```release-note 23 | 24 | ``` -------------------------------------------------------------------------------- /docs/sample/springcloud/README.md: -------------------------------------------------------------------------------- 1 | # Quick Start 2 | 3 | Start Nacos [Docker environment]: 4 | 5 | ```bash 6 | cd samples/springcloud/docker 7 | run docker-compose.yml/services 8 | ``` 9 | 10 | Start SpringCloud [Java environment]: 11 | 12 | ```bash 13 | cd samples/springcloud/server 14 | 15 | # the port is 8074 16 | run auth-service 17 | 18 | # the port is 8071 19 | run user-service 20 | ``` 21 | 22 | Start Pixiu: 23 | 24 | ```bash 25 | go run cmd/pixiu/*.go gateway start -c samples/springcloud/pixiu/conf.yaml 26 | ``` 27 | 28 | Call the server of SpringCloud by Pixiu : 29 | 30 | ```bash 31 | # the serviceId is `user-provider` 32 | curl http://localhost:8888/user-service/echo/Pixiu 33 | 34 | # the serviceId is `auth-provider` 35 | curl http://localhost:8888/auth-service/echo/Pixiu 36 | ``` 37 | result on console : 38 | ```log 39 | Hello Nacos Discovery Pixiu 40 | ``` 41 | -------------------------------------------------------------------------------- /admin/web/public/static/.gitkeep: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ -------------------------------------------------------------------------------- /controllers/hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | -------------------------------------------------------------------------------- /admin/web/src/utils/stepTitles.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export const stepTitles = { 18 | 19 | } 20 | -------------------------------------------------------------------------------- /tools/benchmark/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package benchmark 19 | 20 | func main() { 21 | 22 | } 23 | -------------------------------------------------------------------------------- /admin/web/babel.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | module.exports = { 18 | presets: [ 19 | '@vue/app' 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /admin/web/src/mock/mocks.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var login = require('./login'); 18 | module.exports = [ 19 | login 20 | ] -------------------------------------------------------------------------------- /admin/web/postcss.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | module.exports = { 18 | plugins: { 19 | autoprefixer: {} 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /pkg/adapter/springcloud/common/common.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package common 19 | 20 | const ( 21 | ZKLogDiscovery = "[ZKDiscover]" 22 | ) 23 | -------------------------------------------------------------------------------- /admin/utils/constant.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package utils 19 | 20 | const ( 21 | ConfigEnv = "GVA_CONFIG" 22 | ConfigFile = "config.yaml" 23 | ) 24 | -------------------------------------------------------------------------------- /pkg/common/yaml/testdata/config.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | intTest: 11 20 | booleanTest: false 21 | strTest: "strTest" 22 | 23 | child: 24 | strTest: "childStrTest" -------------------------------------------------------------------------------- /admin/web/public/static/notice.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export const notice = { 18 | text: '', 19 | scrollamount: '8', 20 | direction: 'left', 21 | show: true 22 | } -------------------------------------------------------------------------------- /pkg/common/constant/admin.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package constant 19 | 20 | const ( 21 | ConfigEnv = "GVA_CONFIG" 22 | ConfigFile = "config.yaml" 23 | ) 24 | -------------------------------------------------------------------------------- /pkg/config/version.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config 19 | 20 | const ( 21 | // Version TODO: delete this if not used in the future 22 | Version = "0.4.0" 23 | ) 24 | -------------------------------------------------------------------------------- /admin/web/src/plugins/element.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import Vue from 'vue' 18 | import Element from 'element-ui' 19 | import '../element-variables.scss' 20 | 21 | Vue.use(Element) 22 | -------------------------------------------------------------------------------- /pkg/cmd/deployer.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package cmd 19 | 20 | type Deployer interface { 21 | initialize() error 22 | 23 | start() error 24 | 25 | stop() error 26 | } 27 | -------------------------------------------------------------------------------- /pkg/common/constant/hotreload.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package constant 19 | 20 | import ( 21 | "time" 22 | ) 23 | 24 | const ( 25 | CheckConfigInterval = 1 * time.Second 26 | ) 27 | -------------------------------------------------------------------------------- /pkg/common/extension/filter/filter_status.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package filter 19 | 20 | type FilterStatus int 21 | 22 | const ( 23 | Continue FilterStatus = iota 24 | Stop 25 | ) 26 | -------------------------------------------------------------------------------- /pkg/pluginregistry/proxywasm_register.go: -------------------------------------------------------------------------------- 1 | //go:build wasm 2 | 3 | /* 4 | * Licensed to the Apache Software Foundation (ASF) under one or more 5 | * contributor license agreements. See the NOTICE file distributed with 6 | * this work for additional information regarding copyright ownership. 7 | * The ASF licenses this file to You under the Apache License, Version 2.0 8 | * (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package pluginregistry 21 | 22 | import ( 23 | _ "github.com/apache/dubbo-go-pixiu/pkg/filter/http/proxywasm" 24 | ) 25 | -------------------------------------------------------------------------------- /pkg/common/constant/remote.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package constant 19 | 20 | // env key 21 | const ( 22 | Zookeeper string = "zookeeper" 23 | Nacos string = "nacos" 24 | Consul string = "consul" 25 | ) 26 | -------------------------------------------------------------------------------- /controllers/internal/utils/error.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package utils 19 | 20 | type ReasonError struct { 21 | Reason string 22 | Message string 23 | } 24 | 25 | func (e ReasonError) Error() string { 26 | return e.Message 27 | } 28 | -------------------------------------------------------------------------------- /docs/sample/zh-cn/dubbo/dubbo-simple-run.md: -------------------------------------------------------------------------------- 1 | # 如何运行 dubbo 简单的测试例子 2 | 3 | ## 启动 Pixiu 4 | 5 | - 打开 samples 路径 6 | 7 | ```bash 8 | cd /dubbo-go-pixiu/samples/dubbogo/simple 9 | ``` 10 | 11 | - 使用 start.sh 启动案例 12 | 13 | 使用 start.sh help 来获取帮助信息 14 | 15 | ``` 16 | ./start.sh help 17 | 18 | dubbo-go-pixiu start helper 19 | ./start.sh action project 20 | hint: 21 | ./start.sh prepare body for prepare config file and up docker in body project 22 | ./start.sh startPixiu body for start dubbo or http server in body project 23 | ./start.sh startServer body for start pixiu in body project 24 | ./start.sh startTest body for start unit test in body project 25 | ./start.sh clean body for clean 26 | 27 | ``` 28 | 29 | 使用 `./start.sh [action] [project]` 来启动案例,比如说: 30 | 31 | ```bash 32 | ./start.sh prepare body 33 | ./start.sh startPixiu body 34 | ./start.sh startServer body 35 | ./start.sh startTest body 36 | ./start.sh clean body 37 | ``` 38 | 39 | - 接口访问 40 | 41 | 先到指定测试例子的路径下,比如 `/samples/dubbogo/simple/body` 42 | 43 | 执行命令: 44 | 45 | ```bash 46 | ./request.sh 47 | ``` 48 | 49 | -------------------------------------------------------------------------------- /tools/benchmark/api/generate.sh: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | export GO111MODULE="on" 21 | export GOPROXY="http://goproxy.io" 22 | go install github.com/dubbogo/tools/cmd/protoc-gen-go-triple@latest 23 | protoc --go_out=. --go-triple_out=. samples_api.proto -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/adapter.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | package pixiu.api.v1; 20 | 21 | // Adapter the adapter plugin for manage cluster or router 22 | message Adapter { 23 | string id = 1; 24 | string name = 2; 25 | } -------------------------------------------------------------------------------- /pkg/tracing/api.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package tracing 19 | 20 | import ( 21 | "go.opentelemetry.io/otel/trace" 22 | ) 23 | 24 | // Trace interface need to be implemented to construct your Tracer. 25 | type Trace interface { 26 | trace.Tracer 27 | } 28 | -------------------------------------------------------------------------------- /admin/web/src/mock/login.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | module.exports = { 18 | key:'login', 19 | method:'post', 20 | data:{ 21 | return_code:'0', 22 | retData:{ 23 | data:'222', 24 | token:'3333' 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /pkg/model/metric.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // Metirc config for otel metric. 21 | type Metric struct { 22 | Enable bool `yaml:"enable" json:"enable"` 23 | PrometheusPort int `yaml:"prometheus_port" json:"prometheus_port"` 24 | } 25 | -------------------------------------------------------------------------------- /pkg/model/pprof.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | type PprofConf struct { 21 | Enable bool `yaml:"enable" json:"enable" mapstructure:"enable" default:"false"` 22 | Address Address `yaml:"address" json:"address" mapstructure:"address"` 23 | } 24 | -------------------------------------------------------------------------------- /admin/config/system.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config 19 | 20 | type System struct { 21 | Env string `mapstructure:"env" json:"env" yaml:"env"` 22 | Addr int `mapstructure:"addr" json:"addr" yaml:"addr"` 23 | DbType string `mapstructure:"db-type" json:"dbType" yaml:"db-type"` 24 | } 25 | -------------------------------------------------------------------------------- /docs/sample/dubbo/http-body.md: -------------------------------------------------------------------------------- 1 | # Get the parameter from the body 2 | 3 | > POST request 4 | 5 | ## Passthroughs 6 | 7 | ### Api Config 8 | 9 | ```yaml 10 | name: pixiu 11 | description: pixiu sample 12 | resources: 13 | - path: '/api/v1/test-http/user' 14 | type: restful 15 | description: user 16 | methods: 17 | - httpVerb: POST 18 | enable: true 19 | timeout: 10s 20 | inboundRequest: 21 | requestType: http 22 | integrationRequest: 23 | requestType: http 24 | host: "127.0.0.1:1314" 25 | path: "/user/" 26 | ``` 27 | 28 | ### Request 29 | 30 | ```bash 31 | curl host:port/api/v1/test-http/user -X POST -d '{"name": "tiecheng1","code": 4,"age": 18}' --header "Content-Type: application/json" 32 | ``` 33 | 34 | ### Response 35 | 36 | - If first add, return like: 37 | 38 | ```json 39 | { 40 | "id": "XVlBz", 41 | "name": "tiecheng1", 42 | "age": 18, 43 | "time": "0001-01-01T00:00:00Z" 44 | } 45 | ``` 46 | 47 | - If you add user multi, return like: 48 | 49 | ```json 50 | { 51 | "message": "data is exist" 52 | } 53 | ``` 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /admin/config/redis.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config 19 | 20 | type Redis struct { 21 | DB int `mapstructure:"db" json:"db" yaml:"db"` 22 | Addr string `mapstructure:"addr" json:"addr" yaml:"addr"` 23 | Password string `mapstructure:"password" json:"password" yaml:"password"` 24 | } 25 | -------------------------------------------------------------------------------- /admin/entity/user.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package entity 19 | 20 | type UserInfo struct { 21 | Id int `json:"id"` 22 | Username string `json:"username"` 23 | Role string `json:"role"` 24 | //Enable bool `json:"enable"` 25 | //Createdate time.Time 26 | //Updatedate time.Time 27 | } 28 | -------------------------------------------------------------------------------- /admin/utils/function.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package utils 19 | 20 | import ( 21 | "crypto/md5" 22 | "encoding/hex" 23 | ) 24 | 25 | // Md5 md5 encryption 26 | func Md5(encodeString string) string { 27 | h := md5.New() 28 | h.Write([]byte(encodeString)) 29 | return hex.EncodeToString(h.Sum(nil)) 30 | } 31 | -------------------------------------------------------------------------------- /pkg/tracing/http.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package tracing 19 | 20 | import ( 21 | "go.opentelemetry.io/otel/trace" 22 | ) 23 | 24 | // Wrap the tracer provided by otel and be asked to implement the Trace interface 25 | // to customize the Span implementation. 26 | type Tracer struct { 27 | Trace trace.Tracer 28 | } 29 | -------------------------------------------------------------------------------- /admin/web/src/utils/dictionaries.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | const plateColorToColorMap = new Map([ 18 | ['0', "蓝色"], 19 | ['1', "黄色"], 20 | ['2', "黑色"], 21 | ['3', "白色"], 22 | ['4', "渐变绿色"], 23 | ['5', "黄绿双拼色"], 24 | ['6', "蓝白渐变色"], 25 | ['7', "临时牌照"], 26 | ['8', "未确定"], 27 | ]) 28 | export { 29 | plateColorToColorMap 30 | } -------------------------------------------------------------------------------- /admin/web/src/utils/rem.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | const rem=(res)=>{ 18 | let clientWidth = window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth; 19 | if (!clientWidth) return; 20 | let fontSize = 10 * (clientWidth / 1080); 21 | return res*fontSize; 22 | } 23 | 24 | export default rem 25 | -------------------------------------------------------------------------------- /admin/web/src/utils/wsConsts.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /* jshint esversion:9 */ 18 | /**websocket请求常量定义 */ 19 | const wsConsts = { 20 | 21 | /**心跳间隔 */ 22 | hbInterval: 10000, 23 | /**websocket接口映射列表 */ 24 | methods: { 25 | 26 | }, 27 | /**到期时间 */ 28 | expireTime: 3600000 29 | } 30 | export default wsConsts -------------------------------------------------------------------------------- /controllers/cmd/pgctl/main.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package main 19 | 20 | import ( 21 | "controllers/cmd" 22 | ) 23 | 24 | func main() { 25 | rootCmd := cmd.GetRootCmd() 26 | if err := rootCmd.Execute(); err != nil { 27 | getExitCode(err) 28 | } 29 | } 30 | 31 | func getExitCode(e error) string { 32 | return e.Error() 33 | } 34 | -------------------------------------------------------------------------------- /admin/web/src/views/dashboard/index.vue: -------------------------------------------------------------------------------- 1 | 17 | 20 | 21 | 22 | 34 | 35 | 36 | 39 | -------------------------------------------------------------------------------- /tools/benchmark/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | clone: 21 | git clone https://github.com/apache/dubbo-go-pixiu.git source 22 | 23 | build: 24 | @export GO111MODULE=on 25 | @cd source && go mod vendor && \ 26 | if [ ! -d "../dist" ]; then mkdir ../dist; fi && \ 27 | go build -o ../dist/pixiu cmd/pixiu/*.go 28 | 29 | prepare: clone build 30 | -------------------------------------------------------------------------------- /pkg/adapter/llmregistry/common/common.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package common 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/model" 22 | ) 23 | 24 | type RegistryEventListener interface { 25 | OnAddEndpoint(r *model.Endpoint) error 26 | OnRemoveEndpoint(r *model.Endpoint) error 27 | //OnDeleteRouter(r config.Resource) error 28 | } 29 | -------------------------------------------------------------------------------- /docs/sample/dubbo/dubbo-simple-run.md: -------------------------------------------------------------------------------- 1 | # How run dubbo simple test samples 2 | 3 | ## Start Pixiu 4 | 5 | - cd sample dir 6 | 7 | ```bash 8 | cd /dubbo-go-pixiu/samples/dubbogo/simple 9 | ``` 10 | 11 | - use start.sh to start pixiu and server quickly 12 | 13 | start.sh help for help info 14 | 15 | ``` 16 | ./start.sh help 17 | 18 | dubbo-go-pixiu start helper 19 | ./start.sh action project 20 | hint: 21 | ./start.sh prepare body for prepare config file and up docker in body project 22 | ./start.sh startPixiu body for start dubbo or http server in body project 23 | ./start.sh startServer body for start pixiu in body project 24 | ./start.sh startTest body for start unit test in body project 25 | ./start.sh clean body for clean 26 | 27 | ``` 28 | 29 | Use `./start.sh [action] [project]` to start sample,for exmaple: 30 | 31 | ```bash 32 | ./start.sh prepare body 33 | ./start.sh startPixiu body 34 | ./start.sh startServer body 35 | ./start.sh startTest body 36 | ./start.sh clean body 37 | ``` 38 | 39 | - interface access 40 | 41 | Go to the path of the specified test example,such as `/samples/dubbogo/simple/body` 42 | 43 | Executive Command: 44 | 45 | ```bash 46 | ./request.sh 47 | ``` 48 | 49 | -------------------------------------------------------------------------------- /pkg/filter/traffic/models.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package traffic 19 | 20 | import ( 21 | "net/http" 22 | ) 23 | 24 | func spiltHeader(req *http.Request, value string) bool { 25 | return req.Header.Get(string(canaryByHeader)) == value 26 | } 27 | 28 | func spiltWeight(weight, floor, ceil int) bool { 29 | return weight > floor && weight <= ceil 30 | } 31 | -------------------------------------------------------------------------------- /pkg/wasm/key.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package wasm 19 | 20 | const ( 21 | LogLevel = "wasm.log" 22 | HeaderLevel = "wasm.header" 23 | ) 24 | 25 | var keys = []string{LogLevel, HeaderLevel} 26 | 27 | func contains(key string) bool { 28 | for i := range keys { 29 | if key == keys[i] { 30 | return true 31 | } 32 | } 33 | return false 34 | } 35 | -------------------------------------------------------------------------------- /pkg/cluster/healthcheck/tcp.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package healthcheck 19 | 20 | import ( 21 | "time" 22 | ) 23 | 24 | type TCPChecker struct { 25 | address string 26 | timeout time.Duration 27 | } 28 | 29 | func (s *TCPChecker) CheckHealth() bool { 30 | return CheckTcpConn(s.address, "", s.timeout) 31 | } 32 | 33 | func (s *TCPChecker) OnTimeout() {} 34 | -------------------------------------------------------------------------------- /admin/global/global.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package global 19 | 20 | import ( 21 | "github.com/spf13/viper" 22 | 23 | "go.uber.org/zap" 24 | 25 | "gorm.io/gorm" 26 | ) 27 | 28 | import ( 29 | "github.com/apache/dubbo-go-pixiu/admin/config" 30 | ) 31 | 32 | var ( 33 | VP *viper.Viper 34 | DB *gorm.DB 35 | CONFIG config.Server 36 | LOG *zap.Logger 37 | ) 38 | -------------------------------------------------------------------------------- /pkg/common/grpc/RoundTripper.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package grpc 19 | 20 | import ( 21 | "net/http" 22 | ) 23 | 24 | import ( 25 | "golang.org/x/net/http2" 26 | ) 27 | 28 | type HttpForwarder struct { 29 | transport *http2.Transport 30 | } 31 | 32 | func (hf *HttpForwarder) Forward(r *http.Request) (*http.Response, error) { 33 | return hf.transport.RoundTrip(r) 34 | } 35 | -------------------------------------------------------------------------------- /tools/benchmark/protocol/triple/pb/go-client/conf/dubbogo.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | dubbo: 21 | registries: 22 | zk: 23 | address: zookeeper://127.0.0.1:2181 24 | consumer: 25 | references: 26 | GreeterClientImpl: 27 | protocol: tri 28 | interface: org.apache.dubbogo.samples.api.Greeter 29 | logger: 30 | zap-config: 31 | level: panic -------------------------------------------------------------------------------- /pkg/adapter/dubboregistry/common/common.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package common 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/config" 22 | "github.com/apache/dubbo-go-pixiu/pkg/router" 23 | ) 24 | 25 | type RegistryEventListener interface { 26 | OnAddAPI(r router.API) error 27 | OnRemoveAPI(r router.API) error 28 | OnDeleteRouter(r config.Resource) error 29 | } 30 | -------------------------------------------------------------------------------- /pkg/adapter/dubboregistry/registry/listener.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package registry 19 | 20 | // Listener this interface defined for load services from different kinds registry, such as nacos,consul,zookeeper. 21 | type Listener interface { 22 | // Close closes this listener 23 | Close() 24 | // WatchAndHandle watch the target path and handle the event 25 | WatchAndHandle() 26 | } 27 | -------------------------------------------------------------------------------- /pkg/adapter/llmregistry/registry/listener.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package registry 19 | 20 | // Listener this interface defined for load services from different kinds registry, such as nacos,consul,zookeeper. 21 | type Listener interface { 22 | // Close closes this listener 23 | Close() 24 | // WatchAndHandle watch the target path and handle the event 25 | WatchAndHandle() 26 | } 27 | -------------------------------------------------------------------------------- /pkg/cluster/healthcheck/http.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package healthcheck 19 | 20 | import ( 21 | "time" 22 | ) 23 | 24 | type HTTPChecker struct { 25 | address string 26 | timeout time.Duration 27 | } 28 | 29 | func (s *HTTPChecker) CheckHealth() bool { 30 | tarAddr := s.address 31 | return CheckTcpConn(tarAddr, "80", s.timeout) 32 | } 33 | 34 | func (s *HTTPChecker) OnTimeout() {} 35 | -------------------------------------------------------------------------------- /pkg/model/tracing.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // Tracing 21 | type Tracing struct { 22 | Http Http `yaml:"http" json:"http,omitempty"` 23 | URL string `yaml:"url" json:"url,omitempty"` 24 | Type string `yaml:"type" json:"type,omitempty"` 25 | } 26 | 27 | // Tracing 28 | type Http struct { 29 | Name string `yaml:"name"` 30 | Config any `yaml:"config"` 31 | } 32 | -------------------------------------------------------------------------------- /pkg/cluster/healthcheck/https.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package healthcheck 19 | 20 | import ( 21 | "time" 22 | ) 23 | 24 | type HTTPSChecker struct { 25 | address string 26 | timeout time.Duration 27 | } 28 | 29 | func (s *HTTPSChecker) CheckHealth() bool { 30 | tarAddr := s.address 31 | return CheckTcpConn(tarAddr, "443", s.timeout) 32 | 33 | } 34 | 35 | func (s *HTTPSChecker) OnTimeout() {} 36 | -------------------------------------------------------------------------------- /docs/sample/dubbo/dubbo-query(http).md: -------------------------------------------------------------------------------- 1 | # Get the parameter from the query 2 | 3 | > GET request 4 | 5 | ## Simple Demo 6 | 7 | ### Api Config 8 | 9 | ```yaml 10 | name: pixiu 11 | description: pixiu sample 12 | resources: 13 | - path: '/api/v1/test-dubbo/user' 14 | type: restful 15 | description: user 16 | methods: 17 | - httpVerb: GET 18 | enable: true 19 | timeout: 1000ms 20 | inboundRequest: 21 | requestType: http 22 | queryStrings: 23 | - name: name 24 | required: true 25 | integrationRequest: 26 | requestType: http 27 | host: 127.0.0.1:8889 28 | path: /UserProvider/GetUserByName 29 | mappingParams: 30 | - name: queryStrings.name 31 | mapTo: queryStrings.name 32 | group: "test" 33 | version: 1.0.0 34 | ``` 35 | 36 | ### Request 37 | 38 | ```bash 39 | curl http://localhost:8888/api/v1/test-dubbo/user?name=tc -X GET 40 | ``` 41 | 42 | ### Response 43 | 44 | - Successful result will return: 45 | 46 | ```bash 47 | { 48 | "id": "0001", 49 | "code": 1, 50 | "name": "tc", 51 | "age": 18, 52 | "time": "2020-12-24T16:46:31.8409857+08:00" 53 | } 54 | ``` 55 | -------------------------------------------------------------------------------- /configs/admin_docker_config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to Apache Software Foundation (ASF) under one or more contributor 3 | # license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright 5 | # ownership. Apache Software Foundation (ASF) licenses this file to you under 6 | # the Apache License, Version 2.0 (the "License"); you may 7 | # not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | server: 21 | address: 127.0.0.1:8081 22 | etcd: 23 | address: pixiu_admin_etcd:2379 24 | path: /pixiu/config/api 25 | mysql: 26 | username: root 27 | password: root_password 28 | host: mysql_pixiu 29 | port: 3306 30 | dbname: pixiu 31 | # system configuration 32 | system: 33 | env: 'public' 34 | addr: 8081 35 | db-type: 'mysql' 36 | -------------------------------------------------------------------------------- /.github/auto-comment.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | # Comment to a new issue. 20 | issueOpened: > 21 | Thank your for raising a issue. We will try and get back to you as soon as possible. 22 | Please make sure you have given us as much context as possible. 23 | pullRequestOpened: > 24 | Thank your for raising your pull request. 25 | Please make sure you have followed our contributing guidelines. We will review it as soon as possible 26 | -------------------------------------------------------------------------------- /admin/web/src/element-variables.scss: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | /* 18 | Write your variables here. All available variables can be 19 | found in element-ui/packages/theme-chalk/src/common/var.scss. 20 | For example, to overwrite the theme color: 21 | */ 22 | $--color-primary: #01C1B2; 23 | 24 | /* icon font path, required */ 25 | $--font-path: '~element-ui/lib/theme-chalk/fonts'; 26 | 27 | @import "~element-ui/packages/theme-chalk/src/index"; 28 | -------------------------------------------------------------------------------- /tools/benchmark/protocol/dubbo/go-client/conf/dubbogo.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | # dubbo client yaml configure file 21 | 22 | dubbo: 23 | registries: 24 | demoZK: 25 | protocol: zookeeper 26 | address: 127.0.0.1:2181 27 | consumer: 28 | references: 29 | UserProvider: 30 | protocol: dubbo 31 | interface: org.apache.dubbo.sample.UserProvider 32 | logger: 33 | zap-config: 34 | level: panic -------------------------------------------------------------------------------- /admin/web/tests/unit/example.spec.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import { shallowMount } from '@vue/test-utils' 18 | import HelloWorld from '@/components/HelloWorld.vue' 19 | 20 | describe('HelloWorld.vue', () => { 21 | it('renders props.msg when passed', () => { 22 | const msg = 'new message' 23 | const wrapper = shallowMount(HelloWorld, { 24 | propsData: { msg } 25 | }) 26 | expect(wrapper.text()).toMatch(msg) 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /pkg/configcenter/configclient.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package configcenter 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/model" 22 | ) 23 | 24 | type ( 25 | ConfigClient interface { 26 | LoadConfig(properties map[string]any) (string, error) 27 | 28 | ListenConfig(properties map[string]any) (err error) 29 | 30 | // ViewConfig returns the current remote configuration. 31 | ViewConfig() *model.Bootstrap 32 | } 33 | ) 34 | -------------------------------------------------------------------------------- /docs/sample/dubbo/http-query.md: -------------------------------------------------------------------------------- 1 | # Get the parameter from the query 2 | 3 | > GET request 4 | 5 | ## Simple Demo 6 | 7 | ### Api Config 8 | 9 | ```yaml 10 | name: pixiu 11 | description: pixiu sample 12 | resources: 13 | - path: '/api/v1/test-http/user' 14 | type: restful 15 | description: user 16 | methods: 17 | - httpVerb: GET 18 | enable: true 19 | timeout: 1000ms 20 | inboundRequest: 21 | requestType: http 22 | queryStrings: 23 | - name: name 24 | required: true 25 | integrationRequest: 26 | requestType: http 27 | host: "127.0.0.1:1314" 28 | path: "/user" 29 | - httpVerb: POST 30 | enable: true 31 | timeout: 10s 32 | inboundRequest: 33 | requestType: http 34 | integrationRequest: 35 | requestType: http 36 | host: "127.0.0.1:1314" 37 | path: "/user/" 38 | ``` 39 | 40 | ### Request 41 | 42 | ```bash 43 | curl http://localhost:8888/api/v1/test-http/user?name=tc -X GET 44 | ``` 45 | 46 | ### Response 47 | 48 | - Successful result will return: 49 | 50 | ```bash 51 | { 52 | "id": "0001", 53 | "name": "tc", 54 | "age": 18, 55 | "time": "2020-12-30T14:07:07.9432117+08:00" 56 | } 57 | ``` 58 | -------------------------------------------------------------------------------- /pkg/model/stream.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | import ( 21 | "context" 22 | ) 23 | 24 | // RPCStream represents a gRPC stream 25 | type RPCStream interface { 26 | Context() context.Context 27 | SendMsg(m any) error 28 | RecvMsg(m any) error 29 | } 30 | 31 | // RPCStreamInfo contains information about the RPC stream 32 | type RPCStreamInfo struct { 33 | FullMethod string 34 | IsClientStream bool 35 | IsServerStream bool 36 | } 37 | -------------------------------------------------------------------------------- /admin/core/server_init.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package core 19 | 20 | import ( 21 | "net/http" 22 | "time" 23 | ) 24 | 25 | import ( 26 | "github.com/gin-gonic/gin" 27 | ) 28 | 29 | func initServer(address string, router *gin.Engine) server { 30 | return &http.Server{ 31 | Addr: address, 32 | Handler: router, 33 | ReadTimeout: 10 * time.Second, 34 | WriteTimeout: 10 * time.Second, 35 | MaxHeaderBytes: 1 << 20, 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /admin/web/src/utils/arrayUtils.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export function ignoreNull(obj) { 18 | let _newPar = {}; 19 | for (let key in obj) { 20 | //如果对象属性的值不为空,就保存该属性(这里我做了限制,如果属性的值为0,保存该属性。如果属性的值全部是空格,属于为空。) 21 | if ((obj[key] === 0 || obj[key]) && obj[key].toString().replace(/(^\s*)|(\s*$)/g, '') !== '') { // NOSONAR 22 | //记录属性 23 | _newPar[key] = obj[key]; 24 | } 25 | } 26 | //返回对象 27 | return _newPar; 28 | } -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/extension.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | package pixiu.api.v1; 20 | 21 | import "cluster.proto"; 22 | import "listener.proto"; 23 | 24 | // Message map to dubbo-go.pixiu//v1/discovery:cluster 25 | message PixiuExtensionClusters { 26 | repeated Cluster clusters = 1; 27 | } 28 | 29 | // Message map to dubbo-go.pixiu//v1/discovery:listener 30 | message PixiuExtensionListeners { 31 | repeated Listener listeners = 1; 32 | } 33 | -------------------------------------------------------------------------------- /pkg/config/xds/model/model.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | package model 19 | 20 | //run to generate new model from ./proto/*.proto 21 | //go:generate protoc -I=. --go_opt=Madapter.proto=./model --go_opt=Maddress.proto=./model --go_opt=Mbootstrap.proto=./model --go_opt=Mcluster.proto=./model --go_opt=Mextension.proto=./model --go_opt=Mfilter.proto=./model --go_opt=Mlistener.proto=./model --go_opt=Mroute.proto=./model --go_opt=Mhealth_check.proto=./model --go_out=../../ ./*.proto 22 | -------------------------------------------------------------------------------- /pkg/model/adapter.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // Adapter the adapter plugin for manage cluster or router 21 | type Adapter struct { 22 | ID string `yaml:"id" json:"id"` 23 | Name string `yaml:"name" json:"name"` // Name the adapter unique name 24 | Enabled string `yaml:"enabled" json:"enabled" default:"true"` 25 | Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` // Config adapter config 26 | } 27 | -------------------------------------------------------------------------------- /docs/sample/dubbo/dubbo-body(http).md: -------------------------------------------------------------------------------- 1 | # Get the parameter from the body 2 | 3 | > POST request 4 | 5 | ## Passthroughs 6 | 7 | ### Api Config 8 | 9 | ```yaml 10 | name: pixiu 11 | description: pixiu sample 12 | resources: 13 | - path: '/api/v1/test-dubbo/user' 14 | type: restful 15 | description: user 16 | methods: 17 | - httpVerb: POST 18 | enable: true 19 | timeout: 1000ms 20 | inboundRequest: 21 | requestType: http 22 | queryStrings: 23 | - name: name 24 | required: true 25 | integrationRequest: 26 | requestType: http 27 | host: 127.0.0.1:8889 28 | path: /UserProvider/CreateUser 29 | group: "test" 30 | version: 1.0.0 31 | ``` 32 | 33 | ### Request 34 | 35 | ```bash 36 | curl host:port/api/v1/test-dubbo/user -X POST -d '{"name": "tiecheng","id": "0002","code": 3,"age": 18}' --header "Content-Type: application/json" 37 | ``` 38 | 39 | ### Response 40 | 41 | - If first add, return like: 42 | 43 | ```json 44 | { 45 | "id": "0002", 46 | "code": 3, 47 | "name": "tiecheng", 48 | "age": 18, 49 | "time": "0001-01-01T00:00:00Z" 50 | } 51 | ``` 52 | 53 | - If you add user multi, return like: 54 | 55 | ```json 56 | { 57 | "message": "data is exist" 58 | } 59 | ``` 60 | -------------------------------------------------------------------------------- /admin/config/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config 19 | 20 | const ( 21 | Version = "0.1.0" // Version admin version 22 | OK = "10001" 23 | ERR = "10002" 24 | RETRY = "10003" 25 | ) 26 | 27 | // WithError transform err to RetData 28 | func WithError(err error) RetData { 29 | return RetData{Code: ERR, Data: err.Error()} 30 | } 31 | 32 | // WithRet transform data to RetData 33 | func WithRet(data any) RetData { 34 | return RetData{Code: OK, Data: data} 35 | } 36 | -------------------------------------------------------------------------------- /pkg/common/constant/xds.go: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | package constant 19 | 20 | const ( 21 | ResourceTypePrefix = "dubbo-go.pixiu" 22 | ClusterType = ResourceTypePrefix + "/v1/discovery:cluster" 23 | ListenerType = ResourceTypePrefix + "/v1/discovery:listener" 24 | EndpointType = ResourceTypePrefix + "/v1/discovery:endpoint" 25 | RouterType = ResourceTypePrefix + "/v1/discovery:route" 26 | RuntimeType = ResourceTypePrefix + "/v1/discovery:runtime" 27 | ) 28 | -------------------------------------------------------------------------------- /controllers/samples/observability/prome.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: pixiu.apache.org/v1alpha1 3 | kind: PixiuFilterPolicy 4 | metadata: 5 | name: prometheus-filter-policy 6 | namespace: default 7 | spec: 8 | targetRef: 9 | group: gateway.networking.k8s.io 10 | kind: HTTPRoute 11 | name: backend 12 | filterType: "dgp.filter.http.prometheusmetric" 13 | config: 14 | metric_collect_rules: 15 | metric_path: "/metrics" 16 | push_gateway_url: "http://127.0.0.1:9091" 17 | counter_push: true 18 | push_interval_threshold: 1 19 | push_job_name: "prometheus" 20 | --- 21 | apiVersion: gateway.networking.k8s.io/v1 22 | kind: HTTPRoute 23 | metadata: 24 | name: backend 25 | namespace: default 26 | spec: 27 | parentRefs: 28 | - name: pg 29 | namespace: pixiu-gateway-system 30 | hostnames: 31 | - "www.example.com" 32 | rules: 33 | - backendRefs: 34 | - group: "" 35 | kind: Service 36 | name: backend 37 | port: 3000 38 | weight: 1 39 | matches: 40 | - path: 41 | type: PathPrefix 42 | value: / 43 | filters: 44 | - type: ExtensionRef 45 | extensionRef: 46 | group: pixiu.apache.org 47 | kind: PixiuFilterPolicy 48 | name: jwt-filter-policy 49 | -------------------------------------------------------------------------------- /pkg/model/wasm.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // WasmConfig contains all services' config. 21 | type WasmConfig struct { 22 | Services []WasmService `yaml:"services" json:"services" mapstructure:"services"` 23 | } 24 | 25 | // WasmService includes all information about the specific application. 26 | type WasmService struct { 27 | Name string `yaml:"name" json:"name" mapstructure:"name"` 28 | Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` 29 | } 30 | -------------------------------------------------------------------------------- /admin/web/src/router/manange.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import Vue from 'vue' 18 | import Router from 'vue-router' 19 | 20 | 21 | Vue.use(Router) 22 | 23 | export default new Router({ 24 | routes: [{ 25 | path: '/', 26 | name: 'login', 27 | component:() => import('@/views/Manage.vue'), 28 | children: [ 29 | { 30 | path: 'DashBoard', 31 | name: 'DashBoard', 32 | component: () => import('@/views/dashboard/index.vue'), 33 | }, 34 | ], 35 | } 36 | ] 37 | }) 38 | -------------------------------------------------------------------------------- /admin/web/src/router/screen.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import Vue from 'vue' 18 | import Router from 'vue-router' 19 | 20 | 21 | Vue.use(Router) 22 | 23 | export default new Router({ 24 | routes: [{ 25 | path:'/', 26 | component: () => import('@/views/screen/dataView'), 27 | redirect: '/dataView', 28 | name: 'dataView', 29 | hidden: true, 30 | children: [{ 31 | path: 'dataView', 32 | component: () => import('@/views/screen/dataView') 33 | }] 34 | }, 35 | ] 36 | }) 37 | -------------------------------------------------------------------------------- /admin/web/src/mock/index.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | var api = require ('../api/index') 18 | var mocks = require('./mocks') 19 | 20 | module.exports = (app) => { 21 | let obj = {}; 22 | 23 | mocks.forEach (el => { 24 | if(el && el.key && api[el.key] && el.method){ 25 | 26 | app[el.method](api[el.key]['url'] || '/issue/do',(req,res) => { 27 | 28 | res.json({ 29 | ...el.data 30 | }) 31 | }) 32 | } 33 | }) 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /tools/benchmark/protocol/triple/pb/go-server/conf/dubbogo.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | dubbo: 21 | registries: 22 | zk: 23 | address: zookeeper://127.0.0.1:2181 24 | registry-type: all 25 | protocols: 26 | triple: 27 | name: tri 28 | port: 20001 29 | provider: 30 | registry-ids: zk 31 | services: 32 | GreeterProvider: 33 | protocol-ids: triple # 使用上面定义的协议id 34 | serialization: protobuf 35 | # interface is for registry 36 | interface: org.apache.dubbogo.samples.api.Greeter -------------------------------------------------------------------------------- /admin/web/src/components/EmptyTip.vue: -------------------------------------------------------------------------------- 1 | 17 | 20 | 21 | 36 | 37 | -------------------------------------------------------------------------------- /controllers/internal/controller/utils_policy.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package controller 19 | 20 | import ( 21 | "strings" 22 | ) 23 | 24 | // splitClusterName splits a cluster name in format "namespace-servicename" into parts 25 | func splitClusterName(clusterName string) (namespace, service string, ok bool) { 26 | parts := strings.SplitN(clusterName, "-", 2) 27 | if len(parts) != 2 { 28 | return "", "", false 29 | } 30 | 31 | if parts[0] == "" || parts[1] == "" { 32 | return "", "", false 33 | } 34 | 35 | return parts[0], parts[1], true 36 | } 37 | -------------------------------------------------------------------------------- /tools/benchmark/protocol/dubbo/go-server/conf/dubbogo.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | # dubbo server yaml configure file 21 | 22 | dubbo: 23 | registries: 24 | demoZK: 25 | protocol: zookeeper 26 | timeout: 3s 27 | address: 127.0.0.1:2181 28 | registry-type: all 29 | protocols: 30 | dubbo: 31 | name: dubbo 32 | port: 20000 33 | provider: 34 | registry-ids: demoZK 35 | services: 36 | UserProvider: 37 | interface: org.apache.dubbo.sample.UserProvider 38 | logger: 39 | zap-config: 40 | level: info 41 | -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/listener.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | package pixiu.api.v1; 20 | 21 | import "address.proto"; 22 | import "filter.proto"; 23 | 24 | // Listener is a server, listener a port 25 | message Listener { 26 | string name = 1; 27 | pixiu.api.v1.Address address = 2 ; 28 | pixiu.api.v1.FilterChain filter_chain = 3 ; 29 | 30 | enum Protocols{ 31 | HTTP = 0; 32 | TCP = 1; 33 | UDP = 2; 34 | HTTPS = 3; 35 | GRPC = 4; 36 | HTTP2 = 5; 37 | TRIPLE = 6; 38 | } 39 | Protocols protocol = 4; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /admin/logic/account/user.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package account 19 | 20 | func EditPassword(oldPassword, newPassword, username string) (bool, error) { 21 | return userDao.EditPassword(oldPassword, newPassword, username) 22 | } 23 | 24 | func GetUserInfo(username string) (bool, any, error) { 25 | return userDao.GetUserInfo(username) 26 | } 27 | 28 | func GetUserRole(username string) (bool, any, error) { 29 | return userDao.GetUserRole(username) 30 | } 31 | 32 | func CheckUserIsAdmin(username string) (bool, error) { 33 | return userDao.CheckUserIsAdmin(username) 34 | } 35 | -------------------------------------------------------------------------------- /pkg/cluster/loadbalancer/rand/load_balancer_rand.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package rand 19 | 20 | import ( 21 | "math/rand" 22 | ) 23 | 24 | import ( 25 | "github.com/apache/dubbo-go-pixiu/pkg/cluster/loadbalancer" 26 | "github.com/apache/dubbo-go-pixiu/pkg/model" 27 | ) 28 | 29 | func init() { 30 | loadbalancer.RegisterLoadBalancer(model.LoadBalancerRand, Rand{}) 31 | } 32 | 33 | type Rand struct{} 34 | 35 | func (Rand) Handler(c *model.ClusterConfig, _ model.LbPolicy) *model.Endpoint { 36 | return c.GetEndpoint(true)[rand.Intn(len(c.Endpoints)-1)] // NOSONAR 37 | } 38 | -------------------------------------------------------------------------------- /controllers/samples/plugins/ratelimit.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: pixiu.apache.org/v1alpha1 2 | kind: PixiuFilterPolicy 3 | metadata: 4 | name: ratelimit-filter-policy 5 | namespace: default 6 | spec: 7 | targetRef: 8 | group: gateway.networking.k8s.io 9 | kind: HTTPRoute 10 | name: backend 11 | filterType: dgp.filter.http.ratelimit 12 | config: 13 | resources: 14 | - name: test-http 15 | items: 16 | - matchStrategy: 1 17 | pattern: "/v1/*" 18 | rules: 19 | - enable: true 20 | flowRule: 21 | resource: "test-http" 22 | threshold: 1 23 | statintervalinms: 1000 24 | --- 25 | --- 26 | apiVersion: gateway.networking.k8s.io/v1 27 | kind: HTTPRoute 28 | metadata: 29 | name: backend 30 | namespace: default 31 | spec: 32 | parentRefs: 33 | - name: pg 34 | namespace: pixiu-gateway-system 35 | hostnames: 36 | - "www.example.com" 37 | rules: 38 | - backendRefs: 39 | - group: "" 40 | kind: Service 41 | name: backend 42 | port: 3000 43 | weight: 1 44 | matches: 45 | - path: 46 | type: PathPrefix 47 | value: / 48 | filters: 49 | - type: ExtensionRef 50 | extensionRef: 51 | group: pixiu.apache.org 52 | kind: PixiuFilterPolicy 53 | name: ratelimit-filter-policy 54 | 55 | 56 | -------------------------------------------------------------------------------- /pkg/tracing/otlp/otlp.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package otlp 19 | 20 | import ( 21 | "context" 22 | ) 23 | 24 | import ( 25 | "go.opentelemetry.io/otel/exporters/otlp/otlptrace" 26 | "go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp" 27 | 28 | sdktrace "go.opentelemetry.io/otel/sdk/trace" 29 | ) 30 | 31 | import ( 32 | "github.com/apache/dubbo-go-pixiu/pkg/model" 33 | ) 34 | 35 | func NewOTLPExporter(ctx context.Context, cfg *model.TracerConfig) (sdktrace.SpanExporter, error) { 36 | client := otlptracehttp.NewClient() 37 | return otlptrace.New(ctx, client) 38 | } 39 | -------------------------------------------------------------------------------- /pkg/listener/tcp/pkg_handler.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package tcp 19 | 20 | import ( 21 | "github.com/apache/dubbo-getty" 22 | ) 23 | 24 | type PackageHandler struct { 25 | ls *TcpListenerService 26 | } 27 | 28 | func NewPackageHandler(ls *TcpListenerService) *PackageHandler { 29 | return &PackageHandler{ls} 30 | } 31 | 32 | func (h *PackageHandler) Read(ss getty.Session, data []byte) (any, int, error) { 33 | return h.ls.FilterChain.OnDecode(data) 34 | } 35 | 36 | func (h *PackageHandler) Write(ss getty.Session, p any) ([]byte, error) { 37 | return h.ls.FilterChain.OnEncode(p) 38 | } 39 | -------------------------------------------------------------------------------- /tools/benchmark/protocol/triple/pb/go-server/pkg/greeter.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package pkg 19 | 20 | import ( 21 | "context" 22 | ) 23 | 24 | import ( 25 | pb "dubbo-go-pixiu-benchmark/api" 26 | 27 | "github.com/dubbogo/gost/log/logger" 28 | ) 29 | 30 | type GreeterProvider struct { 31 | pb.UnimplementedGreeterServer 32 | } 33 | 34 | func (s *GreeterProvider) SayHello(ctx context.Context, in *pb.HelloRequest) (*pb.User, error) { 35 | logger.Infof("Dubbo3 GreeterProvider get user name = %s\n", in.Name) 36 | return &pb.User{Name: "Hello " + in.Name, Id: "12345", Age: 21}, nil 37 | } 38 | -------------------------------------------------------------------------------- /docs/user/start.md: -------------------------------------------------------------------------------- 1 | # Start 2 | 3 | How to start the dubbo-go-pixiu 4 | 5 | #### 1 cd samples dir 6 | 7 | ``` 8 | cd samples/dubbo/simple 9 | ``` 10 | 11 | we can use start.sh to run samples quickly. for more info, execute command as below for more help 12 | 13 | ``` 14 | ./start.sh [action] [project] 15 | ./start.sh help 16 | ``` 17 | 18 | we run body samples below step 19 | 20 | #### 2 prepare config file and docker 21 | 22 | prepare command will prepare dubbo-server and pixiu config file and start docker container needed 23 | 24 | ``` 25 | ./start.sh prepare body 26 | ``` 27 | 28 | if prepare config file manually, notice: 29 | 30 | - modify $PROJECT_DIR in conf.yaml to absolute path in your compute 31 | 32 | #### 3 start dubbo or http server 33 | 34 | ``` 35 | ./start.sh startServer body 36 | ``` 37 | 38 | #### 4 start pixiu 39 | 40 | ``` 41 | ./start.sh startPixiu body 42 | ``` 43 | 44 | if run pixiu manually, use command as below 45 | 46 | ``` 47 | go run cmd/pixiu/*.go gateway start -c /[absolute-path]/dubbo-go-pixiu/samples/dubbo/simple/body/pixiu/conf.yaml 48 | ``` 49 | 50 | #### 5. Try a request 51 | 52 | use curl to try or use unit test 53 | 54 | ```bash 55 | curl -X POST 'localhost:8881/api/v1/test-dubbo/user' -d '{"id":"0003","code":3,"name":"dubbogo","age":99}' --header 'Content-Type: application/json' 56 | ./start.sh startTest body 57 | ``` 58 | 59 | #### 6. Clean 60 | 61 | ``` 62 | ./start.sh clean body 63 | ``` 64 | -------------------------------------------------------------------------------- /controllers/internal/types/k8s.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package types 19 | 20 | import ( 21 | corev1 "k8s.io/api/core/v1" 22 | 23 | gatewayv1 "sigs.k8s.io/gateway-api/apis/v1" 24 | ) 25 | 26 | const ( 27 | KindGateway = "Gateway" 28 | KindGatewayClass = "GatewayClass" 29 | KindSecret = "Secret" 30 | ) 31 | 32 | func KindOf(obj any) string { 33 | switch obj.(type) { 34 | case *gatewayv1.Gateway: 35 | return KindGateway 36 | case *gatewayv1.GatewayClass: 37 | return KindGatewayClass 38 | case *corev1.Secret: 39 | return KindSecret 40 | default: 41 | return "Unknown" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/address.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | package pixiu.api.v1; 20 | 21 | // Address the address 22 | message Address { 23 | pixiu.api.v1.SocketAddress socket_address = 1; 24 | string name = 2; 25 | } 26 | 27 | // SocketAddress specify either a logical or physical address and port, which are 28 | // used to tell server where to bind/listen, connect to upstream and find 29 | // management servers 30 | message SocketAddress { 31 | string address = 1; 32 | int64 port = 2; 33 | string resolver_name = 3; 34 | repeated string domains = 4; 35 | string certsDir = 5; 36 | } -------------------------------------------------------------------------------- /pkg/filter/http/apiconfig/config.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package apiconfig 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/model" 22 | ) 23 | 24 | // ApiConfigConfig the config for api_config filter 25 | type ApiConfigConfig struct { 26 | APIMetaConfig *model.APIMetaConfig `yaml:"api_meta_config" json:"api_meta_config,omitempty"` 27 | Path string `yaml:"path" json:"path,omitempty"` 28 | Dynamic bool `yaml:"dynamic" json:"dynamic,omitempty"` 29 | DynamicAdapter string `yaml:"dynamic_adapter" json:"dynamic_adapter,omitempty"` 30 | } 31 | -------------------------------------------------------------------------------- /pkg/model/remote.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // RemoteConfig remote server info which offer server discovery or k/v or distribution function 21 | type RemoteConfig struct { 22 | Protocol string `yaml:"protocol" json:"protocol" default:"zookeeper"` 23 | Timeout string `yaml:"timeout" json:"timeout" default:"10s"` 24 | Address string `yaml:"address" json:"address"` 25 | Username string `yaml:"username" json:"username"` 26 | Password string `yaml:"password" json:"password"` 27 | Group string `yaml:"group" json:"group"` 28 | Root string `yaml:"root" json:"root" default:"/services"` 29 | } 30 | -------------------------------------------------------------------------------- /admin/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-project", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "analyz": "npm_config_report=true yarn run build", 9 | "test:unit": "vue-cli-service test:unit" 10 | }, 11 | "dependencies": { 12 | "axios": "^1.12.0", 13 | "element-ui": "^2.15.14", 14 | "js-cookie": "^2.2.0", 15 | "jsencrypt": "^3.0.0-rc.1", 16 | "moment": "^2.24.0", 17 | "monaco-editor": "^0.25.2", 18 | "nprogress": "^0.2.0", 19 | "three": "^0.127.0", 20 | "three-css2drender": "^1.0.0", 21 | "three-obj-mtl-loader": "^1.0.3", 22 | "vue": "^2.6.14", 23 | "vue-cropper": "^0.5.7", 24 | "vue-router": "^3.0.1", 25 | "vuex": "^3.0.1", 26 | "webpack-bundle-analyzer": "^3.3.2" 27 | }, 28 | "devDependencies": { 29 | "@vue/cli-plugin-babel": "^5.0.8", 30 | "@vue/cli-plugin-unit-jest": "^5.0.8", 31 | "@vue/cli-service": "^5.0.8", 32 | "@vue/test-utils": "1.0.0-beta.29", 33 | "babel-core": "7.0.0-bridge.0", 34 | "babel-jest": "^24.5.0", 35 | "exports-loader": "^2.0.0", 36 | "import-three-examples": "^2.2.3", 37 | "imports-loader": "^2.0.0", 38 | "less": "^3.13.1", 39 | "less-loader": "^4.1.0", 40 | "sass": "^1.42.1", 41 | "sass-loader": "^7.3.1", 42 | "vue-cli-plugin-element": "^1.0.1", 43 | "vue-template-compiler": "^2.5.21" 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /pkg/cmd/sidecar.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package cmd 19 | 20 | import ( 21 | "fmt" 22 | ) 23 | 24 | import ( 25 | "github.com/spf13/cobra" 26 | ) 27 | 28 | func init() { 29 | SideCarCmd.AddCommand(startSideCarCmd) 30 | } 31 | 32 | var ( 33 | SideCarCmd = &cobra.Command{ 34 | Use: "sidecar", 35 | Short: "Run dubbo go pixiu in sidecar mode (implement in the future)", 36 | } 37 | 38 | startSideCarCmd = &cobra.Command{ 39 | Use: "start", 40 | Short: "Start sidecar (implement in the future)", 41 | Run: func(cmd *cobra.Command, args []string) { 42 | fmt.Println("Meet you in the Future!") 43 | }, 44 | } 45 | ) 46 | -------------------------------------------------------------------------------- /pkg/common/shutdown/graceful_shutdown_signal_windows.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package shutdown 19 | 20 | import ( 21 | "os" 22 | "syscall" 23 | ) 24 | 25 | var ( 26 | // ShutdownSignals receives shutdown signals to process 27 | ShutdownSignals = []os.Signal{ 28 | os.Interrupt, os.Kill, syscall.SIGKILL, 29 | syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, 30 | syscall.SIGABRT, syscall.SIGTERM, 31 | } 32 | 33 | // DumpHeapShutdownSignals receives shutdown signals to process 34 | DumpHeapShutdownSignals = []os.Signal{syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, syscall.SIGABRT} 35 | ) 36 | -------------------------------------------------------------------------------- /configs/log.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | level: "debug" 21 | development: true 22 | disableCaller: false 23 | disableStacktrace: false 24 | sampling: 25 | encoding: "console" 26 | 27 | # encoder 28 | encoderConfig: 29 | messageKey: "message" 30 | levelKey: "level" 31 | timeKey: "time" 32 | nameKey: "logger" 33 | callerKey: "caller" 34 | stacktraceKey: "stacktrace" 35 | lineEnding: "" 36 | levelEncoder: "capitalColor" 37 | timeEncoder: "iso8601" 38 | durationEncoder: "seconds" 39 | callerEncoder: "short" 40 | nameEncoder: "" 41 | 42 | outputPaths: 43 | - "stderr" 44 | errorOutputPaths: 45 | - "stderr" 46 | initialFields: 47 | -------------------------------------------------------------------------------- /pkg/logger/log.yml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to the Apache Software Foundation (ASF) under one 3 | # or more contributor license agreements. See the NOTICE file 4 | # distributed with this work for additional information 5 | # regarding copyright ownership. The ASF licenses this file 6 | # to you under the Apache License, Version 2.0 (the 7 | # "License"); you may not use this file except in compliance 8 | # with the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | level: "debug" 20 | development: true 21 | disableCaller: false 22 | disableStacktrace: false 23 | sampling: 24 | encoding: "console" 25 | 26 | # encoder 27 | encoderConfig: 28 | messageKey: "message" 29 | levelKey: "level" 30 | timeKey: "time" 31 | nameKey: "logger" 32 | callerKey: "caller" 33 | stacktraceKey: "stacktrace" 34 | lineEnding: "" 35 | levelEncoder: "capitalColor" 36 | timeEncoder: "iso8601" 37 | durationEncoder: "seconds" 38 | callerEncoder: "short" 39 | nameEncoder: "" 40 | 41 | outputPaths: 42 | - "stderr" 43 | errorOutputPaths: 44 | - "stderr" 45 | initialFields: 46 | -------------------------------------------------------------------------------- /pkg/tracing/trace_manager.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package tracing 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/model" 22 | ) 23 | 24 | // TraceDriverManager Driver maintains all tracers and the provider. 25 | type TraceDriverManager struct { 26 | driver *TraceDriver 27 | bootstrap *model.Bootstrap 28 | } 29 | 30 | func CreateDefaultTraceDriverManager(bs *model.Bootstrap) *TraceDriverManager { 31 | manager := &TraceDriverManager{ 32 | bootstrap: bs, 33 | } 34 | manager.driver = InitDriver(bs) 35 | return manager 36 | } 37 | 38 | func (manager *TraceDriverManager) GetDriver() *TraceDriver { 39 | return manager.driver 40 | } 41 | -------------------------------------------------------------------------------- /pkg/model/filter.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // FilterChain filter chain 21 | type FilterChain struct { 22 | Filters []NetworkFilter `yaml:"filters" json:"filters" mapstructure:"filters"` 23 | } 24 | 25 | // NetworkFilter core struct, filter is extend by user 26 | type NetworkFilter struct { 27 | Name string `yaml:"name" json:"name" mapstructure:"name"` // Name filter name unique 28 | Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` // Config filter config 29 | } 30 | 31 | // FilterChainMatch 32 | type FilterChainMatch struct { 33 | Domains []string `yaml:"domains" json:"domains" mapstructure:"domains"` 34 | } 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/#4_discussion_zh.yml: -------------------------------------------------------------------------------- 1 | # Licensed to the Apache Software Foundation (ASF) under one or more 2 | # contributor license agreements. See the NOTICE file distributed with 3 | # this work for additional information regarding copyright ownership. 4 | # The ASF licenses this file to You under the Apache License, Version 2.0 5 | # (the "License"); you may not use this file except in compliance with 6 | # the License. You may obtain a copy of the License at 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # Unless required by applicable law or agreed to in writing, software 9 | # distributed under the License is distributed on an "AS IS" BASIS, 10 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | # See the License for the specific language governing permissions and 12 | # limitations under the License. 13 | 14 | name: "💬 讨论" 15 | description: "开始一个关于项目的讨论" 16 | title: "[讨论] " 17 | labels: ["discussion"] 18 | body: 19 | - type: markdown 20 | attributes: 21 | value: "## 🔄 讨论主题" 22 | 23 | - type: textarea 24 | id: discussion-content 25 | attributes: 26 | label: "讨论详情" 27 | description: "请描述您想要讨论的内容" 28 | placeholder: "提供关于您想讨论的项目相关事项的详细信息" 29 | validations: 30 | required: true 31 | 32 | - type: textarea 33 | id: related-context 34 | attributes: 35 | label: "📚 相关背景" 36 | description: "添加任何相关的上下文或背景信息" 37 | placeholder: "分享有助于理解此讨论的背景信息" 38 | validations: 39 | required: false 40 | -------------------------------------------------------------------------------- /admin/web/src/api/menu-config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | export const menuList = [{ 18 | name: '网关配置', 19 | id: 'Gateway', 20 | children: [{ 21 | name: '概览', 22 | id: 'Overview', 23 | componentName: '/Overview' 24 | }, 25 | { 26 | name: '插件配置', 27 | id: 'Plug', 28 | componentName: 'Plug' 29 | },{ 30 | name: '集群管理', 31 | id: 'Cluster', 32 | componentName: 'Cluster' 33 | },{ 34 | name: 'Listener管理', 35 | id: 'Listener', 36 | componentName: 'Listener' 37 | }] 38 | }, { 39 | name: '限流配置', 40 | id: 'Flow', 41 | children: [{ 42 | name: '限流配置', 43 | id: 'RateLimiter', 44 | componentName: '/RateLimiter' 45 | }] 46 | }] 47 | -------------------------------------------------------------------------------- /pkg/common/constant/env.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package constant 19 | 20 | // env key 21 | const ( 22 | EnvResponseStrategy = "dgp-response-strategy" 23 | EnvMock = "dgp-mock" 24 | ) 25 | 26 | const ( 27 | EnvDubbogoPixiuConfig = "DUBBOGO_PIXIU_CONFIG" 28 | EnvDubbogoPixiuApiConfig = "DUBBOGO_PIXIU_API_CONFIG" 29 | EnvDubbogoPixiuLogConfig = "DUBBOGO_PIXIU_LOG_CONFIG" 30 | EnvDubbogoPixiuLogLevel = "DUBBOGO_PIXIU_LOG_LEVEL" 31 | EnvDubbogoPixiuLogFormat = "DUBBOGO_PIXIU_LOG_FORMAT" 32 | EnvDubbogoPixiuLimitCpus = "DUBBOGO_PIXIU_LIMIT_CPUS" 33 | ) 34 | 35 | // registry configuration 36 | const ( 37 | EnvDubbogoPixiuNacosRegistryAddress = "NACOS_ADDRESS" 38 | ) 39 | -------------------------------------------------------------------------------- /pkg/common/constant/url.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package constant 18 | 19 | const ( 20 | // RequestBody name of api config mapping from/to 21 | RequestBody = "requestBody" 22 | // QueryStrings name of api config mapping from/to 23 | QueryStrings = "queryStrings" 24 | // Headers name of api config mapping from/to 25 | Headers = "headers" 26 | // RequestURI name of api config mapping from/to, retrieve parameters from uri 27 | // for instance, https://test.com/:id uri.id will retrieve the :id parameter 28 | RequestURI = "uri" 29 | // Dot defines the . which will be used to present the path to specific field in the body 30 | Dot = "." 31 | AnyValue = "*" 32 | At = "@" 33 | ) 34 | -------------------------------------------------------------------------------- /controllers/internal/utils/utils.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package utils 19 | 20 | import ( 21 | "controllers/internal/types" 22 | 23 | k8stypes "k8s.io/apimachinery/pkg/types" 24 | 25 | "sigs.k8s.io/controller-runtime/pkg/client" 26 | ) 27 | 28 | func NamespacedName(obj client.Object) k8stypes.NamespacedName { 29 | return k8stypes.NamespacedName{ 30 | Namespace: obj.GetNamespace(), 31 | Name: obj.GetName(), 32 | } 33 | } 34 | 35 | func NamespacedNameKind(obj client.Object) types.NamespacedNameKind { 36 | return types.NamespacedNameKind{ 37 | Namespace: obj.GetNamespace(), 38 | Name: obj.GetName(), 39 | Kind: obj.GetObjectKind().GroupVersionKind().Kind, 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /pkg/logger/output.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package logger 19 | 20 | func Info(args ...any) { 21 | control.info(args...) 22 | } 23 | 24 | func Warn(args ...any) { 25 | control.warn(args...) 26 | } 27 | 28 | func Error(args ...any) { 29 | control.error(args...) 30 | } 31 | 32 | func Debug(args ...any) { 33 | control.debug(args...) 34 | } 35 | 36 | func Infof(fmt string, args ...any) { 37 | control.infof(fmt, args...) 38 | } 39 | 40 | func Warnf(fmt string, args ...any) { 41 | control.warnf(fmt, args...) 42 | } 43 | 44 | func Errorf(fmt string, args ...any) { 45 | control.errorf(fmt, args...) 46 | } 47 | 48 | func Debugf(fmt string, args ...any) { 49 | control.debugf(fmt, args...) 50 | } 51 | -------------------------------------------------------------------------------- /pkg/common/shutdown/graceful_shutdown_signal_darwin.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package shutdown 19 | 20 | import ( 21 | "os" 22 | "syscall" 23 | ) 24 | 25 | var ( 26 | // ShutdownSignals receives shutdown signals to process 27 | ShutdownSignals = []os.Signal{ 28 | os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP, 29 | syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, 30 | syscall.SIGABRT, syscall.SIGSYS, syscall.SIGTERM, 31 | } 32 | 33 | // DumpHeapShutdownSignals receives shutdown signals to process 34 | DumpHeapShutdownSignals = []os.Signal{ 35 | syscall.SIGQUIT, syscall.SIGILL, 36 | syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS, 37 | } 38 | ) 39 | -------------------------------------------------------------------------------- /pkg/common/shutdown/graceful_shutdown_signal_linux.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package shutdown 19 | 20 | import ( 21 | "os" 22 | "syscall" 23 | ) 24 | 25 | var ( 26 | // ShutdownSignals receives shutdown signals to process 27 | ShutdownSignals = []os.Signal{ 28 | os.Interrupt, os.Kill, syscall.SIGKILL, syscall.SIGSTOP, 29 | syscall.SIGHUP, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGILL, syscall.SIGTRAP, 30 | syscall.SIGABRT, syscall.SIGSYS, syscall.SIGTERM, 31 | } 32 | 33 | // DumpHeapShutdownSignals receives shutdown signals to process 34 | DumpHeapShutdownSignals = []os.Signal{ 35 | syscall.SIGQUIT, syscall.SIGILL, 36 | syscall.SIGTRAP, syscall.SIGABRT, syscall.SIGSYS, 37 | } 38 | ) 39 | -------------------------------------------------------------------------------- /admin/web/src/entry/manage.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import Vue from 'vue' 18 | import App from '@/views/Manage.vue' 19 | import router from '@/router/manange' 20 | import store from '@/store/store' 21 | import '@/plugins/element.js' 22 | import '@/styles/icons/iconfont.css' 23 | import '@/styles/common.scss' 24 | import '@/styles/normalize.css' 25 | import '@/permission' 26 | import '@/utils/directives' 27 | import rem from '@/utils/rem' 28 | import {loadding,updatePublic} from '@/utils/dialogUtils' 29 | Vue.config.productionTip = false 30 | 31 | Vue.prototype.$rem = rem 32 | Vue.mixin(loadding) 33 | Vue.mixin(updatePublic) 34 | new Vue({ 35 | router, 36 | store, 37 | render: h => h(App) 38 | }).$mount('#app') 39 | -------------------------------------------------------------------------------- /pkg/model/trace.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | // TracerConfig inclueds detail information about the exporter 21 | type TracerConfig struct { 22 | Name string `yaml:"name" json:"name" mapstructure:"name"` 23 | ServiceName string `yaml:"serviceName" json:"serviceName" mapstructure:"serviceName"` 24 | Sampler Sampler `yaml:"sampler" json:"sampler" mapstructure:"sampler"` 25 | Config map[string]any `yaml:"config" json:"config" mapstructure:"config"` 26 | } 27 | 28 | // Sampler policy 29 | type Sampler struct { 30 | Type string `yaml:"type" json:"type" mapstructure:"type"` 31 | Param float64 `yaml:"param" json:"param" mapstructure:"param"` 32 | } 33 | -------------------------------------------------------------------------------- /admin/web/jest.config.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | module.exports = { 18 | moduleFileExtensions: [ 19 | 'js', 20 | 'jsx', 21 | 'json', 22 | 'vue' 23 | ], 24 | transform: { 25 | '^.+\\.vue$': 'vue-jest', 26 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', 27 | '^.+\\.jsx?$': 'babel-jest' 28 | }, 29 | transformIgnorePatterns: [ 30 | '/node_modules/' 31 | ], 32 | moduleNameMapper: { 33 | '^@/(.*)$': '/src/$1' 34 | }, 35 | snapshotSerializers: [ 36 | 'jest-serializer-vue' 37 | ], 38 | testMatch: [ 39 | '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 40 | ], 41 | testURL: 'http://localhost/' 42 | } 43 | -------------------------------------------------------------------------------- /admin/web/src/entry/screen.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | import Vue from 'vue' 18 | import App from '@/views/Screen.vue' 19 | import router from '@/router/screen' 20 | import store from '@/store/store' 21 | import '@/styles/icons/iconfont.css' 22 | import '@/styles/common.scss' 23 | import '@/styles/normalize.css' 24 | import '@/utils/directives' 25 | import {loadding,updatePublic} from '@/utils/dialogUtils' 26 | Vue.config.productionTip = false 27 | 28 | import '@/element-variables.scss' 29 | import ElementUI from 'element-ui' 30 | 31 | Vue.mixin(loadding) 32 | Vue.mixin(updatePublic) 33 | Vue.use(ElementUI, { 34 | size: 'small' 35 | }) 36 | new Vue({ 37 | router, 38 | store, 39 | render: h => h(App) 40 | }).$mount('#app') 41 | -------------------------------------------------------------------------------- /pkg/model/match.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package model 19 | 20 | const ( 21 | Exact MatcherType = 0 + iota 22 | Prefix 23 | Suffix 24 | Regex 25 | ) 26 | 27 | var ( 28 | MatcherTypeName = map[int32]string{ 29 | 0: "Exact", 30 | 1: "Prefix", 31 | 2: "Suffix", 32 | 3: "Regex", 33 | } 34 | 35 | MatcherTypeValue = map[string]int32{ 36 | "Exact": 0, 37 | "Prefix": 1, 38 | "Suffix": 2, 39 | "Regex": 3, 40 | } 41 | ) 42 | 43 | type ( 44 | // StringMatcher matcher string 45 | StringMatcher struct { 46 | Matcher MatcherType 47 | } 48 | 49 | // MatcherType matcher type 50 | MatcherType int32 51 | ) 52 | 53 | // Match 54 | func (sm *StringMatcher) Match() (bool, error) { 55 | return true, nil 56 | } 57 | -------------------------------------------------------------------------------- /pkg/server/http.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package server 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/common/constant" 22 | "github.com/apache/dubbo-go-pixiu/pkg/common/router/trie" 23 | "github.com/apache/dubbo-go-pixiu/pkg/model" 24 | ) 25 | 26 | // DefaultHttpConnectionManager 27 | func DefaultHttpConnectionManager() *model.HttpConnectionManagerConfig { 28 | return &model.HttpConnectionManagerConfig{ 29 | RouteConfig: model.RouteConfiguration{ 30 | RouteTrie: trie.NewTrieWithDefault("/api/v1/**", model.RouteAction{ 31 | Cluster: constant.HeaderValueAll, 32 | }), 33 | }, 34 | HTTPFilters: []*model.HTTPFilter{ 35 | { 36 | Name: constant.HTTPProxyFilter, 37 | }, 38 | }, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/filter.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | import "google/protobuf/struct.proto"; 20 | 21 | package pixiu.api.v1; 22 | 23 | // Filter core struct, filter is extend by user 24 | message NetworkFilter { 25 | string name = 1; 26 | oneof config { 27 | Config yaml = 2; 28 | Config json = 3; 29 | google.protobuf.Struct struct = 4; 30 | } 31 | } 32 | 33 | // Config string kind config(yaml or json such as) for NetworkFilter. 34 | message Config { 35 | string content = 1; 36 | } 37 | 38 | // FilterChain filter chain 39 | message FilterChain { 40 | repeated pixiu.api.v1.NetworkFilter filters = 1; 41 | } 42 | 43 | // HTTPFilter http filter 44 | message HTTPFilter { 45 | string name = 1; 46 | } -------------------------------------------------------------------------------- /admin/dao/daos.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package dao 19 | 20 | // GuestDao 21 | type GuestDao interface { 22 | // Login login 23 | Login(username, password string) (bool, int) 24 | // CheckLogin check login 25 | CheckLogin() 26 | // Register register 27 | Register(username, password string) error 28 | } 29 | 30 | // UserDao 31 | type UserDao interface { 32 | // EditPassword edit password 33 | EditPassword(oldPassword, newPassword, username string) (bool, error) 34 | // GetUserInfo get user info 35 | GetUserInfo(username string) (bool, any, error) 36 | // GetUserRole get user role 37 | GetUserRole(username string) (bool, any, error) 38 | // CheckUserIsAdmin check user is admin 39 | CheckUserIsAdmin(username string) (bool, error) 40 | } 41 | -------------------------------------------------------------------------------- /pkg/config/api_config_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config_test 19 | 20 | import ( 21 | "log" 22 | "testing" 23 | ) 24 | 25 | import ( 26 | "github.com/stretchr/testify/assert" 27 | ) 28 | 29 | import ( 30 | "github.com/apache/dubbo-go-pixiu/pkg/common/yaml" 31 | "github.com/apache/dubbo-go-pixiu/pkg/config" 32 | ) 33 | 34 | func TestLoadAPIConfigFromFile(t *testing.T) { 35 | apiC, err := config.LoadAPIConfigFromFile("") 36 | assert.Empty(t, apiC) 37 | assert.EqualError(t, err, "Config file not specified") 38 | 39 | apiC, err = config.LoadAPIConfigFromFile("./mock/api_config.yml") 40 | assert.Empty(t, err) 41 | assert.Equal(t, apiC.Name, "api name") 42 | bytes, _ := yaml.MarshalYML(apiC) 43 | log.Printf("%s", bytes) 44 | } 45 | -------------------------------------------------------------------------------- /admin/logic/account/guest.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package account 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/admin/dao" 22 | impl2 "github.com/apache/dubbo-go-pixiu/admin/dao/impl" 23 | ) 24 | 25 | // Lazy initialization 26 | var guestDao dao.GuestDao 27 | var userDao dao.UserDao 28 | 29 | func InitGuestDao() { 30 | if guestDao == nil { 31 | guestDao = impl2.NewGuestDao() 32 | } 33 | } 34 | 35 | func InitUserDao() { 36 | if userDao == nil { 37 | userDao = impl2.NewUserDao() 38 | } 39 | } 40 | 41 | func Login(username string, password string) (bool, int) { 42 | return guestDao.Login(username, password) 43 | } 44 | 45 | func Register(username, password string) error { 46 | return guestDao.Register(username, password) 47 | } 48 | -------------------------------------------------------------------------------- /pkg/cluster/loadbalancer/roundrobin/round_robin.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package roundrobin 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/cluster/loadbalancer" 22 | "github.com/apache/dubbo-go-pixiu/pkg/model" 23 | ) 24 | 25 | func init() { 26 | loadbalancer.RegisterLoadBalancer(model.LoadBalancerRoundRobin, RoundRobin{}) 27 | } 28 | 29 | type RoundRobin struct{} 30 | 31 | func (RoundRobin) Handler(c *model.ClusterConfig, _ model.LbPolicy) *model.Endpoint { 32 | endpoints := c.GetEndpoint(true) 33 | lens := len(endpoints) 34 | if c.PrePickEndpointIndex >= lens { 35 | c.PrePickEndpointIndex = 0 36 | } 37 | e := endpoints[c.PrePickEndpointIndex] 38 | c.PrePickEndpointIndex = (c.PrePickEndpointIndex + 1) % lens 39 | return e 40 | } 41 | -------------------------------------------------------------------------------- /pkg/filter/host/host_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package host 19 | 20 | import ( 21 | "bytes" 22 | "net/http" 23 | "testing" 24 | ) 25 | 26 | import ( 27 | "github.com/stretchr/testify/assert" 28 | ) 29 | 30 | import ( 31 | "github.com/apache/dubbo-go-pixiu/pkg/context/mock" 32 | ) 33 | 34 | func TestHost(t *testing.T) { 35 | targetHost := "www.dubbogo.com" 36 | cfg := &Config{ 37 | Host: targetHost, 38 | } 39 | request, err := http.NewRequest("POST", "http://www.dubbogopixiu.com/mock/test?name=tc", bytes.NewReader([]byte("{\"id\":\"12345\"}"))) 40 | assert.NoError(t, err) 41 | host := &Filter{cfg: cfg} 42 | assert.Nil(t, err) 43 | c := mock.GetMockHTTPContext(request) 44 | host.Decode(c) 45 | assert.Equal(t, targetHost, c.Request.Host) 46 | } 47 | -------------------------------------------------------------------------------- /pkg/cluster/retry/noretry/no_retry.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package noretry 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/cluster/retry" 22 | "github.com/apache/dubbo-go-pixiu/pkg/model" 23 | ) 24 | 25 | func init() { 26 | retry.RegisterRetryPolicy(model.RetryerNoRetry, newNoRetryPolicy) 27 | } 28 | 29 | type NoRetryPolicy struct { 30 | firstTime bool 31 | } 32 | 33 | func (n *NoRetryPolicy) Attempt() bool { 34 | if !n.firstTime { 35 | n.firstTime = true 36 | return true // Allow the first attempt 37 | } 38 | return false 39 | } 40 | 41 | func (n *NoRetryPolicy) Reset() { 42 | n.firstTime = false 43 | } 44 | 45 | func newNoRetryPolicy(config map[string]any) (retry.RetryPolicy, error) { 46 | return &NoRetryPolicy{firstTime: false}, nil 47 | } 48 | -------------------------------------------------------------------------------- /pkg/filter/sentinel/exact.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package sentinel 19 | 20 | import ( 21 | "sync" 22 | ) 23 | 24 | type Exact struct { 25 | apiNames map[string]string 26 | 27 | mu sync.RWMutex 28 | } 29 | 30 | func (p *Exact) load(apis []*Resource) { 31 | m := make(map[string]string, len(apis)) 32 | 33 | for _, api := range apis { 34 | apiName := api.Name 35 | for _, item := range api.Items { 36 | if item.MatchStrategy == EXACT { 37 | m[item.Pattern] = apiName 38 | } 39 | } 40 | } 41 | 42 | p.mu.Lock() 43 | defer p.mu.Unlock() 44 | p.apiNames = m 45 | } 46 | 47 | func (p *Exact) match(path string) (string, bool) { 48 | p.mu.RLock() 49 | defer p.mu.RUnlock() 50 | 51 | resourceName, ok := p.apiNames[path] 52 | return resourceName, ok 53 | } 54 | -------------------------------------------------------------------------------- /pkg/adapter/mcpserver/registry/controller.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package registry 19 | 20 | import ( 21 | "context" 22 | "time" 23 | ) 24 | 25 | import ( 26 | "github.com/apache/dubbo-go-pixiu/pkg/model" 27 | ) 28 | 29 | // Controller is a provider-agnostic control-plane interface for MCP registries. 30 | // It discovers, watches and forwards changes via an onChange callback. 31 | type Controller interface { 32 | Run(ctx context.Context, interval time.Duration) error 33 | Close() error 34 | } 35 | 36 | // BuildFunc creates a Controller for a given registry configuration. 37 | // Implemented by each provider and registered via RegisterProvider. 38 | type BuildFunc func(reg model.Registry, onChange func(serverId string, cfg *model.McpServerConfig)) (Controller, error) 39 | -------------------------------------------------------------------------------- /pkg/config/xds/model/proto/route.proto: -------------------------------------------------------------------------------- 1 | // Licensed to the Apache Software Foundation (ASF) under one 2 | // or more contributor license agreements. See the NOTICE file 3 | // distributed with this work for additional information 4 | // regarding copyright ownership. The ASF licenses this file 5 | // to you under the Apache License, Version 2.0 (the 6 | // "License"); you may not use this file except in compliance 7 | // with the License. You may obtain a copy of the License at 8 | // 9 | // http://www.apache.org/licenses/LICENSE-2.0 10 | // 11 | // Unless required by applicable law or agreed to in writing, 12 | // software distributed under the License is distributed on an 13 | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 | // KIND, either express or implied. See the License for the 15 | // specific language governing permissions and limitations 16 | // under the License. 17 | 18 | syntax = "proto3"; 19 | package pixiu.api.v1; 20 | 21 | // RouteAction match route should do 22 | message RouteAction { 23 | string cluster = 1; 24 | int64 cluster_not_found_response_code = 2; 25 | } 26 | 27 | // RouteConfiguration todo config route from (Http|Grpc|...)ManagerConfig 28 | message RouteConfiguration { 29 | repeated pixiu.api.v1.Router routes = 1; 30 | bool dynamic = 2; 31 | } 32 | 33 | // Router router config for RouteConfiguration 34 | message Router { 35 | string id = 1 ; 36 | pixiu.api.v1.RouterMatch match = 2; 37 | pixiu.api.v1.RouteAction route = 3; 38 | } 39 | 40 | // RouterMatch 41 | message RouterMatch { 42 | string prefix = 1; 43 | string path = 2; 44 | repeated string methods = 3; 45 | } -------------------------------------------------------------------------------- /pkg/client/dubbo/default.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package dubbo 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/config" 22 | ) 23 | 24 | // defaultMappingParams default http to dubbo config 25 | var defaultMappingParams = []config.MappingParam{ 26 | { 27 | Name: "requestBody.values", 28 | MapTo: "opt.values", 29 | }, { 30 | Name: "requestBody.types", 31 | MapTo: "opt.types", 32 | }, { 33 | Name: "uri.application", 34 | MapTo: "opt.application", 35 | }, { 36 | Name: "uri.interface", 37 | MapTo: "opt.interface", 38 | }, { 39 | Name: "queryStrings.method", 40 | MapTo: "opt.method", 41 | }, { 42 | Name: "queryStrings.group", 43 | MapTo: "opt.group", 44 | }, { 45 | Name: "queryStrings.version", 46 | MapTo: "opt.version", 47 | }, 48 | } 49 | -------------------------------------------------------------------------------- /pkg/common/mock/router.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package mock 19 | 20 | import ( 21 | "github.com/apache/dubbo-go-pixiu/pkg/common/constant" 22 | "github.com/apache/dubbo-go-pixiu/pkg/config" 23 | "github.com/apache/dubbo-go-pixiu/pkg/router" 24 | ) 25 | 26 | // GetMockAPI a mock util to create router.API 27 | func GetMockAPI(verb string, urlPattern string, filters ...string) router.API { 28 | inbound := config.InboundRequest{} 29 | integration := config.IntegrationRequest{RequestType: constant.DubboRequest} 30 | method := config.Method{ 31 | Enable: true, 32 | HTTPVerb: verb, 33 | InboundRequest: inbound, 34 | IntegrationRequest: integration, 35 | } 36 | return router.API{ 37 | URLPattern: urlPattern, 38 | Method: method, 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /configs/admin_config.yaml: -------------------------------------------------------------------------------- 1 | # 2 | # Licensed to Apache Software Foundation (ASF) under one or more contributor 3 | # license agreements. See the NOTICE file distributed with 4 | # this work for additional information regarding copyright 5 | # ownership. Apache Software Foundation (ASF) licenses this file to you under 6 | # the Apache License, Version 2.0 (the "License"); you may 7 | # not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, 13 | # software distributed under the License is distributed on an 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | # KIND, either express or implied. See the License for the 16 | # specific language governing permissions and limitations 17 | # under the License. 18 | # 19 | 20 | server: 21 | address: 127.0.0.1:8081 22 | etcd: 23 | address: 127.0.0.1:2379 24 | path: /pixiu/config/api 25 | mysql: 26 | username: root 27 | password: 123456 28 | host: 192.168.31.44 29 | port: 3306 30 | dbname: pixiu 31 | # zap logger configuration 32 | zap: 33 | level: 'info' 34 | format: 'console' 35 | prefix: '[DUBBOGO-PIXIU-ADMIN]' 36 | director: 'log' 37 | show-line: true 38 | encode-level: 'LowercaseColorLevelEncoder' 39 | stacktrace-key: 'stacktrace' 40 | log-in-console: true 41 | 42 | # redis configuration 43 | redis: 44 | db: 0 45 | addr: '127.0.0.1:6379' 46 | password: '' 47 | 48 | 49 | # system configuration 50 | system: 51 | env: 'public' 52 | addr: 8081 53 | db-type: 'mysql' -------------------------------------------------------------------------------- /pkg/adapter/mcpserver/registry/factory.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package registry 19 | 20 | import ( 21 | "fmt" 22 | ) 23 | 24 | import ( 25 | "github.com/apache/dubbo-go-pixiu/pkg/model" 26 | ) 27 | 28 | var providers = map[string]BuildFunc{} 29 | 30 | // RegisterProvider registers a provider-specific controller builder. 31 | func RegisterProvider(protocol string, fn BuildFunc) { 32 | providers[protocol] = fn 33 | } 34 | 35 | // BuildController builds a provider controller based on registry protocol. 36 | func BuildController(reg model.Registry, onChange func(serverId string, cfg *model.McpServerConfig)) (Controller, error) { 37 | if fn, ok := providers[reg.Protocol]; ok { 38 | return fn(reg, onChange) 39 | } 40 | return nil, fmt.Errorf("no provider for protocol: %s", reg.Protocol) 41 | } 42 | -------------------------------------------------------------------------------- /tools/benchmark/test/test_tool.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package test 19 | 20 | import ( 21 | "io" 22 | "os/exec" 23 | "time" 24 | ) 25 | 26 | import ( 27 | "github.com/onsi/gomega" 28 | "github.com/onsi/gomega/gexec" 29 | "github.com/onsi/gomega/gmeasure" 30 | ) 31 | 32 | var ( 33 | CurPath string 34 | SampleConfig = gmeasure.SamplingConfig{ 35 | N: 500, 36 | Duration: 300 * time.Second, 37 | NumParallel: 10, 38 | } 39 | ) 40 | 41 | func PreparePixiu(pixiu, path string) *gexec.Session { 42 | command := exec.Command(pixiu, "gateway", "start", "-c", path) 43 | session, err := gexec.Start(command, io.Discard, io.Discard) 44 | //session, err := gexec.Start(command, os.Stdout, os.Stderr) 45 | gomega.Expect(err).NotTo(gomega.HaveOccurred()) 46 | return session 47 | } 48 | -------------------------------------------------------------------------------- /admin/web/src/views/Screen.vue: -------------------------------------------------------------------------------- 1 | 17 | 22 | 23 | 24 | 49 | 50 | 59 | -------------------------------------------------------------------------------- /pkg/client/response.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package client 19 | 20 | import ( 21 | "io" 22 | ) 23 | 24 | // UnaryResponse response from endpoint 25 | type UnaryResponse struct { 26 | Data []byte 27 | } 28 | 29 | // NewUnaryResponse create response contains a []byte 30 | func NewUnaryResponse(data []byte) *UnaryResponse { 31 | return &UnaryResponse{Data: data} 32 | } 33 | 34 | // StreamResponse response from endpoint 35 | type StreamResponse struct { 36 | Stream io.ReadCloser 37 | IsSSEStream bool 38 | } 39 | 40 | func (r *StreamResponse) IsSSE() bool { 41 | return r.IsSSEStream 42 | } 43 | 44 | // NewStreamResponse create response contains a stream 45 | func NewStreamResponse(stream io.ReadCloser, isSSE bool) *StreamResponse { 46 | return &StreamResponse{Stream: stream, IsSSEStream: isSSE} 47 | } 48 | -------------------------------------------------------------------------------- /tools/benchmark/api/samples_api.proto: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | syntax = "proto3"; 19 | package org.apache.dubbogo.samples.api; 20 | 21 | option go_package = "./;api"; 22 | 23 | // The greeting service definition. 24 | service Greeter { 25 | // Sends a greeting 26 | rpc SayHello (HelloRequest) returns (User) {} 27 | // Sends a greeting via stream 28 | rpc SayHelloStream (stream HelloRequest) returns (stream User) {} 29 | } 30 | 31 | // The request message containing the user's name. 32 | message HelloRequest { 33 | string name = 1; 34 | } 35 | 36 | // The response message containing the greetings 37 | message HelloReply { 38 | string message = 1; 39 | } 40 | 41 | // The response message containing the greetings 42 | message User { 43 | string name = 1; 44 | string id = 2; 45 | int32 age = 3; 46 | } -------------------------------------------------------------------------------- /pkg/common/constant/filter.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package constant 19 | 20 | import ( 21 | "time" 22 | ) 23 | 24 | const ( 25 | // nolint 26 | // FileDateFormat 27 | FileDateFormat = "2006-01-02" 28 | // nolint 29 | // MessageDateLayout 30 | MessageDateLayout = "2006-01-02 15:04:05" 31 | // nolint 32 | // LogFileMode 33 | LogFileMode = 0o600 34 | // nolint 35 | // buffer 36 | LogDataBuffer = 5000 37 | // console 38 | Console = "console" 39 | 40 | DefaultReqTimeout = 10 * time.Second 41 | ) 42 | 43 | const ( 44 | // dgp.filter.http.metric 45 | DefaultMetricMode = "push" // Default mode is push 46 | DefaultMetricPushGatewayURL = "http://localhost:9091" 47 | DefaultMetricPushJobName = "pixiu" 48 | DefaultMetricPushInterval = 100 49 | DefaultMetricPushPath = "/metrics" 50 | ) 51 | -------------------------------------------------------------------------------- /.asf.yaml: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one or more 4 | # contributor license agreements. See the NOTICE file distributed with 5 | # this work for additional information regarding copyright ownership. 6 | # The ASF licenses this file to You under the Apache License, Version 2.0 7 | # (the "License"); you may not use this file except in compliance with 8 | # the License. You may obtain a copy of the License at 9 | # 10 | # http://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | github: 20 | protected_branches: ~ 21 | features: 22 | # Enable wiki for documentation 23 | wiki: true 24 | # Enable issue management 25 | issues: true 26 | # Enable projects for project management boards 27 | projects: true 28 | # Enable GitHub Discussions for community discussions 29 | discussions: true 30 | enabled_merge_buttons: 31 | # enable squash button: 32 | squash: true 33 | # enable merge button: 34 | merge: false 35 | # disable rebase button: 36 | rebase: false 37 | 38 | notifications: 39 | commits: commits@dubbo.apache.org 40 | issues: notifications@dubbo.apache.org 41 | pullrequests: notifications@dubbo.apache.org 42 | jira_options: link label link label 43 | discussions: notifications@dubbo.apache.org 44 | -------------------------------------------------------------------------------- /admin/web/src/styles/normalize.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | body, div, ul, ol, dl, dt, dd, li, dl, h1, h2, h3, h4 18 | { 19 | margin:0; 20 | padding:0; 21 | font-style:normal; 22 | font-family: "JetBrains Mono", "PingFang SC", "Microsoft YaHei", Roboto, Arial; 23 | } 24 | 25 | ol, ul ,li{ 26 | list-style: none; 27 | } 28 | img { 29 | border: 0; 30 | vertical-align:middle; 31 | } 32 | body,html{ 33 | height: 100%; 34 | overflow: hidden; 35 | color:#000000; 36 | background:#FFF; 37 | box-sizing: border-box; 38 | font-size:14px; 39 | } 40 | a{ 41 | color:#000000; 42 | text-decoration:none; 43 | } 44 | a:hover{ 45 | color:#BA2636; 46 | text-decoration:underline; 47 | } 48 | button{ 49 | border:none 50 | &:focus{ 51 | outline:none; 52 | } 53 | } 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /pkg/tracing/jaeger/jaeger.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package jaeger 19 | 20 | import ( 21 | "github.com/mitchellh/mapstructure" 22 | 23 | "github.com/pkg/errors" 24 | 25 | "go.opentelemetry.io/otel/exporters/jaeger" 26 | 27 | sdktrace "go.opentelemetry.io/otel/sdk/trace" 28 | ) 29 | 30 | import ( 31 | "github.com/apache/dubbo-go-pixiu/pkg/model" 32 | ) 33 | 34 | type jaegerConfig struct { 35 | Url string `yaml:"url" json:"url" mapstructure:"url"` 36 | } 37 | 38 | func NewJaegerExporter(cfg *model.TracerConfig) (sdktrace.SpanExporter, error) { 39 | var config jaegerConfig 40 | if err := mapstructure.Decode(cfg.Config, &config); err != nil { 41 | return nil, errors.Wrap(err, "config error") 42 | } 43 | exp, err := jaeger.New(jaeger.WithCollectorEndpoint(jaeger.WithEndpoint(config.Url))) 44 | return exp, err 45 | } 46 | -------------------------------------------------------------------------------- /admin/controller/configInfo/configInfo_test.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package configInfo 19 | 20 | import ( 21 | "fmt" 22 | "strings" 23 | "testing" 24 | ) 25 | 26 | func Test_method1(t *testing.T) { 27 | var list1, list2 []string 28 | list1 = append(list1, "a") 29 | list2 = nil 30 | for _, v1 := range list1 { 31 | for _, v := range list2 { 32 | fmt.Println("in side" + v) 33 | //t.Log("inside" + v) 34 | } 35 | fmt.Println(v1) 36 | //t.Log("outside" + v1) 37 | } 38 | } 39 | 40 | func Test_regx_split(t *testing.T) { 41 | txt := "/config/api/resources/1/xxx" 42 | //re := regexp.MustCompile("\\(?<=config\\).+\\(?=resources\\)") 43 | pre := "/config/api/" 44 | //re := regexp.MustCompile("^/resources/1") 45 | split := strings.TrimPrefix(txt, pre) 46 | //split := re.Split(txt,-1) 47 | fmt.Println(split) 48 | } 49 | -------------------------------------------------------------------------------- /controllers/api/v1alpha1/groupversion_info.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | // Package v1alpha1 contains API Schema definitions for the v1alpha1 API group. 19 | // +kubebuilder:object:generate=true 20 | // +groupName=pixiu.apache.org 21 | package v1alpha1 22 | 23 | import ( 24 | "k8s.io/apimachinery/pkg/runtime/schema" 25 | 26 | "sigs.k8s.io/controller-runtime/pkg/scheme" 27 | ) 28 | 29 | var ( 30 | // GroupVersion is group version used to register these objects. 31 | GroupVersion = schema.GroupVersion{Group: "pixiu.apache.org", Version: "v1alpha1"} 32 | 33 | // SchemeBuilder is used to add go types to the GroupVersionKind scheme. 34 | SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion} 35 | 36 | // AddToScheme adds the types in this group-version to the given scheme. 37 | AddToScheme = SchemeBuilder.AddToScheme 38 | ) 39 | -------------------------------------------------------------------------------- /docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # 3 | # Licensed to the Apache Software Foundation (ASF) under one 4 | # or more contributor license agreements. See the NOTICE file 5 | # distributed with this work for additional information 6 | # regarding copyright ownership. The ASF licenses this file 7 | # to you under the Apache License, Version 2.0 (the 8 | # "License"); you may not use this file except in compliance 9 | # with the License. You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, 14 | # software distributed under the License is distributed on an 15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | # KIND, either express or implied. See the License for the 17 | # specific language governing permissions and limitations 18 | # under the License. 19 | # 20 | 21 | set -e 22 | 23 | CONF_DIR="/etc/pixiu" 24 | APP_BIN="/app/dubbo-go-pixiu" 25 | 26 | API_CONF_FILE="$CONF_DIR/api_config.yaml" 27 | LOG_FILE="$CONF_DIR/log.yml" 28 | CONF_FILE="$CONF_DIR/conf.yaml" 29 | 30 | echo "Checking configurations in $CONF_DIR..." 31 | ls -al "$CONF_DIR" 32 | 33 | if [ ! -f "$CONF_FILE" ]; then 34 | echo "Error: Main configuration file not found at $CONF_FILE" 35 | exit 1 36 | fi 37 | 38 | CMD_PARAMS="-c ${CONF_FILE}" 39 | 40 | if [ -f "$API_CONF_FILE" ]; then 41 | CMD_PARAMS="$CMD_PARAMS -a ${API_CONF_FILE}" 42 | fi 43 | 44 | if [ -f "$LOG_FILE" ]; then 45 | CMD_PARAMS="$CMD_PARAMS -g ${LOG_FILE}" 46 | fi 47 | 48 | echo "Starting Pixiu Gateway..." 49 | echo "Binary: $APP_BIN" 50 | echo "Parameters: $CMD_PARAMS" 51 | 52 | exec "$APP_BIN" gateway start $CMD_PARAMS -------------------------------------------------------------------------------- /admin/config/zap.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package config 19 | 20 | type Zap struct { 21 | Level string `mapstructure:"level" json:"level" yaml:"level"` 22 | Format string `mapstructure:"format" json:"format" yaml:"format"` 23 | Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix"` 24 | Director string `mapstructure:"director" json:"director" yaml:"director"` 25 | LinkName string `mapstructure:"link-name" json:"linkName" yaml:"link-name"` 26 | ShowLine bool `mapstructure:"show-line" json:"showLine" yaml:"showLine"` 27 | EncodeLevel string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level"` 28 | StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key"` 29 | LogInConsole bool `mapstructure:"log-in-console" json:"logInConsole" yaml:"log-in-console"` 30 | } 31 | -------------------------------------------------------------------------------- /pkg/client/client.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package client 19 | 20 | // Client represents the interface of http/dubbo clients 21 | type Client interface { 22 | // Apply to init client 23 | Apply() error 24 | 25 | // Close close the client 26 | Close() error 27 | 28 | // Call invoke the downstream service. 29 | Call(req *Request) (res any, err error) 30 | 31 | // MapParams mapping param, uri, query, body ... 32 | MapParams(req *Request) (reqData any, err error) 33 | } 34 | 35 | /** 36 | * the following option is designed to support dubbo pixiu model. you can see 37 | * https://github.com/apache/dubbo-go-pixiu/pixiu/tree/master. 38 | */ 39 | 40 | // MapOption option map, key : name, value : option 41 | type MapOption map[string]RequestOption 42 | 43 | // RequestOption option interface. 44 | type RequestOption interface { 45 | Action(target, val any) error 46 | } 47 | -------------------------------------------------------------------------------- /pkg/filter/sentinel/ratelimit/config.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package ratelimit 19 | 20 | import ( 21 | "github.com/alibaba/sentinel-golang/core/flow" 22 | ) 23 | 24 | import ( 25 | pkgs "github.com/apache/dubbo-go-pixiu/pkg/filter/sentinel" 26 | ) 27 | 28 | type ( 29 | // Config rate limit config 30 | Config struct { 31 | Resources []*pkgs.Resource `json:"resources,omitempty" yaml:"resources,omitempty"` 32 | Rules []*Rule `json:"rules,omitempty" yaml:"rules,omitempty"` 33 | LogPath string `json:"logPath,omitempty" yaml:"logPath,omitempty"` 34 | } 35 | 36 | // Rule api group 's rate-limit rule 37 | Rule struct { 38 | ID int64 `json:"id,omitempty" yaml:"id,omitempty"` 39 | FlowRule flow.Rule `json:"flowRule,omitempty" yaml:"flowRule,omitempty"` 40 | Enable bool `json:"enable,omitempty" yaml:"enable,omitempty"` 41 | } 42 | ) 43 | -------------------------------------------------------------------------------- /pkg/filter/sentinel/regex.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package sentinel 19 | 20 | import ( 21 | "regexp" 22 | "sync" 23 | ) 24 | 25 | type Regex struct { 26 | apiNames map[string]string 27 | 28 | mu sync.RWMutex 29 | } 30 | 31 | func (p *Regex) load(apis []*Resource) { 32 | m := make(map[string]string, len(apis)) 33 | 34 | for _, api := range apis { 35 | apiName := api.Name 36 | for _, item := range api.Items { 37 | if item.MatchStrategy == REGEX { 38 | m[item.Pattern] = apiName 39 | } 40 | } 41 | } 42 | 43 | p.mu.Lock() 44 | defer p.mu.Unlock() 45 | p.apiNames = m 46 | } 47 | 48 | func (p *Regex) match(path string) (string, bool) { 49 | p.mu.RLock() 50 | defer p.mu.RUnlock() 51 | 52 | for k, v := range p.apiNames { 53 | matched, _ := regexp.MatchString(k, path) 54 | if matched { 55 | return v, true 56 | } 57 | } 58 | return "", false 59 | } 60 | -------------------------------------------------------------------------------- /admin/utils/directory.go: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package utils 19 | 20 | import ( 21 | "os" 22 | ) 23 | 24 | import ( 25 | "go.uber.org/zap" 26 | ) 27 | 28 | import ( 29 | "github.com/apache/dubbo-go-pixiu/admin/global" 30 | ) 31 | 32 | func PathExists(path string) (bool, error) { 33 | _, err := os.Stat(path) 34 | if err == nil { 35 | return true, nil 36 | } 37 | if os.IsNotExist(err) { 38 | return false, nil 39 | } 40 | return false, err 41 | } 42 | 43 | func CreateDir(dirs ...string) (err error) { 44 | for _, v := range dirs { 45 | exist, err := PathExists(v) 46 | if err != nil { 47 | return err 48 | } 49 | if !exist { 50 | global.LOG.Debug("create directory" + v) 51 | if err := os.MkdirAll(v, os.ModePerm); err != nil { 52 | global.LOG.Error("create directory"+v, zap.Any(" error:", err)) 53 | return err 54 | } 55 | } 56 | } 57 | return err 58 | } 59 | --------------------------------------------------------------------------------