├── examples ├── config │ ├── k8s │ │ ├── daemonset │ │ │ └── mesher.ds.yaml │ │ └── config_map.yaml │ └── cse │ │ └── conf │ │ ├── auth.yaml │ │ ├── microservice.yaml │ │ ├── mesher.yaml │ │ ├── router.yaml │ │ ├── lager.yaml │ │ └── fault.yaml ├── edge │ └── conf │ │ ├── microservice.yaml │ │ ├── mesher.yaml │ │ └── chassis.yaml ├── quick_start │ ├── mersher_webapp │ │ └── conf │ │ │ ├── auth.yaml │ │ │ ├── microservice.yaml │ │ │ ├── router.yaml │ │ │ ├── egress.yaml │ │ │ ├── lager.yaml │ │ │ ├── mesher.yaml │ │ │ └── fault.yaml │ ├── mersher_calculator │ │ └── conf │ │ │ ├── auth.yaml │ │ │ ├── microservice.yaml │ │ │ ├── router.yaml │ │ │ ├── egress.yaml │ │ │ ├── lager.yaml │ │ │ ├── mesher.yaml │ │ │ └── fault.yaml │ ├── test_balance │ │ └── mersher_calculator │ │ │ └── conf │ │ │ ├── auth.yaml │ │ │ ├── microservice.yaml │ │ │ ├── router.yaml │ │ │ ├── egress.yaml │ │ │ ├── lager.yaml │ │ │ ├── mesher.yaml │ │ │ └── fault.yaml │ └── httpserver_webapp │ │ └── package.json └── disco │ └── service.json ├── docs ├── images │ ├── label.png │ ├── pod.png │ └── mesher.png ├── protocols.rst ├── mesher-sidecar.rst ├── intro.rst ├── get-started.rst ├── istio-guides.rst ├── development │ ├── build.md │ ├── cloud-provider.md │ └── handler-chain.md ├── configuration.rst ├── configurations │ ├── profiling.md │ ├── destination_resolver.md │ ├── admin.md │ ├── cli.md │ └── health.md ├── intro │ ├── what-is.md │ └── concepts.md ├── index.rst ├── README.md ├── development.rst ├── protocols │ └── grpc.md ├── Makefile ├── istio │ ├── discovery.rst │ └── egress.md ├── getstarted │ ├── minimum.md │ └── install.md ├── skywalking │ └── skywalking.md └── make.bat ├── licenses ├── NOTICE-matttproud-golang_protobuf_extensions ├── NOTICE-go-mesh-openlogging ├── NOTICE-gohessian ├── NOTICE-lyft-protoc-gen-validate ├── NOTICE-apache-thrift ├── NOTICE-prometheus-client_model ├── NOTICE-prometheus-common ├── NOTICE-prometheus-procfs ├── NOTICE-gopkg.in-yaml.v2 ├── LICENSE-davecgh-go-spew ├── NOTICE-prometheus-client_golang ├── LICENSE-kr-logfmt ├── LICENSE-go-stack-stack ├── LICENSE-Shopify-sarama ├── LICENSE-alecthomas-units ├── LICENSE-jtolds-gls ├── LICENSE-beorn7-perks ├── LICENSE-honnef.co-go-tools ├── LICENSE-onsi-ginkgo ├── LICENSE-onsi-gomega ├── LICENSE-uber-go-atomic ├── LICENSE-gopkg.in-alecthomas-kingpin.v2 ├── LICENSE-json-iterator-go ├── LICENSE-Shopify-toxiproxy ├── LICENSE-cenkalti-backoff ├── LICENSE-eapache-queue ├── LICENSE-go-kit-kit ├── LICENSE-kisielk-gotool ├── LICENSE-spf13-cast ├── LICENSE-go-logfmt-logfmt ├── LICENSE-go-restful-swagger20 ├── LICENSE-urfave-cli ├── LICENSE-eapache-go-xerial-snappy ├── LICENSE-emicklei-go-restful ├── LICENSE-konsorten-go-windows-terminal-sequences ├── LICENSE-sirupsen-logrus ├── LICENSE-client9-misspell ├── LICENSE-eapache-go-resiliency ├── LICENSE-emicklei-go-restful-swagger12 ├── LICENSE-stretchr-testify ├── LICENSE-patrickmn-go-cache ├── LICENSE-uber-go-ratelimit ├── LICENSE-stretchr-objx ├── LICENSE-hpcloud-tail ├── LICENSE-openzipkin-contrib-zipkin-go-opentracing ├── LICENSE-smartystreets-assertions ├── LICENSE-smartystreets-goconvey ├── LICENSE-gopherjs-gopherjs ├── LICENSE-gorilla-websocket ├── LICENSE-pkg-errors ├── LICENSE-gopkg.in-check.v1 ├── LICENSE-pmezard-go-difflib ├── LICENSE-julienschmidt-httprouter ├── LICENSE-golang-lint ├── LICENSE-golang-net ├── LICENSE-golang-sync ├── LICENSE-golang-sys ├── LICENSE-golang-text ├── LICENSE-golang-time ├── LICENSE-golang-tools ├── LICENSE-pierrec-lz4 ├── LICENSE-golang-crypto ├── LICENSE-golang-oauth2 ├── LICENSE-golang-protobuf ├── LICENSE-alecthomas-template ├── LICENSE-golang-snappy ├── LICENSE-go-inf-inf ├── LICENSE-rcrowley-go-metrics ├── LICENSE-fsnotify ├── LICENSE-spf13-pflag ├── LICENSE-imdario-mergo ├── LICENSE-DataDog-zstd ├── LICENSE-gopkg.in-tomb.v1 └── LICENSE-gogo-protobuf ├── conf ├── auth.yaml ├── microservice.yaml ├── lager.yaml ├── mesher.yaml └── fault.yaml ├── NOTICE ├── .github └── workflows │ ├── golangci-lint.yml │ └── static_check.yml ├── Jenkinsfile ├── .gitignore ├── docker └── edge │ ├── microservice.yaml │ ├── lager.yaml │ ├── Dockerfile │ └── mesher.yaml ├── start.bat ├── scripts ├── travis │ ├── unit_test.sh │ ├── misspellChecker.sh │ ├── goConstChecker.sh │ ├── deadCodeChecker.sh │ ├── goLintChecker.sh │ ├── formatChecker.sh │ ├── goCycloChecker.sh │ └── goSecureChecker.sh └── ci │ └── build_image.sh ├── proxy ├── pkg │ ├── runtime │ │ └── runtime.go │ ├── metrics │ │ └── prom_recorder_test.go │ ├── ports │ │ ├── protocol_test.go │ │ └── protocol.go │ └── egress │ │ └── egress_config_test.go ├── resource │ └── v1 │ │ ├── version │ │ └── version_test.go │ │ ├── health │ │ ├── instances.go │ │ ├── response.go │ │ └── mockRegistry_test.go │ │ ├── init.go │ │ └── route │ │ └── route.go ├── protocol │ ├── errors_test.go │ ├── dubbo │ │ ├── dubbo │ │ │ ├── respond_test.go │ │ │ └── context.go │ │ ├── simpleRegistry │ │ │ └── regstry_common.go │ │ ├── schema │ │ │ └── cache_test.go │ │ └── utils │ │ │ ├── bytes_test.go │ │ │ └── thrmgr_test.go │ └── errors.go ├── control │ ├── struct.go │ └── panel.go ├── handler │ └── oauth2 │ │ └── api.go ├── config │ ├── egress.go │ └── struct_ingress_test.go ├── resolver │ ├── source.go │ └── authority │ │ └── destination.go ├── util │ └── util.go ├── ingress │ └── ingress.go └── common │ └── common.go ├── deployments └── docker │ └── db.js ├── go.mod └── cmd └── mesher └── mesher.go /examples/config/k8s/daemonset/mesher.ds.yaml: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/images/label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/servicecomb-mesher/HEAD/docs/images/label.png -------------------------------------------------------------------------------- /docs/images/pod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/servicecomb-mesher/HEAD/docs/images/pod.png -------------------------------------------------------------------------------- /docs/images/mesher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/apache/servicecomb-mesher/HEAD/docs/images/mesher.png -------------------------------------------------------------------------------- /licenses/NOTICE-matttproud-golang_protobuf_extensions: -------------------------------------------------------------------------------- 1 | Copyright 2012 Matt T. Proud (matt.proud@gmail.com) -------------------------------------------------------------------------------- /examples/edge/conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | servicecomb: 2 | service: 3 | name: mesher-edge 4 | version: 1.7.0 5 | -------------------------------------------------------------------------------- /licenses/NOTICE-go-mesh-openlogging: -------------------------------------------------------------------------------- 1 | mesher 2 | Copyright 2018-present, Huawei 3 | 4 | This product includes software developed at 5 | Huawei. -------------------------------------------------------------------------------- /docs/protocols.rst: -------------------------------------------------------------------------------- 1 | Protocols 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | protocols/grpc 9 | -------------------------------------------------------------------------------- /docs/mesher-sidecar.rst: -------------------------------------------------------------------------------- 1 | Sidecar usage guide 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | sidecar 9 | -------------------------------------------------------------------------------- /licenses/NOTICE-gohessian: -------------------------------------------------------------------------------- 1 | Viant, inc. gohessian 2 | Copyright 2012-2016 Viant 3 | 4 | This product includes software developed at 5 | Viant (http://viantinc.com/) -------------------------------------------------------------------------------- /licenses/NOTICE-lyft-protoc-gen-validate: -------------------------------------------------------------------------------- 1 | protoc-gen-validate 2 | Copyright 2019 Envoy Project Authors 3 | 4 | Licensed under Apache License 2.0. See LICENSE for terms. -------------------------------------------------------------------------------- /docs/intro.rst: -------------------------------------------------------------------------------- 1 | Introductions 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | intro/what-is 9 | intro/concepts 10 | 11 | -------------------------------------------------------------------------------- /conf/auth.yaml: -------------------------------------------------------------------------------- 1 | ## Huawei Public Cloud ak/sk 2 | cse: 3 | credentials: 4 | accessKey: 5 | secretKey: 6 | project: 7 | akskCustomCipher: default #used to decrypt sk when it is encrypted 8 | -------------------------------------------------------------------------------- /licenses/NOTICE-apache-thrift: -------------------------------------------------------------------------------- 1 | Apache Thrift 2 | Copyright (C) 2006 - 2019, The Apache Software Foundation 3 | 4 | This product includes software developed at 5 | The Apache Software Foundation (http://www.apache.org/). -------------------------------------------------------------------------------- /licenses/NOTICE-prometheus-client_model: -------------------------------------------------------------------------------- 1 | Data model artifacts for Prometheus. 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). -------------------------------------------------------------------------------- /examples/config/cse/conf/auth.yaml: -------------------------------------------------------------------------------- 1 | ## Huawei Public Cloud ak/sk 2 | cse: 3 | credentials: 4 | accessKey: 5 | secretKey: 6 | project: 7 | akskCustomCipher: default #used to decrypt sk when it is encrypted 8 | -------------------------------------------------------------------------------- /licenses/NOTICE-prometheus-common: -------------------------------------------------------------------------------- 1 | Common libraries shared by Prometheus Go components. 2 | Copyright 2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). -------------------------------------------------------------------------------- /docs/get-started.rst: -------------------------------------------------------------------------------- 1 | Get started 2 | ====================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | getstarted/minimum 9 | getstarted/install.md 10 | getstarted/pilot-discovery.md 11 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/auth.yaml: -------------------------------------------------------------------------------- 1 | ## Huawei Public Cloud ak/sk 2 | cse: 3 | credentials: 4 | accessKey: 5 | secretKey: 6 | project: 7 | akskCustomCipher: default #used to decrypt sk when it is encrypted 8 | -------------------------------------------------------------------------------- /docs/istio-guides.rst: -------------------------------------------------------------------------------- 1 | Use Istio as control plane 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | istio/getstarted 9 | istio/discovery 10 | istio/router 11 | istio/egress 12 | 13 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/auth.yaml: -------------------------------------------------------------------------------- 1 | ## Huawei Public Cloud ak/sk 2 | cse: 3 | credentials: 4 | accessKey: 5 | secretKey: 6 | project: 7 | akskCustomCipher: default #used to decrypt sk when it is encrypted 8 | -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/auth.yaml: -------------------------------------------------------------------------------- 1 | ## Huawei Public Cloud ak/sk 2 | cse: 3 | credentials: 4 | accessKey: 5 | secretKey: 6 | project: 7 | akskCustomCipher: default #used to decrypt sk when it is encrypted 8 | -------------------------------------------------------------------------------- /conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | ## microservice property 2 | servicecomb: 3 | service: 4 | name: hellomesher 5 | version: 0.0.1 6 | environment: #microservice environment 7 | properties: 8 | allowCrossApp: false #whether to allow calls across applications 9 | -------------------------------------------------------------------------------- /licenses/NOTICE-prometheus-procfs: -------------------------------------------------------------------------------- 1 | procfs provides functions to retrieve system, kernel and process 2 | metrics from the pseudo-filesystem proc. 3 | 4 | Copyright 2014-2015 The Prometheus Authors 5 | 6 | This product includes software developed at 7 | SoundCloud Ltd. (http://soundcloud.com/). -------------------------------------------------------------------------------- /docs/development/build.md: -------------------------------------------------------------------------------- 1 | # Build mesher 2 | You need to build and release your mesher after customization. 3 | 4 | ### Build binary 5 | You can refer to build/build_proxy to see how we build mesher binary and docker image. 6 | 7 | build/docker/proxy/Dockerfile is a example about making a docker image -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | ## microservice property 2 | servicecomb: 3 | service: 4 | name: webapp 5 | version: 0.0.1 6 | environment: #microservice environment 7 | properties: 8 | allowCrossApp: true #whether to allow calls across applications 9 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | ## microservice property 2 | servicecomb: 3 | service: 4 | name: calculator 5 | version: 1.1.1 6 | environment: #microservice environment 7 | properties: 8 | allowCrossApp: true #whether to allow calls across applications 9 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | mesher 2 | Copyright 2018-2019, Huawei 3 | 4 | This product includes software developed at 5 | Huawei. 6 | 7 | Apache ServiceComb Mesher 8 | Copyright 2019-2019 The Apache Software Foundation 9 | 10 | This product includes software developed at 11 | The Apache Software Foundation (http://www.apache.org/). -------------------------------------------------------------------------------- /docs/configuration.rst: -------------------------------------------------------------------------------- 1 | User guides 2 | ========================= 3 | 4 | .. toctree:: 5 | :maxdepth: 4 6 | :glob: 7 | 8 | configurations/cli 9 | configurations/profiling 10 | configurations/admin 11 | configurations/health 12 | configurations/destination_resolver 13 | configurations/edge 14 | -------------------------------------------------------------------------------- /examples/config/cse/conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | ## microservice property 2 | servicecomb: 3 | service: 4 | app: mesher 5 | name: hellomesher 6 | version: 0.0.1 7 | environment: #microservice environment 8 | properties: 9 | allowCrossApp: false #whether to allow calls across applications 10 | -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/microservice.yaml: -------------------------------------------------------------------------------- 1 | ## microservice property 2 | servicecomb: 3 | service: 4 | name: calculator 5 | version: 1.1.1 6 | environment: #microservice environment 7 | properties: 8 | allowCrossApp: true #whether to allow calls across applications 9 | -------------------------------------------------------------------------------- /examples/config/cse/conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: host # how to turn host to destination name. default to service name, 4 | #admin: #admin API 5 | # goRuntimeMetrics : true # enable metrics 6 | ## enable pprof to profile mesher runtime 7 | #pprof: 8 | # enable: false -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/router.yaml: -------------------------------------------------------------------------------- 1 | #routeRule: 2 | # calculator: #service name 3 | # - precedence: 2 #precedence of route rule 4 | # route: #route rule list 5 | # - tags: 6 | # version: 1.1.1 7 | # weight: 70 #weight of 20% 8 | # - tags: 9 | # version: 1.1.2 10 | # weight: 30 #weight of 20% -------------------------------------------------------------------------------- /examples/disco/service.json: -------------------------------------------------------------------------------- 1 | { 2 | "service": [{ 3 | "name": "hellomesher", 4 | "Instance": ["rest://127.0.0.1:9999"] 5 | }, 6 | 7 | { 8 | "name": "localserver1", 9 | "Instance": ["rest://10.162.247.188:30101"] 10 | } 11 | 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /examples/quick_start/httpserver_webapp/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "httpserver_webapp", 3 | "version": "1.0.0", 4 | "description": "webapp server", 5 | "main": "httpserver_webapp.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "servicecomb", 10 | "license": "Apache-2.0", 11 | "dependencies": { 12 | "request": "^2.88.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /examples/config/cse/conf/router.yaml: -------------------------------------------------------------------------------- 1 | #routeRule: 2 | # ShoppingCart: #service name 3 | # - precedence: 2 #priority of route rule 4 | # route: #route rule list 5 | # - tags: 6 | # version: 0.2 7 | # app: HelloWorld 8 | # weight: 80 #weight of 80% 9 | # - tags: 10 | # version: 1.2 11 | # app: HelloWorld 12 | # weight: 20 #weight of 20% -------------------------------------------------------------------------------- /.github/workflows/golangci-lint.yml: -------------------------------------------------------------------------------- 1 | name: golangci-lint 2 | on: [push, pull_request] 3 | jobs: 4 | golangci: 5 | name: lint 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: golangci-lint 10 | uses: golangci/golangci-lint-action@v2 11 | with: 12 | version: v1.37.1 13 | args: --skip-dirs=examples,proxy/protocol/dubbo --skip-files=.*_test.go$ 14 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent any 3 | 4 | stages { 5 | stage('Build proxy') { 6 | steps { 7 | echo 'Making Package' 8 | sh 'bash -x ci/build.sh' 9 | } 10 | } 11 | stage('Create proxy image') { 12 | steps { 13 | echo 'Building Docker Image' 14 | sh 'bash -x ci/build_image.sh' 15 | } 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/router.yaml: -------------------------------------------------------------------------------- 1 | #routeRule: 2 | # ShoppingCart: #service name 3 | # - precedence: 2 #precedence of route rule 4 | # route: #route rule list 5 | # - tags: 6 | # version: 0.2 7 | # app: HelloWorld 8 | # weight: 80 #weight of 80% 9 | # - tags: 10 | # version: 1.2 11 | # app: HelloWorld 12 | # weight: 20 #weight of 20% -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/router.yaml: -------------------------------------------------------------------------------- 1 | #routeRule: 2 | # ShoppingCart: #service name 3 | # - precedence: 2 #precedence of route rule 4 | # route: #route rule list 5 | # - tags: 6 | # version: 0.2 7 | # app: HelloWorld 8 | # weight: 80 #weight of 80% 9 | # - tags: 10 | # version: 1.2 11 | # app: HelloWorld 12 | # weight: 20 #weight of 20% -------------------------------------------------------------------------------- /docs/configurations/profiling.md: -------------------------------------------------------------------------------- 1 | # Profile Mesher 2 | 3 | Mesher has a convenience way to enable go [pprof]( https://golang.org/pkg/net/http/pprof/ ), so that you can easily analyze the performance of mesher. 4 | 5 | ## Configurations 6 | 7 | ```yaml 8 | pprof: 9 | enable: true 10 | listen: 127.0.0.0.1:6060 11 | ``` 12 | 13 | **enable** 14 | >*(optional, bool)* Default is false 15 | 16 | 17 | **listen** 18 | 19 | >*(optional, string)* Listen IP and port 20 | 21 | -------------------------------------------------------------------------------- /examples/config/k8s/config_map.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: mesher-config 5 | data: 6 | registry.addr: 127.0.0.1:30100 7 | registry.ssl: false 8 | configCenter.addr: 127.0.0.1:30200 9 | handlers: bizkeeper-consumer,loadbalance 10 | mesher.yaml: |- 11 | policy: 12 | - destination: reviews.default.svc.cluster.local 13 | tags: 14 | version: v1 15 | loadBalancing: 16 | strategy: roundrobin -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/egress.yaml: -------------------------------------------------------------------------------- 1 | #egress: 2 | # infra: cse # pilot or cse 3 | # address: http://istio-pilot.istio-system:15010 4 | #egressRule: 5 | # google-ext: 6 | # - hosts: 7 | # - "google.com" 8 | # - "*.yahoo.com" 9 | # ports: 10 | # - port: 80 11 | # protocol: HTTP 12 | # facebook-ext: 13 | # - hosts: 14 | # - "www.facebook.com" 15 | # ports: 16 | # - port: 80 17 | # protocol: HTTP 18 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/egress.yaml: -------------------------------------------------------------------------------- 1 | #egress: 2 | # infra: cse # pilot or cse 3 | # address: http://istio-pilot.istio-system:15010 4 | #egressRule: 5 | # google-ext: 6 | # - hosts: 7 | # - "google.com" 8 | # - "*.yahoo.com" 9 | # ports: 10 | # - port: 80 11 | # protocol: HTTP 12 | # facebook-ext: 13 | # - hosts: 14 | # - "www.facebook.com" 15 | # ports: 16 | # - port: 80 17 | # protocol: HTTP 18 | -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/egress.yaml: -------------------------------------------------------------------------------- 1 | #egress: 2 | # infra: cse # pilot or cse 3 | # address: http://istio-pilot.istio-system:15010 4 | #egressRule: 5 | # google-ext: 6 | # - hosts: 7 | # - "google.com" 8 | # - "*.yahoo.com" 9 | # ports: 10 | # - port: 80 11 | # protocol: HTTP 12 | # facebook-ext: 13 | # - hosts: 14 | # - "www.facebook.com" 15 | # ports: 16 | # - port: 80 17 | # protocol: HTTP 18 | -------------------------------------------------------------------------------- /docs/intro/what-is.md: -------------------------------------------------------------------------------- 1 | # What is mesher 2 | 3 | Mesher is a 4 | [service mesh](https://blog.buoyant.io/2017/04/25/whats-a-service-mesh-and-why-do-i-need-one/) 5 | implementation based on [go chassis](https://github.com/go-chassis/go-chassis). 6 | So it has all the [features](http://go-chassis.readthedocs.io/en/latest/intro/features.html) 7 | of go chassis like service discovery, 8 | load balancing, fault tolerance, route management,distributed tracing etc. 9 | it makes your service become resilient and observable. 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Go template 3 | # Binaries for programs and plugins 4 | *.exe 5 | *.exe~ 6 | *.dll 7 | *.so 8 | *.dylib 9 | 10 | # Test binary, build with `go test -c` 11 | *.test 12 | 13 | # Output of the go coverage tool, specifically when used with LiteIDE 14 | *.out 15 | ### Example user template template 16 | ### Example user template 17 | 18 | # IntelliJ project files 19 | .idea 20 | *.iml 21 | out 22 | gen 23 | .log 24 | 25 | vendor 26 | *.log 27 | 28 | _build 29 | coverage.txt 30 | release -------------------------------------------------------------------------------- /.github/workflows/static_check.yml: -------------------------------------------------------------------------------- 1 | name: Merge check 2 | on: [push, pull_request] 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - name: Set up Go 1.13 8 | uses: actions/setup-go@v1 9 | with: 10 | go-version: 1.13 11 | id: go 12 | 13 | - name: Check out code into the Go module directory 14 | uses: actions/checkout@v1 15 | 16 | - name: Build 17 | run: go build github.com/apache/servicecomb-mesher/cmd/mesher 18 | 19 | - name: UT 20 | run: | 21 | bash -x scripts/travis/unit_test.sh -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. go-chassis documentation master file, created by 2 | sphinx-quickstart on Fri Apr 13 17:13:49 2018. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to Mesher's documentation! 7 | ====================================== 8 | .. toctree:: 9 | :maxdepth: 4 10 | :caption: User Documentations 11 | :glob: 12 | 13 | intro 14 | get-started 15 | configuration 16 | development 17 | protocols 18 | istio-guides 19 | sidecar 20 | 21 | 22 | -------------------------------------------------------------------------------- /docs/configurations/destination_resolver.md: -------------------------------------------------------------------------------- 1 | # Destination Resolver 2 | 3 | Destination Resolver is a module to parse each protocol request to get a target service name. 4 | You can write your own resolver implementation for different protocols. 5 | 6 | ## Configurations 7 | 8 | Example: 9 | ```yaml 10 | plugin: 11 | destinationResolver: 12 | http: host # host is a build-in and default resolver, it uses host name as service name 13 | grpc: ip 14 | ``` 15 | 16 | 17 | 18 | **plugin.destinationResolver** 19 | 20 | >*(optional, map)* Define what kind of resolver, a protocol should use 21 | 22 | -------------------------------------------------------------------------------- /docs/configurations/admin.md: -------------------------------------------------------------------------------- 1 | # Admin API 2 | 3 | ### Configurations 4 | 5 | Admin API server leverages protocol server, it listens on isolated port. By default admin is enabled, and default value of goRuntimeMetrics is false. 6 | 7 | To start API server, set protocol server config in chassis.yaml: 8 | ```yaml 9 | cse: 10 | protocols: 11 | rest-admin: 12 | listenAddress: 0.0.0.0:30102 # listen addr for admin API 13 | ``` 14 | 15 | Tune admin api in mesher.yaml: 16 | ```yaml 17 | admin: 18 | enable: true 19 | ``` 20 | 21 | 22 | **admin.enable** 23 | >*(optional, bool)* Default is false 24 | 25 | 26 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # How to write doc in local 2 | 3 | ## Prepare 4 | 1. Install Python 2.7 with zlib, libssl-dev(openssl-devel) 5 | 1. Install pip 6 | 1. Install readthe doc support https://docs.readthedocs.io/en/latest/getting_started.html 7 | 1. Install RTD module 8 | ```shell 9 | sudo pip install sphinx_rtd_theme 10 | ``` 11 | 12 | ## Generate doc 13 | 14 | In windows 15 | ```shell 16 | cd docs 17 | make.bat html 18 | ``` 19 | 20 | In linux 21 | ```shell 22 | cd docs 23 | sphinx-autobuild . _build/html 24 | ``` 25 | 26 | ## Check the result 27 | 28 | 1. See html pages in _build folder 29 | 1. Access http://127.0.0.1:8000 30 | -------------------------------------------------------------------------------- /licenses/NOTICE-gopkg.in-yaml.v2: -------------------------------------------------------------------------------- 1 | Copyright 2011-2016 Canonical Ltd. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /docs/development.rst: -------------------------------------------------------------------------------- 1 | Development guides 2 | ========================= 3 | mesher is an out of box service mesh and API gateway component, 4 | you can use them by simply setting configuration files. 5 | But some of user still need to customize a service mesh or API gateway. 6 | For example: 7 | 8 | - API gateway need to query account system and do the authentication and authorization. 9 | - mesher need to access cloud provider API 10 | - mesher use customized control panel 11 | - mesher use customized config server 12 | 13 | 14 | .. toctree:: 15 | :maxdepth: 4 16 | :glob: 17 | 18 | development/handler-chain 19 | development/cloud-provider 20 | development/build 21 | -------------------------------------------------------------------------------- /docs/protocols/grpc.md: -------------------------------------------------------------------------------- 1 | # gRPC Protocol 2 | 3 | Mesher support gRPC protocol 4 | 5 | ### Configurations 6 | To enable gRPC proxy you must set the protocol config 7 | ```yaml 8 | cse: 9 | protocols: 10 | grpc: 11 | listenAddress: 127.0.0.1:40101 # or internalIP:port 12 | ``` 13 | 14 | ### How to use mesher as sidecar proxy 15 | Assume you original client is 16 | ```go 17 | conn, err := grpc.Dial("10.0.1.1:50051", 18 | grpc.WithInsecure(), 19 | ) 20 | ``` 21 | Set http_proxy: 22 | ```bash 23 | export http_proxy=http://127.0.0.1:40100 24 | ``` 25 | 26 | 27 | ## Example 28 | A gRPC example is [here](https://github.com/go-mesh/mesher-examples/tree/master/protocol/grpc-go) 29 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = go-chassis 8 | SOURCEDIR = . 9 | BUILDDIR = _build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /examples/config/cse/conf/lager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | writers: file,stdout 3 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 4 | logger_level: INFO 5 | 6 | # LoggerFile: used to output the name of log 7 | logger_file: log/mesher.log 8 | 9 | # LogFormatText: json/plaintext (such as log4j),default to false 10 | # if set logger_file and log_format_text to true, turns out log4j format log 11 | log_format_text: true 12 | 13 | #rollingPolicy daily/size; defines rotate according to daily or size 14 | rollingPolicy: size 15 | 16 | # MaxDaily of a log file before rotate. By D Days. 17 | log_rotate_date: 1 18 | 19 | # MaxSize of a log file before rotate. By M Bytes. 20 | log_rotate_size: 10 21 | 22 | # Max counts to keep of a log's backup files. 23 | log_backup_count: 7 -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/lager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | writers: file,stdout 3 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 4 | logger_level: DEBUG 5 | 6 | # LoggerFile: used to output the name of log 7 | logger_file: log/mesher.log 8 | 9 | # LogFormatText: json/plaintext (such as log4j),default to false 10 | # if set logger_file and log_format_text to true, turns out log4j format log 11 | log_format_text: false 12 | 13 | #rollingPolicy daily/size; defines rotate according to daily or size 14 | rollingPolicy: size 15 | 16 | # MaxDaily of a log file before rotate. By D Days. 17 | log_rotate_date: 1 18 | 19 | # MaxSize of a log file before rotate. By M Bytes. 20 | log_rotate_size: 10 21 | 22 | # Max counts to keep of a log's backup files. 23 | log_backup_count: 7 -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/lager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | writers: file,stdout 3 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 4 | logger_level: DEBUG 5 | 6 | # LoggerFile: used to output the name of log 7 | logger_file: log/mesher.log 8 | 9 | # LogFormatText: json/plaintext (such as log4j),default to false 10 | # if set logger_file and log_format_text to true, turns out log4j format log 11 | log_format_text: false 12 | 13 | #rollingPolicy daily/size; defines rotate according to daily or size 14 | rollingPolicy: size 15 | 16 | # MaxDaily of a log file before rotate. By D Days. 17 | log_rotate_date: 1 18 | 19 | # MaxSize of a log file before rotate. By M Bytes. 20 | log_rotate_size: 10 21 | 22 | # Max counts to keep of a log's backup files. 23 | log_backup_count: 7 -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: 4 | # http: host # how to turn host to destination name. default to service name, 5 | 6 | admin: #admin API 7 | goRuntimeMetrics : true # enable metrics 8 | enable: true 9 | 10 | ## enable pprof to profile mesher runtime 11 | #pprof: 12 | # enable: false 13 | 14 | 15 | # this health check will ping local service port to check if service is still alive, if service can not reachable, mesher 16 | # will update status to OUT_OF_SERVICE in service center 17 | #localHealthCheck: 18 | # - port: 8080 19 | # uri: /health 20 | # interval: 30s 21 | # match: 22 | # status: 200 23 | # body: ok 24 | -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: 4 | # http: host # how to turn host to destination name. default to service name, 5 | 6 | admin: #admin API 7 | goRuntimeMetrics : true # enable metrics 8 | enable: true 9 | 10 | ## enable pprof to profile mesher runtime 11 | #pprof: 12 | # enable: false 13 | 14 | 15 | # this health check will ping local service port to check if service is still alive, if service can not reachable, mesher 16 | # will update status to OUT_OF_SERVICE in service center 17 | #localHealthCheck: 18 | # - port: 8080 19 | # uri: /health 20 | # interval: 30s 21 | # match: 22 | # status: 200 23 | # body: ok 24 | -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/lager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | writers: file,stdout 3 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 4 | logger_level: DEBUG 5 | 6 | # LoggerFile: used to output the name of log 7 | logger_file: log/mesher.log 8 | 9 | # LogFormatText: json/plaintext (such as log4j),default to false 10 | # if set logger_file and log_format_text to true, turns out log4j format log 11 | log_format_text: false 12 | 13 | #rollingPolicy daily/size; defines rotate according to daily or size 14 | rollingPolicy: size 15 | 16 | # MaxDaily of a log file before rotate. By D Days. 17 | log_rotate_date: 1 18 | 19 | # MaxSize of a log file before rotate. By M Bytes. 20 | log_rotate_size: 10 21 | 22 | # Max counts to keep of a log's backup files. 23 | log_backup_count: 7 -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: 4 | # http: host # how to turn host to destination name. default to service name, 5 | 6 | admin: #admin API 7 | goRuntimeMetrics : true # enable metrics 8 | enable: true 9 | 10 | ## enable pprof to profile mesher runtime 11 | #pprof: 12 | # enable: false 13 | 14 | 15 | # this health check will ping local service port to check if service is still alive, if service can not reachable, mesher 16 | # will update status to OUT_OF_SERVICE in service center 17 | #localHealthCheck: 18 | # - port: 8080 19 | # uri: /health 20 | # interval: 30s 21 | # match: 22 | # status: 200 23 | # body: ok 24 | -------------------------------------------------------------------------------- /conf/lager.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | writers: file,stdout 3 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 4 | logLevel: DEBUG 5 | 6 | # LoggerFile: used to output the name of log 7 | logFile: log/mesher.log 8 | 9 | # LogFormatText: json/plaintext (such as log4j),default to false 10 | # if set logger_file and log_format_text to true, turns out log4j format log 11 | logFormatText: false 12 | 13 | # MaxDaily of a log file before rotate. By D Days. 14 | logRotateAge: 1 15 | 16 | # MaxSize of a log file before rotate. By M Bytes. 17 | logRotateSize: 10 18 | 19 | # Max counts to keep of a log's backup files. 20 | logBackupCount: 7 21 | 22 | # Log color mode 23 | # auto: only print colorful log when writer is stdout; 24 | # never: never print colorful log; 25 | # always: always print colorful log; 26 | # default: auto 27 | logColorMode: auto 28 | -------------------------------------------------------------------------------- /conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: 4 | # http: host # how to turn host to destination name. default to service name, 5 | 6 | admin: #admin API 7 | goRuntimeMetrics : true # enable metrics 8 | enable: true 9 | 10 | ## enable pprof to profile mesher runtime 11 | #pprof: 12 | # enable: false 13 | 14 | 15 | # this health check will ping local service port to check if service is still alive, if service can not reachable, mesher 16 | # will update status to OUT_OF_SERVICE in service center 17 | #localHealthCheck: 18 | # - port: 8080 19 | # uri: /health 20 | # interval: 30s 21 | # match: 22 | # status: 200 23 | # body: ok 24 | #servicecomb: 25 | # apm: 26 | # tracing: 27 | # enable: true 28 | # serverUri: 127.0.0.1:11800 -------------------------------------------------------------------------------- /licenses/LICENSE-davecgh-go-spew: -------------------------------------------------------------------------------- 1 | ISC License 2 | 3 | Copyright (c) 2012-2016 Dave Collins 4 | 5 | Permission to use, copy, modify, and/or distribute this software for any 6 | purpose with or without fee is hereby granted, provided that the above 7 | copyright notice and this permission notice appear in all copies. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 | WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 | MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 | ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 | ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 | OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /docs/intro/concepts.md: -------------------------------------------------------------------------------- 1 | # Concepts 2 | 3 | ### Sidecar 4 | Mesher leverages 5 | [distributed design pattern, sidecar](https://kubernetes.io/blog/2015/06/the-distributed-system-toolkit-patterns/) 6 | to work along with service. 7 | 8 | ### go chassis 9 | Mesher is a light weight sidecar proxy developed on top of go-chassis, 10 | so it has the same [concepts](http://go-chassis.readthedocs.io/en/latest/intro/concepts.html) with it 11 | and it has all features of go chassis 12 | 13 | ### Destination Resolver 14 | 15 | Destination Resolver parses request into a service name 16 | 17 | ### Source Resolver 18 | 19 | Source resolver gets remote IP and based on remote IP, it provides a standard way for the applications to create media sources. 20 | 21 | ### Admin API 22 | 23 | Admin API listens on isolated port, it gives a way to interact with mesher 24 | 25 | -------------------------------------------------------------------------------- /docker/edge/microservice.yaml: -------------------------------------------------------------------------------- 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 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | servicecomb: 17 | service: 18 | name: mesher-edge 19 | version: 1.7.0 20 | -------------------------------------------------------------------------------- /start.bat: -------------------------------------------------------------------------------- 1 | @echo off 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 | SET SPECIFIC_ADDR=127.0.0.1:3000 17 | start /B /WAIT mesher.exe 18 | pause 19 | -------------------------------------------------------------------------------- /licenses/NOTICE-prometheus-client_golang: -------------------------------------------------------------------------------- 1 | Prometheus instrumentation library for Go applications 2 | Copyright 2012-2015 The Prometheus Authors 3 | 4 | This product includes software developed at 5 | SoundCloud Ltd. (http://soundcloud.com/). 6 | 7 | 8 | The following components are included in this product: 9 | 10 | perks - a fork of https://github.com/bmizerany/perks 11 | https://github.com/beorn7/perks 12 | Copyright 2013-2015 Blake Mizerany, Björn Rabenstein 13 | See https://github.com/beorn7/perks/blob/master/README.md for license details. 14 | 15 | Go support for Protocol Buffers - Google's data interchange format 16 | http://github.com/golang/protobuf/ 17 | Copyright 2010 The Go Authors 18 | See source code for license details. 19 | 20 | Support for streaming Protocol Buffer messages for the Go language (golang). 21 | https://github.com/matttproud/golang_protobuf_extensions 22 | Copyright 2013 Matt T. Proud 23 | Licensed under the Apache License, Version 2.0 -------------------------------------------------------------------------------- /scripts/travis/unit_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 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 | set -e 19 | 20 | go test $(go list ./... | grep -v proxy/pkg/egress | grep -v examples) -cover -covermode atomic -coverprofile coverage.out -------------------------------------------------------------------------------- /proxy/pkg/runtime/runtime.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 runtime 19 | 20 | var ( 21 | //Role is of type string which gives mode of mesher deployment 22 | Role string 23 | ) 24 | -------------------------------------------------------------------------------- /docs/configurations/cli.md: -------------------------------------------------------------------------------- 1 | # Mesher command Line 2 | When you start a mesher process, you can use mesher command line to specify configurations as follows: 3 | ```shell 4 | mesher --config=mesher.yaml --service-ports=rest:8080 5 | ``` 6 | 7 | 8 | ### Options 9 | 10 | **--config** 11 | 12 | >*(optional, string)* The path to mesher configuration file, default value is {current_bin_work_dir}/conf/mesher.yaml 13 | 14 | **--mode** 15 | 16 | >*(optional, string)* Mesher has 2 work modes, sidecar and edge, default is sidecar 17 | 18 | **--service-ports** 19 | 20 | >*(optional, string)* Running as sidecar, mesher needs to know local service ports, 21 | this is to tell mesher service port list, 22 | The value format is {protocol}-{suffix} or {protocol}. 23 | If service has multiple protocols, you can separate with comma "rest-admin:8080, grpc:9000", 24 | default is empty. In that case mesher will use header X-Forwarded-Port as local service port, 25 | if header X-Forwarded-Port is also empty, mesher can not communicate to your local service. 26 | -------------------------------------------------------------------------------- /licenses/LICENSE-kr-logfmt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Keith Rarick, Blake Mizerany 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /scripts/travis/misspellChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(find . -name "*.go" -print0 | xargs -0 misspell) 18 | if [ $? == 0 ]; then 19 | echo "No Misspell found" 20 | exit 0 21 | else 22 | echo "Misspell found" 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /docs/istio/discovery.rst: -------------------------------------------------------------------------------- 1 | Discovery 2 | ====================== 3 | 4 | ---- 5 | 6 | Introduction 7 | ++++ 8 | 9 | Istio Pilot can be integrated with Mesher, working as the Service Discovery component. 10 | 11 | Configuration 12 | ++++ 13 | 14 | edit chassis.yaml. 15 | 16 | **registrator.disabled** 17 | 18 | Must disable registrator, because registrator is is used in client side discovery. mesher leverage server side discovery which is supported by kubernetes 19 | 20 | **serviceDiscovery.type** 21 | 22 | specify the discovery plugin type to "pilotv2", since Istio removes the xDS v1 API support from version 0.7.1, type "pilot" is deprecated. 23 | 24 | **serviceDiscovery.address** 25 | 26 | the pilot address, in a typical Istio environment, pilot usually listens on the grpc port 15010. 27 | 28 | 29 | examples 30 | ++++ 31 | 32 | :: 33 | 34 | cse: # Using xDS v2 API 35 | service: 36 | Registry: 37 | registrator: 38 | disabled: true 39 | serviceDiscovery: 40 | type: pilotv2 41 | address: grpc://istio-pilot.istio-system:15010 42 | -------------------------------------------------------------------------------- /scripts/travis/goConstChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(find . -name "*.go" -print0 | xargs --null goconst) 18 | if [ $? == 0 ]; then 19 | echo "No goConst problem" 20 | exit 0 21 | else 22 | echo "Has goConst Problem" 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /licenses/LICENSE-go-stack-stack: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Chris Hines 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /proxy/resource/v1/version/version_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 version 19 | 20 | import ( 21 | "github.com/stretchr/testify/assert" 22 | "testing" 23 | ) 24 | 25 | func TestVer(t *testing.T) { 26 | versionset := Ver() 27 | assert.NotNil(t, versionset) 28 | } 29 | -------------------------------------------------------------------------------- /scripts/travis/deadCodeChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(find . -type d | grep -v examples | xargs deadcode) 18 | if [ $? == 0 ]; then 19 | echo "No Deadcode" 20 | exit 0 21 | else 22 | echo "Deadcode found ... Remove the unused code" 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /deployments/docker/db.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 | 18 | db.createUser( 19 | { 20 | user: "kie", 21 | pwd: "123", 22 | roles:[ 23 | { 24 | role: "readWrite", 25 | db: "kie" 26 | } 27 | ] 28 | } 29 | ); -------------------------------------------------------------------------------- /docs/development/cloud-provider.md: -------------------------------------------------------------------------------- 1 | # Cloud Provider 2 | By default Mesher do not support any cloud provider. 3 | But there is plugin that helps mesher do it. 4 | 5 | ### Huawei Cloud 6 | Mesher is able to use huawei cloud ServiceComb engine. 7 | #### Access ServiceComb Engine API 8 | Import auth in cmd/mesher/mesher.go 9 | ```go 10 | import _ "github.com/huaweicse/auth/adaptor/gochassis" 11 | ``` 12 | 13 | It will sign all requests from mesher to ServiceComb Engine. 14 | 15 | #### Use Config Center to manage configuration 16 | Mesher uses servicecomb-kie as config server, 17 | ```go 18 | _ "github.com/apache/servicecomb-kie" 19 | ``` 20 | When you need to use ServiceComb Engine, you must replace this line. 21 | Import config center in cmd/mesher/mesher.go. 22 | 23 | ```go 24 | _ "github.com/go-chassis/go-chassis/v2-config/configcenter" 25 | ``` 26 | Set the config center in chassis.yaml 27 | ```yaml 28 | config: 29 | client: 30 | serverUri: https://xxx #endpoint of servicecomb engine 31 | refreshMode: 1 # 1: only pull config. 32 | refreshInterval: 30 # unit is second 33 | type: config_center 34 | ``` -------------------------------------------------------------------------------- /scripts/travis/goLintChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(golint ./... | grep -v _test |grep -v stutters| grep -v field | grep -v this) 18 | if [ $? == 0 ]; then 19 | echo "No GoLint warnings found" 20 | exit 0 21 | else 22 | echo "GoLint Warnings found" 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /proxy/pkg/metrics/prom_recorder_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 metrics 19 | 20 | import ( 21 | "github.com/stretchr/testify/assert" 22 | "testing" 23 | ) 24 | 25 | func TestNewPromRecorder(t *testing.T) { 26 | _, err := NewPromRecorder(nil) 27 | assert.Error(t, err) 28 | 29 | } 30 | -------------------------------------------------------------------------------- /scripts/travis/formatChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(find . -name "*.go" -not -path ".git/*" | grep -v _test | xargs gofmt -s -d) 18 | if [ $? == 0 ]; then 19 | echo "Code is formatted properly" 20 | exit 0 21 | else 22 | echo "Code is not formatted properly" 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /licenses/LICENSE-Shopify-sarama: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Shopify 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-alecthomas-units: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Alec Thomas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-jtolds-gls: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Space Monkey, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-beorn7-perks: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Blake Mizerany 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-honnef.co-go-tools: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Dominik Honnef 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-onsi-ginkgo: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-onsi-gomega: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013-2014 Onsi Fakhouri 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-uber-go-atomic: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 Uber Technologies, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-gopkg.in-alecthomas-kingpin.v2: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014 Alec Thomas 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-json-iterator-go: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 json-iterator 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /examples/edge/conf/mesher.yaml: -------------------------------------------------------------------------------- 1 | ## Router rules and fault injection rules are moved to router.yaml 2 | #plugin: 3 | # destinationResolver: 4 | # http: host # how to turn host to destination name. default to service name, 5 | 6 | admin: #admin API 7 | goRuntimeMetrics : true # enable metrics 8 | enable: true 9 | 10 | ## enable pprof to profile mesher runtime 11 | #pprof: 12 | # enable: false 13 | 14 | #mesher: 15 | # ingress: 16 | # type: servicecomb 17 | # rule: 18 | # http: | 19 | # - host: example.com 20 | # limit: 30 21 | # apiPath: /some/api 22 | # service: 23 | # name: example 24 | # redirectPath: /another/api 25 | # port: 26 | # name: http-legacy 27 | # value: 8080 28 | # - apiPath: /sayerror/api 29 | # service: 30 | # name: Server 31 | # redirectPath: /sayerror 32 | # port: 33 | # name: http 34 | # value: 8080 35 | # - apiPath: /some/api 36 | # service: 37 | # name: Server 38 | # port: 39 | # name: http 40 | # value: 8080 -------------------------------------------------------------------------------- /licenses/LICENSE-Shopify-toxiproxy: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Shopify 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-cenkalti-backoff: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Cenk Altı 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-eapache-queue: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Evan Huus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-go-kit-kit: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Peter Bourgon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-kisielk-gotool: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Kamil Kisiel 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-spf13-cast: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Steve Francia 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /proxy/protocol/errors_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 protocol 19 | 20 | import ( 21 | "github.com/stretchr/testify/assert" 22 | "testing" 23 | ) 24 | 25 | func TestProxyError_Error(t *testing.T) { 26 | errorMSG := "error msg" 27 | roxyError := ProxyError{errorMSG} 28 | assert.Equal(t, errorMSG, roxyError.Error()) 29 | } 30 | -------------------------------------------------------------------------------- /scripts/travis/goCycloChecker.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | diff -u <(echo -n) <(find . -name "*.go" -not -path ".git/*" | xargs gocyclo -over 15) 18 | if [ $? == 0 ]; then 19 | echo "All function has less cyclomatic complexity..." 20 | exit 0 21 | else 22 | echo "Fucntions/function has more cyclomatic complexity..." 23 | exit 1 24 | fi 25 | -------------------------------------------------------------------------------- /licenses/LICENSE-go-logfmt-logfmt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 go-logfmt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-go-restful-swagger20: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Ernest Micklei 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-urfave-cli: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Jeremy Saenz & Contributors 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /proxy/control/struct.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 control 19 | 20 | //EgressConfig is a standardized model 21 | type EgressConfig struct { 22 | Hosts []string 23 | Ports []*EgressPort 24 | } 25 | 26 | //EgressPort protocol and the corresponding port 27 | type EgressPort struct { 28 | Port int32 29 | Protocol string 30 | } 31 | -------------------------------------------------------------------------------- /licenses/LICENSE-eapache-go-xerial-snappy: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Evan Huus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-emicklei-go-restful: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012,2013 Ernest Micklei 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-konsorten-go-windows-terminal-sequences: -------------------------------------------------------------------------------- 1 | (The MIT License) 2 | 3 | Copyright (c) 2017 marvin + konsorten GmbH (open-source@konsorten.de) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | -------------------------------------------------------------------------------- /licenses/LICENSE-sirupsen-logrus: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Simon Eskildsen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-client9-misspell: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2017 Nick Galbreath 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-eapache-go-resiliency: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Evan Huus 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /licenses/LICENSE-emicklei-go-restful-swagger12: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Ernest Micklei 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-stretchr-testify: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2012-2018 Mat Ryer and Tyler Bunnell 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-patrickmn-go-cache: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2018 Patrick Mylund Nielsen and the go-cache contributors 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /licenses/LICENSE-uber-go-ratelimit: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Uber Technologies, Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /proxy/pkg/ports/protocol_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 ports_test 19 | 20 | import ( 21 | "github.com/apache/servicecomb-mesher/proxy/pkg/ports" 22 | "github.com/stretchr/testify/assert" 23 | "testing" 24 | ) 25 | 26 | func TestSetFixedPort(t *testing.T) { 27 | ports.SetFixedPort("rpc", "9090") 28 | assert.Equal(t, "9090", ports.GetFixedPort("rpc")) 29 | } 30 | -------------------------------------------------------------------------------- /licenses/LICENSE-stretchr-objx: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2014 Stretchr, Inc. 4 | Copyright (c) 2017-2018 objx contributors 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/apache/servicecomb-mesher 2 | 3 | require ( 4 | github.com/ghodss/yaml v1.0.0 5 | github.com/go-chassis/foundation v0.3.0 6 | github.com/go-chassis/go-archaius v1.5.1 7 | github.com/go-chassis/go-chassis/v2 v2.3.1-0.20210918023417-c31b5972f022 8 | github.com/go-chassis/gohessian v0.0.0-20180702061429-e5130c25af55 9 | github.com/go-chassis/openlog v1.1.2 10 | github.com/patrickmn/go-cache v2.1.0+incompatible 11 | github.com/prometheus/client_golang v1.11.1 12 | github.com/prometheus/client_model v0.2.0 13 | github.com/stretchr/testify v1.6.1 14 | github.com/tetratelabs/go2sky v0.1.1-0.20190703154722-1eaab8035277 15 | github.com/urfave/cli v1.20.1-0.20181029213200-b67dcf995b6a 16 | golang.org/x/net v0.0.0-20201209123823-ac852fbbde11 17 | golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 18 | google.golang.org/grpc v1.27.0 19 | gopkg.in/yaml.v2 v2.4.0 20 | ) 21 | 22 | replace ( 23 | github.com/openzipkin-contrib/zipkin-go-opentracing v0.3.5 => github.com/go-chassis/zipkin-go-opentracing v0.3.5-0.20190321072447-42cf74fc2a92 24 | github.com/tetratelabs/go2sky v0.1.1-0.20190703154722-1eaab8035277 => github.com/SkyAPM/go2sky v0.1.1-0.20190703154722-1eaab8035277 25 | ) 26 | 27 | go 1.13 28 | -------------------------------------------------------------------------------- /proxy/protocol/dubbo/dubbo/respond_test.go: -------------------------------------------------------------------------------- 1 | package dubbo 2 | 3 | import ( 4 | "github.com/stretchr/testify/assert" 5 | "testing" 6 | ) 7 | 8 | func TestDubboDubboRsp(t *testing.T) { 9 | rsp := DubboRsp{} 10 | rsp.Init() 11 | assert.Equal(t, "0.0.0", rsp.mVersion) 12 | assert.Equal(t, false, rsp.mEvent) 13 | assert.Equal(t, "", rsp.mErrorMsg) 14 | assert.Equal(t, int64(0), rsp.mID) 15 | assert.Equal(t, Ok, rsp.mStatus) 16 | 17 | // Value 18 | rsp.SetValue("test") 19 | assert.NotNil(t, rsp.GetValue()) 20 | 21 | // Attachments 22 | m := make(map[string]string) 23 | m["key_01"] = "value_01" 24 | m["key_02"] = "value_02" 25 | m["key_03"] = "value_03" 26 | rsp.SetAttachments(m) 27 | attch := rsp.GetAttachments() 28 | assert.NotNil(t, attch) 29 | assert.Equal(t, "value_03", attch["key_03"]) 30 | 31 | // ID 32 | rsp.SetID(12345) 33 | assert.Equal(t, int64(12345), rsp.GetID()) 34 | 35 | // Exception 36 | rsp.SetException("Java Throw Exception") 37 | assert.Equal(t, "Java Throw Exception", rsp.GetException()) 38 | 39 | // Msg 40 | rsp.SetErrorMsg("Test error msg") 41 | assert.Equal(t, "Test error msg", rsp.GetErrorMsg()) 42 | 43 | // IsHeartbeat 44 | assert.Equal(t, false, rsp.IsHeartbeat()) 45 | } 46 | -------------------------------------------------------------------------------- /licenses/LICENSE-hpcloud-tail: -------------------------------------------------------------------------------- 1 | # The MIT License (MIT) 2 | 3 | # © Copyright 2015 Hewlett Packard Enterprise Development LP 4 | Copyright (c) 2014 ActiveState 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /scripts/travis/goSecureChecker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 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 | gosec -fmt=json -out=results.json ./... 19 | cat results.json 20 | issueCount=$(tail -7 results.json | grep '"found":' | sed 's/[[:space:]]//g' | awk -F":" '{print $2}') 21 | rm -rf results.json 22 | if (($? == 0 && 35 > $issueCount)); then 23 | echo "No GoSecure warnings found" 24 | exit 0 25 | else 26 | echo "GoSecure Warnings found" 27 | exit 1 28 | fi 29 | -------------------------------------------------------------------------------- /licenses/LICENSE-openzipkin-contrib-zipkin-go-opentracing: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 The OpenTracing Authors 4 | Copyright (c) 2016 Bas van Beek 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /proxy/resource/v1/health/instances.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 health 19 | 20 | import ( 21 | "github.com/go-chassis/go-chassis/v2/pkg/runtime" 22 | ) 23 | 24 | //GetMesherHealth returns health 25 | func GetMesherHealth() *Health { 26 | resp := &Health{ 27 | ServiceName: runtime.ServiceName, 28 | Version: runtime.Version, 29 | Status: Green, 30 | Error: "", 31 | } 32 | return resp 33 | } 34 | -------------------------------------------------------------------------------- /docs/getstarted/minimum.md: -------------------------------------------------------------------------------- 1 | # Before you start 2 | Before you start, you must know what you gonna do if you use mesher as your sidecar proxy. 3 | 4 | Assume you launched 2 services, 5 | each of service has a dedicated mesher as sidecar proxy. 6 | 7 | The network traffic will be: ServiceA->mesherA->mesherB->ServiceB. 8 | 9 | To run mesher along with your services, you need to set minimum configurations as below: 10 | 11 | 12 | 1. Give mesher your service name in microservice.yaml file 13 | 2. Set service discovery service(service center, Istio etc) configurations in chassis.yaml 14 | 3. Export HTTP_PROXY=http://127.0.0.1:30101 as your service runtime environment 15 | 4. (optional) Give mesher your service port list by ENV SERVICE_PORTS or CLI --service-ports 16 | 17 | 18 | After the configurations, assume you serviceB is listening at 127.0.0.1:8080. 19 | 20 | The serviceA must use http://ServiceB:8080/{api_path} to access ServiceB. 21 | 22 | Now you can launch as many as serviceA and serviceB to make this system become a distributed system. 23 | 24 | **Notice**: 25 | 26 | >> Consumer need to use http://provider_name:provider_port/ to access provider, 27 | instead of http://provider_ip:provider_port/. 28 | if you choose to set step4, then you can simply use http://provider_name/ to access provider. -------------------------------------------------------------------------------- /licenses/LICENSE-smartystreets-assertions: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 SmartyStreets, LLC 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | NOTE: Various optional and subordinate components carry their own licensing requirements and restrictions. Use of those components is subject to the terms and conditions outlined the respective license of each component. -------------------------------------------------------------------------------- /licenses/LICENSE-smartystreets-goconvey: -------------------------------------------------------------------------------- 1 | Copyright (c) 2016 SmartyStreets, LLC 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | NOTE: Various optional and subordinate components carry their own licensing requirements and restrictions. Use of those components is subject to the terms and conditions outlined the respective license of each component. -------------------------------------------------------------------------------- /proxy/protocol/dubbo/dubbo/context.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/servicecomb-mesher/proxy/protocol/dubbo/schema" 22 | // "github.com/servicecomb/go-chassis/core/invocation" 23 | ) 24 | 25 | //InvokeContext is a struct which has attributes for invoke context 26 | type InvokeContext struct { 27 | Req *Request 28 | Rsp *DubboRsp 29 | Method *schema.DefMethod 30 | SvcName string 31 | RemoteAddr string 32 | } 33 | -------------------------------------------------------------------------------- /proxy/protocol/dubbo/simpleRegistry/regstry_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 simpleregistry 19 | 20 | import ( 21 | // "github.com/apache/servicecomb-mesher/plugin/dubbo/dubbo" 22 | //"github.com/apache/servicecomb-mesher/plugin/dubbo/utils" 23 | ) 24 | 25 | //RegistryURL is a struct which has attributes of a URL 26 | type RegistryURL struct { 27 | Protocol string 28 | Username string 29 | Password string 30 | Host string 31 | Port int 32 | Path string 33 | Parameters map[string]string 34 | } 35 | -------------------------------------------------------------------------------- /licenses/LICENSE-gopherjs-gopherjs: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Richard Musiol. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 15 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 16 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 17 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 18 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 19 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 20 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-gorilla-websocket: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Gorilla WebSocket Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | Redistributions of source code must retain the above copyright notice, this 7 | list of conditions and the following disclaimer. 8 | 9 | Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 17 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 18 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 19 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 20 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 21 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-pkg-errors: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Dave Cheney 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 15 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /proxy/pkg/ports/protocol.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 ports 19 | 20 | import "github.com/go-chassis/go-chassis/v2/core/common" 21 | 22 | var defaultProtocolPort = map[string]string{ 23 | common.ProtocolRest: "30101", 24 | "grpc": "40101", 25 | } 26 | 27 | //SetFixedPort allows developer set a fixed port for for you protocol 28 | func SetFixedPort(protocol, port string) { 29 | defaultProtocolPort[protocol] = port 30 | } 31 | 32 | //GetFixedPort return port pf a protocol 33 | func GetFixedPort(protocol string) string { 34 | return defaultProtocolPort[protocol] 35 | 36 | } 37 | -------------------------------------------------------------------------------- /examples/edge/conf/chassis.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | servicecomb: 3 | protocols: 4 | http: 5 | listenAddress: 127.0.0.1:30101 6 | rest-admin: 7 | listenAddress: 127.0.0.1:30102 # listen addr use to adminAPI 8 | service: 9 | registry: 10 | address: http://127.0.0.1:30100 # uri of service center 11 | scope: full #set full to be able to discover other app's service 12 | config: 13 | client: 14 | serverUri: https://127.0.0.1:30110 #uri of config center 15 | type: servicecomb-kie 16 | refreshMode: 1 # 1: only pull config. 17 | refreshInterval: 30 # unit is second 18 | handler: 19 | chain: 20 | Consumer: 21 | outgoing: router,bizkeeper-consumer,loadbalance,tracing-consumer,transport #consumer handlers 22 | Provider: 23 | incoming: oauth2,tracing-provider #provider handlers 24 | 25 | ## Mesher TLS is base on Go Chassis TLS config, https://docs.go-chassis.com/user-guides/tls.html 26 | ssl: 27 | # mesher-edge.rest.Provider.cipherPlugin: default 28 | # mesher-edge.rest.Provider.verifyPeer: false 29 | # mesher-edge.rest.Provider.cipherSuits: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 30 | # mesher-edge.rest.Provider.protocol: TLSv1.2 31 | # mesher-edge.rest.Provider.caFile: 32 | # mesher-edge.rest.Provider.certFile: server.crt 33 | # mesher-edge.rest.Provider.keyFile: server.key 34 | # mesher-edge.rest.Provider.certPwdFile: -------------------------------------------------------------------------------- /proxy/protocol/dubbo/schema/cache_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 schema 19 | 20 | import ( 21 | "sync" 22 | "testing" 23 | "time" 24 | 25 | "github.com/stretchr/testify/assert" 26 | ) 27 | 28 | func TestFreshTicker(t *testing.T) { 29 | r1 := newRefresher(time.Second * 2) 30 | r1.Run() 31 | 32 | a1, a2 := 0, 0 33 | var wg sync.WaitGroup 34 | wg.Add(2) 35 | 36 | r1.Add(Job{Fn: func() { 37 | a1++ 38 | wg.Done() 39 | }}) 40 | 41 | r1.Add(Job{Fn: func() { 42 | a2++ 43 | wg.Done() 44 | }}) 45 | 46 | wg.Wait() 47 | 48 | assert.Equal(t, a1, 1) 49 | assert.Equal(t, a2, 1) 50 | 51 | } 52 | -------------------------------------------------------------------------------- /docs/istio/egress.md: -------------------------------------------------------------------------------- 1 | # Egress 2 | ## Introduction 3 | 4 | Mesher support Egress for your service, so that you can access any publicly accessible services from your microservices. 5 | 6 | ## Configuration 7 | 8 | The egress related configurations are all in egress.yaml. 9 | 10 | **infra** 11 | 12 | > *(optional, string)* Specifies from where the egress configuration need to be taken supports two values CSE or pilot , 13 | CSE means the egress configurations from egress.yaml file, 14 | pilot means egress configurations are taken from pilot of Istio, 15 | default is *CSE*. 16 | 17 | **address** 18 | 19 | > *(optional, string)* The end point of pilot from which configuration need to be fetched. 20 | 21 | **hosts** 22 | > *(optional, []string)* Host associated with external service, could be a DNS name with wildcard prefix. 23 | 24 | **ports.port** 25 | 26 | > *(optional, int)* The port associated with the external service, default is *80*. 27 | 28 | **ports.protocol** 29 | 30 | > *(optional, int)* The protocol associated with the external service, supports only HTTP, default is *HTTP*. 31 | 32 | ## Example 33 | Edit egress.yaml 34 | 35 | ```yaml 36 | egress: 37 | infra: cse # pilot or cse 38 | address: http://istio-pilot.istio-system:15010 39 | egressRule: 40 | google-ext: 41 | - hosts: 42 | - "www.google.com" 43 | - "*.yahoo.com" 44 | ports: 45 | - port: 80 46 | protocol: HTTP 47 | ``` 48 | -------------------------------------------------------------------------------- /licenses/LICENSE-gopkg.in-check.v1: -------------------------------------------------------------------------------- 1 | Gocheck - A rich testing framework for Go 2 | 3 | Copyright (c) 2010-2013 Gustavo Niemeyer 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, this 11 | list of conditions and the following disclaimer. 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 20 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /docs/configurations/health.md: -------------------------------------------------------------------------------- 1 | # Local Health check 2 | You can use health checker to check local service health. 3 | When service instance is unhealthy, mesher will update the instance status in registry service to "DOWN" 4 | so that other services 5 | can not discover this instance. After the service becoming healthy again, mesher will update the status to "UP", 6 | then other instance can discover it again. 7 | Currently this function works only when using service center as registry. 8 | 9 | Examples: 10 | 11 | - Check local http service 12 | 13 | ```yaml 14 | localHealthCheck: 15 | - port: 8080 16 | protocol: rest 17 | uri: /health 18 | interval: 30s 19 | match: 20 | status: 200 21 | body: ok 22 | ``` 23 | 24 | ### Options 25 | 26 | **port** 27 | 28 | >*(require, string)* Must be a port number, mesher is only responsible to check local services, 29 | it use 127.0.0.1:{port} to check services. 30 | 31 | **protocol** 32 | 33 | >*(optional, string)* Mesher has a built-in checker "rest",for other protocols, 34 | will use default TCP checker unless implementing your own checker. 35 | 36 | **uri** 37 | 38 | >*(optional, string)* Uri start with /. 39 | 40 | 41 | **interval** 42 | >*(optional, string)* Check interval, you can use number with unit: 1m, 10s. 43 | 44 | **match.status** 45 | >*(optional, string)* The http response status must match status code. 46 | 47 | **match.body** 48 | 49 | >*(optional, string)* The http response body must match body. -------------------------------------------------------------------------------- /proxy/handler/oauth2/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 oauth2 19 | 20 | import ( 21 | "golang.org/x/oauth2" 22 | "net/http" 23 | ) 24 | 25 | var auth *OAuth2 26 | 27 | // OAuth2 should implement oauth2 server side logic 28 | // it is singleton 29 | type OAuth2 struct { 30 | GrantType string // required 31 | UseConfig *oauth2.Config // required 32 | Authenticate func(accessToken string, req *http.Request) error // optional 33 | } 34 | 35 | // Use put a custom oauth2 logic 36 | // then register handler to chassis 37 | func Use(middleware *OAuth2) { 38 | auth = middleware 39 | } 40 | -------------------------------------------------------------------------------- /proxy/resource/v1/health/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 health 19 | 20 | //StatusCode is type of string 21 | type StatusCode string 22 | 23 | const ( 24 | //Red is a const 25 | Red StatusCode = "red" 26 | //Green is a const 27 | Green StatusCode = "green" 28 | ) 29 | 30 | //Health has details about health of a service 31 | type Health struct { 32 | ServiceName string `json:"serviceName,omitempty"` 33 | Version string `json:"version,omitempty"` 34 | Status StatusCode `json:"status,omitempty"` 35 | ConnectedMonitoring bool `json:"connectedMonitoring"` 36 | Error string `json:"error,omitempty"` 37 | } 38 | -------------------------------------------------------------------------------- /scripts/ci/build_image.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 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 | set -e 19 | set -x 20 | 21 | cd /var/lib/jenkins/workspace/Mesher/src/github.com/apache/servicecomb-mesher/ 22 | 23 | repo="github.com" 24 | project="go-mesh" 25 | export BUILD_DIR=/var/lib/jenkins/workspace/Mesher 26 | export WORK_DIR=$BUILD_DIR/src/$repo/$project/mesher 27 | cd $WORK_DIR 28 | 29 | docker build -t gomesh/mesher:$VERSION . 30 | 31 | cp /var/lib/jenkins/workspace/docker_login.sh . 32 | bash docker_login.sh &> /dev/null 33 | 34 | if [ $PUSH_WITH_LATEST_TAG == "YES" ]; then 35 | docker build -t gomesh/mesher:latest . 36 | docker push gomesh/mesher:latest 37 | fi 38 | 39 | docker push gomesh/mesher:$VERSION 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /licenses/LICENSE-pmezard-go-difflib: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, Patrick Mezard 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | The names of its contributors may not be used to endorse or promote 14 | products derived from this software without specific prior written 15 | permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 18 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 20 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23 | TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-julienschmidt-httprouter: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Julien Schmidt. All rights reserved. 2 | 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * The names of the contributors may not be used to endorse or promote 12 | products derived from this software without specific prior written 13 | permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL JULIEN SCHMIDT BE LIABLE FOR ANY 19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /proxy/resource/v1/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 v1 19 | 20 | import ( 21 | "github.com/apache/servicecomb-mesher/proxy/config" 22 | "github.com/go-chassis/go-chassis/v2" 23 | "github.com/go-chassis/openlog" 24 | ) 25 | 26 | //RegisterWebService creates route and returns all admin APIs 27 | func RegisterWebService() { 28 | chassis.RegisterSchema("rest-admin", &RouteResource{}) 29 | chassis.RegisterSchema("rest-admin", &StatusResource{}) 30 | } 31 | 32 | //Init function initiates admin API 33 | func Init() (err error) { 34 | if !config.GetConfig().Admin.Enable { 35 | openlog.Info("admin API is disabled") 36 | return nil 37 | } 38 | openlog.Info("admin API is enabled") 39 | RegisterWebService() 40 | return 41 | } 42 | -------------------------------------------------------------------------------- /licenses/LICENSE-golang-lint: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-net: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-sync: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-sys: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-text: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-time: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-tools: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-pierrec-lz4: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Pierre Curto 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of xxHash nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-crypto: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-oauth2: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-protobuf: -------------------------------------------------------------------------------- 1 | Copyright 2010 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-alecthomas-template: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-golang-snappy: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 The Snappy-Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /proxy/protocol/errors.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 protocol 19 | 20 | import "errors" 21 | 22 | var ( 23 | //ErrNilResult is of type error 24 | ErrNilResult = errors.New("result is nil") 25 | //ErrUnknown is of type string which returns unknown error 26 | ErrUnknown = ProxyError{"Unknown Error,instance is not selected, error is nil"} 27 | //ErrUnExpectedHandlerChainResponse is of type string which returns unexpected handler error 28 | ErrUnExpectedHandlerChainResponse = ProxyError{"Response from Handler chain is nil,better to check if handler chain is empty, or some handler just return a nil response"} 29 | ) 30 | 31 | //ProxyError is a struct 32 | type ProxyError struct { 33 | Message string 34 | } 35 | 36 | func (e ProxyError) Error() string { 37 | return e.Message 38 | } 39 | -------------------------------------------------------------------------------- /proxy/config/egress.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 | //EgressConfig is the struct having info about egress rule destinations 21 | type EgressConfig struct { 22 | Egress Egress `yaml:"egress"` 23 | Destinations map[string][]*EgressRule `yaml:"egressRule"` 24 | } 25 | 26 | // Egress define where rule comes from 27 | type Egress struct { 28 | Infra string `yaml:"infra"` 29 | Address string `yaml:"address"` 30 | } 31 | 32 | //EgressRule has hosts and ports information 33 | type EgressRule struct { 34 | Hosts []string `yaml:"hosts"` 35 | Ports []*EgressPort `yaml:"ports"` 36 | } 37 | 38 | //EgressPort protocol and the corresponding port 39 | type EgressPort struct { 40 | Port int32 `yaml:"port"` 41 | Protocol string `yaml:"protocol"` 42 | } 43 | -------------------------------------------------------------------------------- /docker/edge/lager.yaml: -------------------------------------------------------------------------------- 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 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | --- 17 | # LoggerLevel: |DEBUG|INFO|WARN|ERROR|FATAL 18 | logger_level: DEBUG 19 | 20 | # LoggerFile: used to output the name of log.可配置绝对路径,也可以配置用于拼接CHASSIS_HOME的相对路径。 21 | logger_file: log/mesher.log 22 | 23 | # LogFormatText:设定日志的输出格式是 json 还是 plaintext (类似于log4j),默认为 false,不建议修改,如果开发过程中想本地查看日志的话, 24 | # 可以设定 LoggerFile 和 LogFormatText 为 true,这样会输出类似于 log4j 格式的本地日志。 25 | log_format_text: false 26 | 27 | #rollingPolicy daily/size;用于配置根据时间,还是根据大小进行日志rotate操作。 28 | rollingPolicy: size 29 | 30 | # MaxDaily of a log file before rotate. By D Days.;日志rotate时间配置,单位"day"。 31 | log_rotate_date: 1 32 | 33 | # MaxSize of a log file before rotate. By M Bytes.;日志rotate文件大小配置,单位"MB"。 34 | log_rotate_size: 10 35 | 36 | # Max counts to keep of a log's backup files.日志最大存储数量,单位“个”。 37 | log_backup_count: 7 -------------------------------------------------------------------------------- /licenses/LICENSE-go-inf-inf: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Péter Surányi. Portions Copyright (c) 2009 The Go 2 | Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-rcrowley-go-metrics: -------------------------------------------------------------------------------- 1 | Copyright 2012 Richard Crowley. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY RICHARD CROWLEY ``AS IS'' AND ANY EXPRESS 16 | OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 18 | DISCLAIMED. IN NO EVENT SHALL RICHARD CROWLEY OR CONTRIBUTORS BE LIABLE 19 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 25 | THE POSSIBILITY OF SUCH DAMAGE. 26 | 27 | The views and conclusions contained in the software and documentation 28 | are those of the authors and should not be interpreted as representing 29 | official policies, either expressed or implied, of Richard Crowley. -------------------------------------------------------------------------------- /licenses/LICENSE-fsnotify: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 The Go Authors. All rights reserved. 2 | Copyright (c) 2012 fsnotify Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-spf13-pflag: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Alex Ogier. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /licenses/LICENSE-imdario-mergo: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013 Dario Castañé. All rights reserved. 2 | Copyright (c) 2012 The Go Authors. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are 6 | met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following disclaimer 12 | in the documentation and/or other materials provided with the 13 | distribution. 14 | * Neither the name of Google Inc. nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /docs/skywalking/skywalking.md: -------------------------------------------------------------------------------- 1 | # SkyWalking 2 | 3 | Skywalking-manager is a handler plugin of mesher, it reports tracing data to skywalking server. 4 | 5 | ## Configurations 6 | **In conf/mesher.conf** 7 | 8 | **servicecomb.apm.tracing.enable** 9 | > *(optional, bool)* enable application performance manager 10 | 11 | **servicecomb.apm.tracing.serverUri** 12 | > *(optional, string)* server address of skywalking 13 | 14 | ## Example 15 | ```yaml 16 | servicecomb: 17 | apm: #application performance monitor 18 | tracing: 19 | enable: true #enable tracing ability 20 | serverUri: 127.0.0.1:11800 #url of skywalking 21 | ``` 22 | ## Step: 23 | 24 | # 1. SkyWawlking-Manager Init 25 | **You must init skywawlking manager pkg which will manage connection and report msg to skywalking** 26 | - For example: 27 | - [1] You can import skywalking manager proxy/pkg/skywalking in file proxy/bootstrap/bootstrap.go. 28 | - [2] Calling function Init() in proxy/pkg/skywalking manually to init skywalking manager. 29 | - [3] Adding skywalking's consumer handler name SkyWalkingConsumer defined in proxy/pkg/skywalking to consumerChain. 30 | - [4] Adding skywalking's provider handler name SkyWalkingProvider defined in proxy/pkg/skywalking to providerChain. 31 | - more details about handler chains in [go-chassis](https://github.com/go-chassis/go-chassis#readme) 32 | 33 | # 2. SkyWalking-Handler Init 34 | - You must import proxy/handler pkg to init skywalking handler. Not only skywalking handler, all the handlers which are customized for mesher are defined here. 35 | - For example you can import handler pkg in file cmd/mesher/mesher.go 36 | 37 | -------------------------------------------------------------------------------- /licenses/LICENSE-DataDog-zstd: -------------------------------------------------------------------------------- 1 | Simplified BSD License 2 | 3 | Copyright (c) 2016, Datadog 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, 10 | this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | * Neither the name of the copyright holder nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /conf/fault.yaml: -------------------------------------------------------------------------------- 1 | #servicecomb: 2 | # governance: 3 | # Consumer: 4 | # _global: #最低优先级配置 5 | # policy: #治理策略 包括fault,loadbalance,circuit breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持 6 | # fault: # 7 | # protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计 8 | # rest: 9 | # delay: 10 | # fixedDelay: 5 11 | # percent: 10 12 | # abort: 13 | # httpStatus: 421 14 | # percent: 100 15 | # highway: 16 | # delay: 17 | # fixedDelay: 2 18 | # percent: 100 19 | # abort: 20 | # percent: 30 21 | # ms1: 22 | # route: | 23 | # - precedence: 2 24 | # match: 25 | # source: source.service 26 | # traffic: 27 | # - tags: 28 | # version: 1.0 29 | # weight: 90 30 | # - tags: 31 | # version: 1.1 32 | # weight: 10 33 | # policy: 34 | # fault: 35 | # schemas: 36 | # sid1: 37 | # policy: 38 | # fault: 39 | # operations: 40 | # policy: 41 | # fault: 42 | # policy: # 微服务名级别治理策略 43 | # fault: 44 | # schemas: #schema级别治理策略 45 | # sid1: 46 | # policy: 47 | # fault: 48 | # operations: #operation级别治理策略 49 | # policy: 50 | # fault: 51 | # Provider: # format same as Consumer -------------------------------------------------------------------------------- /examples/config/cse/conf/fault.yaml: -------------------------------------------------------------------------------- 1 | #servicecomb: 2 | # governance: 3 | # Consumer: 4 | # _global: #最低优先级配置 5 | # policy: #治理策略 包括fault,loadbalance,circuit breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持 6 | # fault: # 7 | # protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计 8 | # rest: 9 | # delay: 10 | # fixedDelay: 5 11 | # percent: 10 12 | # abort: 13 | # httpStatus: 421 14 | # percent: 100 15 | # highway: 16 | # delay: 17 | # fixedDelay: 2 18 | # percent: 100 19 | # abort: 20 | # percent: 30 21 | # ms1: 22 | # route: | 23 | # - precedence: 2 24 | # match: 25 | # source: source.service 26 | # traffic: 27 | # - tags: 28 | # version: 1.0 29 | # weight: 90 30 | # - tags: 31 | # version: 1.1 32 | # weight: 10 33 | # policy: 34 | # fault: 35 | # schemas: 36 | # sid1: 37 | # policy: 38 | # fault: 39 | # operations: 40 | # policy: 41 | # fault: 42 | # policy: # 微服务名级别治理策略 43 | # fault: 44 | # schemas: #schema级别治理策略 45 | # sid1: 46 | # policy: 47 | # fault: 48 | # operations: #operation级别治理策略 49 | # policy: 50 | # fault: 51 | # Provider: # format same as Consumer -------------------------------------------------------------------------------- /licenses/LICENSE-gopkg.in-tomb.v1: -------------------------------------------------------------------------------- 1 | tomb - support for clean goroutine termination in Go. 2 | 3 | Copyright (c) 2010-2011 - Gustavo Niemeyer 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the names of its 16 | contributors may be used to endorse or promote products derived from 17 | this software without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 22 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 23 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 24 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 25 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 26 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /examples/quick_start/mersher_webapp/conf/fault.yaml: -------------------------------------------------------------------------------- 1 | #servicecomb: 2 | # governance: 3 | # Consumer: 4 | # _global: #最低优先级配置 5 | # policy: #治理策略 包括fault,loadbalance,circuit breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持 6 | # fault: # 7 | # protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计 8 | # rest: 9 | # delay: 10 | # fixedDelay: 5 11 | # percent: 10 12 | # abort: 13 | # httpStatus: 421 14 | # percent: 100 15 | # highway: 16 | # delay: 17 | # fixedDelay: 2 18 | # percent: 100 19 | # abort: 20 | # percent: 30 21 | # ms1: 22 | # route: | 23 | # - precedence: 2 24 | # match: 25 | # source: source.service 26 | # traffic: 27 | # - tags: 28 | # version: 1.0 29 | # weight: 90 30 | # - tags: 31 | # version: 1.1 32 | # weight: 10 33 | # policy: 34 | # fault: 35 | # schemas: 36 | # sid1: 37 | # policy: 38 | # fault: 39 | # operations: 40 | # policy: 41 | # fault: 42 | # policy: # 微服务名级别治理策略 43 | # fault: 44 | # schemas: #schema级别治理策略 45 | # sid1: 46 | # policy: 47 | # fault: 48 | # operations: #operation级别治理策略 49 | # policy: 50 | # fault: 51 | # Provider: # format same as Consumer -------------------------------------------------------------------------------- /examples/quick_start/mersher_calculator/conf/fault.yaml: -------------------------------------------------------------------------------- 1 | #servicecomb: 2 | # governance: 3 | # Consumer: 4 | # _global: #最低优先级配置 5 | # policy: #治理策略 包括fault,loadbalance,circuit breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持 6 | # fault: # 7 | # protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计 8 | # rest: 9 | # delay: 10 | # fixedDelay: 5 11 | # percent: 10 12 | # abort: 13 | # httpStatus: 421 14 | # percent: 100 15 | # highway: 16 | # delay: 17 | # fixedDelay: 2 18 | # percent: 100 19 | # abort: 20 | # percent: 30 21 | # ms1: 22 | # route: | 23 | # - precedence: 2 24 | # match: 25 | # source: source.service 26 | # traffic: 27 | # - tags: 28 | # version: 1.0 29 | # weight: 90 30 | # - tags: 31 | # version: 1.1 32 | # weight: 10 33 | # policy: 34 | # fault: 35 | # schemas: 36 | # sid1: 37 | # policy: 38 | # fault: 39 | # operations: 40 | # policy: 41 | # fault: 42 | # policy: # 微服务名级别治理策略 43 | # fault: 44 | # schemas: #schema级别治理策略 45 | # sid1: 46 | # policy: 47 | # fault: 48 | # operations: #operation级别治理策略 49 | # policy: 50 | # fault: 51 | # Provider: # format same as Consumer -------------------------------------------------------------------------------- /examples/quick_start/test_balance/mersher_calculator/conf/fault.yaml: -------------------------------------------------------------------------------- 1 | #servicecomb: 2 | # governance: 3 | # Consumer: 4 | # _global: #最低优先级配置 5 | # policy: #治理策略 包括fault,loadbalance,circuit breaker等等,目前只是新的fault加入,旧的治理可考虑慢慢增加支持 6 | # fault: # 7 | # protocols: # 向协议模块注入错误,考虑未来扩展多任意组件注入错误,所以这么设计 8 | # rest: 9 | # delay: 10 | # fixedDelay: 5 11 | # percent: 10 12 | # abort: 13 | # httpStatus: 421 14 | # percent: 100 15 | # highway: 16 | # delay: 17 | # fixedDelay: 2 18 | # percent: 100 19 | # abort: 20 | # percent: 30 21 | # ms1: 22 | # route: | 23 | # - precedence: 2 24 | # match: 25 | # source: source.service 26 | # traffic: 27 | # - tags: 28 | # version: 1.0 29 | # weight: 90 30 | # - tags: 31 | # version: 1.1 32 | # weight: 10 33 | # policy: 34 | # fault: 35 | # schemas: 36 | # sid1: 37 | # policy: 38 | # fault: 39 | # operations: 40 | # policy: 41 | # fault: 42 | # policy: # 微服务名级别治理策略 43 | # fault: 44 | # schemas: #schema级别治理策略 45 | # sid1: 46 | # policy: 47 | # fault: 48 | # operations: #operation级别治理策略 49 | # policy: 50 | # fault: 51 | # Provider: # format same as Consumer -------------------------------------------------------------------------------- /docker/edge/Dockerfile: -------------------------------------------------------------------------------- 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 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | FROM golang:1.12.10 as builder 17 | 18 | COPY . /servicecomb-mesher/ 19 | WORKDIR /servicecomb-mesher/ 20 | ENV GOPROXY=https://goproxy.io 21 | RUN go build -a github.com/apache/servicecomb-mesher/cmd/mesher 22 | 23 | 24 | FROM frolvlad/alpine-glibc:latest 25 | RUN mkdir -p /opt/mesher && \ 26 | mkdir -p /etc/mesher/conf && \ 27 | mkdir -p /etc/ssl/mesher/ 28 | # To upload schemas using env enable SCHEMA_ROOT as environment variable using dockerfile or pass while running container 29 | #ENV SCHEMA_ROOT=/etc/chassis-go/schemas umcomment in future 30 | 31 | ENV CHASSIS_HOME=/opt/mesher/ 32 | 33 | COPY --from=builder /servicecomb-mesher/mesher $CHASSIS_HOME 34 | COPY docker/edge/microservice.yaml docker/edge/chassis.yaml docker/edge/lager.yaml $CHASSIS_HOME/conf/ 35 | COPY docker/edge/mesher.yaml /etc/mesher/conf/ 36 | COPY docker/edge/start.sh $CHASSIS_HOME 37 | WORKDIR $CHASSIS_HOME 38 | ENTRYPOINT ["sh", "/opt/mesher/start.sh"] 39 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 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 | pushd %~dp0 18 | 19 | REM Command file for Sphinx documentation 20 | 21 | if "%SPHINXBUILD%" == "" ( 22 | set SPHINXBUILD=sphinx-build 23 | ) 24 | set SOURCEDIR=. 25 | set BUILDDIR=_build 26 | set SPHINXPROJ=go-chassis 27 | 28 | if "%1" == "" goto help 29 | 30 | %SPHINXBUILD% >NUL 2>NUL 31 | if errorlevel 9009 ( 32 | echo. 33 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 34 | echo.installed, then set the SPHINXBUILD environment variable to point 35 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 36 | echo.may add the Sphinx directory to PATH. 37 | echo. 38 | echo.If you don't have Sphinx installed, grab it from 39 | echo.http://sphinx-doc.org/ 40 | exit /b 1 41 | ) 42 | 43 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 44 | goto end 45 | 46 | :help 47 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% 48 | 49 | :end 50 | popd 51 | -------------------------------------------------------------------------------- /proxy/resource/v1/health/mockRegistry_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 health 19 | 20 | import ( 21 | "github.com/stretchr/testify/mock" 22 | ) 23 | 24 | type MockMemberDiscovery struct { 25 | mock.Mock 26 | } 27 | 28 | func (m *MockMemberDiscovery) ConfigurationInit(initConfigServer []string) error { 29 | args := m.Called(initConfigServer) 30 | return args.Error(0) 31 | } 32 | func (m *MockMemberDiscovery) GetConfigServer() ([]string, error) { 33 | args := m.Called() 34 | return args.Get(0).([]string), args.Error(1) 35 | } 36 | func (m *MockMemberDiscovery) RefreshMembers() error { 37 | args := m.Called() 38 | return args.Error(0) 39 | } 40 | func (m *MockMemberDiscovery) Shuffle() error { 41 | args := m.Called() 42 | return args.Error(0) 43 | } 44 | func (m *MockMemberDiscovery) GetWorkingConfigCenterIP(entryPoint []string) ([]string, error) { 45 | args := m.Called(entryPoint) 46 | return args.Get(0).([]string), args.Error(0) 47 | } 48 | -------------------------------------------------------------------------------- /proxy/resolver/source.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 resolver 19 | 20 | import ( 21 | "errors" 22 | "github.com/go-chassis/go-chassis/v2/core/registry" 23 | ) 24 | 25 | var ( 26 | //ErrFoo is of type error 27 | ErrFoo = errors.New("resolved as a nil service") 28 | ) 29 | 30 | //SourceResolver is a interface which has Resolve function 31 | type SourceResolver interface { 32 | Resolve(source string) *registry.SourceInfo 33 | } 34 | 35 | var sr SourceResolver = &DefaultSourceResolver{} 36 | 37 | //DefaultSourceResolver is a struct 38 | type DefaultSourceResolver struct { 39 | } 40 | 41 | //Resolve is a method which resolves service endpoint 42 | func (sr *DefaultSourceResolver) Resolve(source string) *registry.SourceInfo { 43 | if source == "127.0.0.1" { 44 | return nil 45 | } 46 | si := registry.GetIPIndex(source) 47 | 48 | return si 49 | } 50 | 51 | //GetSourceResolver returns interface object 52 | func GetSourceResolver() SourceResolver { 53 | return sr 54 | } 55 | -------------------------------------------------------------------------------- /proxy/resource/v1/route/route.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 route 19 | 20 | import ( 21 | "github.com/go-chassis/go-chassis/v2/core/config" 22 | "github.com/go-chassis/go-chassis/v2/core/router" 23 | ) 24 | 25 | //Rules is the struct for route rule 26 | type Rules struct { 27 | Destinations map[string][]*config.RouteRule `yaml:"routeRule"` 28 | } 29 | 30 | var routeRules *Rules 31 | 32 | //GetServiceRouteRule gets route rule for that service 33 | func GetServiceRouteRule(serviceName string) []*config.RouteRule { 34 | if routeRules != nil { 35 | if v, ok := routeRules.Destinations[serviceName]; ok { 36 | return v 37 | } 38 | } 39 | 40 | rules := router.DefaultRouter.FetchRouteRuleByServiceName(serviceName) 41 | if routeRules == nil { 42 | routeRules = new(Rules) 43 | } 44 | if routeRules.Destinations == nil { 45 | routeRules.Destinations = make(map[string][]*config.RouteRule) 46 | } 47 | routeRules.Destinations[serviceName] = rules 48 | return rules 49 | } 50 | -------------------------------------------------------------------------------- /licenses/LICENSE-gogo-protobuf: -------------------------------------------------------------------------------- 1 | Copyright (c) 2013, The GoGo Authors. All rights reserved. 2 | 3 | Protocol Buffers for Go with Gadgets 4 | 5 | Go support for Protocol Buffers - Google's data interchange format 6 | 7 | Copyright 2010 The Go Authors. All rights reserved. 8 | https://github.com/golang/protobuf 9 | 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are 12 | met: 13 | 14 | * Redistributions of source code must retain the above copyright 15 | notice, this list of conditions and the following disclaimer. 16 | * Redistributions in binary form must reproduce the above 17 | copyright notice, this list of conditions and the following disclaimer 18 | in the documentation and/or other materials provided with the 19 | distribution. 20 | * Neither the name of Google Inc. nor the names of its 21 | contributors may be used to endorse or promote products derived from 22 | this software without specific prior written permission. 23 | 24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 25 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 26 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 27 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 28 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 30 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 31 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 32 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 33 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /proxy/util/util.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 util 19 | 20 | import ( 21 | "fmt" 22 | "github.com/apache/servicecomb-mesher/proxy/cmd" 23 | "github.com/apache/servicecomb-mesher/proxy/common" 24 | "github.com/go-chassis/go-chassis/v2/core/invocation" 25 | ) 26 | 27 | //SetLocalServiceAddress assign invocation endpoint a local service address 28 | //header "X-Forwarded-Port" has highest priority 29 | // if it is empty 30 | // it uses ports config in cmd param or env 31 | func SetLocalServiceAddress(inv *invocation.Invocation, port string) error { 32 | inv.Endpoint = cmd.Configs.PortsMap[inv.Protocol] 33 | if port == "" { 34 | inv.Endpoint = cmd.Configs.PortsMap[inv.Protocol] 35 | if inv.Endpoint == "" { 36 | return fmt.Errorf("[%s] is not supported, [%s] didn't set env [%s] or cmd parameter --service-ports before mesher start", 37 | inv.Protocol, inv.MicroServiceName, common.EnvServicePorts) 38 | } 39 | return nil 40 | } 41 | inv.Endpoint = "127.0.0.1:" + port 42 | return nil 43 | } 44 | -------------------------------------------------------------------------------- /docs/getstarted/install.md: -------------------------------------------------------------------------------- 1 | # Quick start 2 | 3 | ### Local 4 | In this case, you will launch one mesher sidecar proxy and 5 | one service developed with go-chassis as provider 6 | and use curl as a dummy consumer to access this service 7 | 8 | The network traffic: curl->mesher->service 9 | 10 | 1. Install ServiceComb [service-center](https://github.com/apache/incubator-servicecomb-service-center/releases) 11 | 12 | 2. Install [go-chassis](https://go-chassis.readthedocs.io/en/latest/getstarted/install.html) and 13 | run [rest server](https://github.com/go-chassis/go-chassis/tree/master/examples/rest/server) 14 | 15 | 3. Build and run, use go mod(go 1.11+, experimental but a recommended way) 16 | 17 | ```shell 18 | cd mesher 19 | GO111MODULE=on go mod download 20 | #optional 21 | GO111MODULE=on go mod vendor 22 | go build mesher.go 23 | ./mesher 24 | ``` 25 | 26 | 4. Verify, in this case curl command is the consumer, mesher is consumer's sidecar, 27 | and rest server is provider 28 | 29 | ```shell 30 | export http_proxy=http://127.0.0.1:30101 31 | curl http://RESTServer:8083/sayhello/peter 32 | ``` 33 | 34 | **Notice**: 35 | 36 | >>You don't need to set service registry in chassis.yaml, 37 | because by default registry address is 127.0.0.1:30100, 38 | just same service center default listen address. 39 | 40 | >>curl command read lower case http_proxy environment variable. 41 | 42 | ### Run on different infrastructures 43 | 44 | Mesher does not bind to any platform or infrastructure, please refer to 45 | https://github.com/go-mesh/mesher-examples/tree/master/Infrastructure 46 | to know how to run mesher on different infrastructures 47 | 48 | ### Sidecar injector 49 | Mesher supply a way to automatically inject mesher configurations in kubernetes 50 | 51 | See detail https://github.com/go-chassis/sidecar-injector 52 | -------------------------------------------------------------------------------- /proxy/protocol/dubbo/utils/bytes_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 util 19 | 20 | import ( 21 | "testing" 22 | 23 | "github.com/stretchr/testify/assert" 24 | ) 25 | 26 | func TestLong2bytes_Bytes2long(t *testing.T) { 27 | bytes := make([]byte, 8) 28 | v := int64(12345) 29 | Long2bytes(v, bytes, 0) 30 | 31 | v1 := Bytes2long(bytes, 0) 32 | assert.Equal(t, v, v1) 33 | } 34 | 35 | func TestShort2bytes_Bytes2short(t *testing.T) { 36 | bytes := make([]byte, 2) 37 | v := int(11) 38 | Short2bytes(v, bytes, 0) 39 | t.Log(bytes) 40 | 41 | v1 := Bytes2short(bytes, 0) 42 | assert.Equal(t, uint16(v), v1) 43 | } 44 | 45 | func TestInt2bytes_Bytes2int(t *testing.T) { 46 | bytes := make([]byte, 4) 47 | v := int(11) 48 | Int2bytes(v, bytes, 0) 49 | t.Log(bytes) 50 | 51 | v1 := Bytes2int(bytes, 0) 52 | assert.Equal(t, int32(v), v1) 53 | } 54 | 55 | func TestS2ByteSlice(t *testing.T) { 56 | bytes := []string{"Hello", " ", "World"} 57 | ss := S2ByteSlice(bytes) 58 | t.Log(ss) 59 | assert.Equal(t, 3, len(ss)) 60 | } 61 | -------------------------------------------------------------------------------- /proxy/resolver/authority/destination.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 authority 19 | 20 | import ( 21 | "fmt" 22 | "github.com/apache/servicecomb-mesher/proxy/resolver" 23 | "github.com/go-chassis/openlog" 24 | "strings" 25 | ) 26 | 27 | //GRPCDefaultDestinationResolver is a struct 28 | type GRPCDefaultDestinationResolver struct { 29 | } 30 | 31 | //Resolve resolves service name 32 | func (dr *GRPCDefaultDestinationResolver) Resolve(sourceAddr, host, rawURI string, header map[string]string) (string, string, error) { 33 | s := strings.Split(rawURI, ":") 34 | if len(s) != 2 { 35 | err := fmt.Errorf("can not parse [%s]", rawURI) 36 | openlog.Error(err.Error()) 37 | return "", "", err 38 | } 39 | 40 | return s[0], s[1], nil 41 | } 42 | 43 | //New return return dr 44 | func New() resolver.DestinationResolver { 45 | return &GRPCDefaultDestinationResolver{} 46 | } 47 | 48 | func init() { 49 | resolver.InstallDestinationResolverPlugin("authority", New) 50 | resolver.SetDefaultDestinationResolver("grpc", &GRPCDefaultDestinationResolver{}) 51 | } 52 | -------------------------------------------------------------------------------- /proxy/control/panel.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 control 19 | 20 | import ( 21 | "fmt" 22 | "github.com/go-chassis/go-chassis/v2/control" 23 | "github.com/go-chassis/go-chassis/v2/core/config" 24 | ) 25 | 26 | var panelPlugin = make(map[string]func(options Options) control.Panel) 27 | 28 | //DefaultPanelEgress get fetch config 29 | var DefaultPanelEgress control.Panel 30 | 31 | //InstallPlugin install implementation 32 | func InstallPlugin(name string, f func(options Options) control.Panel) { 33 | panelPlugin[name] = f 34 | } 35 | 36 | //Options is options 37 | type Options struct { 38 | Address string 39 | } 40 | 41 | //Init initialize DefaultPanel 42 | func Init() error { 43 | infra := config.GlobalDefinition.Panel.Infra 44 | if infra == "" || infra == "archaius" { 45 | return nil 46 | } 47 | 48 | f, ok := panelPlugin[infra] 49 | if !ok { 50 | return fmt.Errorf("do not support [%s] panel", infra) 51 | } 52 | 53 | DefaultPanelEgress = f(Options{ 54 | Address: config.GlobalDefinition.Panel.Settings["address"], 55 | }) 56 | return nil 57 | } 58 | -------------------------------------------------------------------------------- /proxy/ingress/ingress.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 ingress 19 | 20 | import ( 21 | "errors" 22 | "fmt" 23 | "github.com/apache/servicecomb-mesher/proxy/config" 24 | "github.com/go-chassis/go-archaius" 25 | ) 26 | 27 | //error in ingress package 28 | var ( 29 | ErrNotMatch = errors.New("no matching rule") 30 | ) 31 | var plugin = make(map[string]func() (RuleFetcher, error)) 32 | 33 | //RuleFetcher query ingress rule 34 | type RuleFetcher interface { 35 | Fetch(protocol, host, apiPath string, headers map[string][]string) (*config.IngressRule, error) 36 | } 37 | 38 | //DefaultFetcher fetch config 39 | var DefaultFetcher RuleFetcher 40 | 41 | //InstallPlugin install implementation 42 | func InstallPlugin(name string, f func() (RuleFetcher, error)) { 43 | plugin[name] = f 44 | } 45 | 46 | //Init initialize 47 | func Init() error { 48 | t := archaius.GetString("mesher.ingress.type", "servicecomb") 49 | f, ok := plugin[t] 50 | if !ok { 51 | return fmt.Errorf("do not support [%s]", t) 52 | } 53 | var err error 54 | DefaultFetcher, err = f() 55 | return err 56 | } 57 | -------------------------------------------------------------------------------- /docs/development/handler-chain.md: -------------------------------------------------------------------------------- 1 | # Handler chain 2 | All the traffic will go through the handler chain. 3 | A chain is composite of handlers, each handler has a particular logic. 4 | Mesher also has lots of feature working in chain, like route management, circuit breaking and rate-limiting. 5 | In Summary, handler is the middle ware between clients and servers, 6 | it is useful when adding authorization to intercept illegal requests. 7 | 8 | ### How to write a handler 9 | https://docs.go-chassis.com/dev-guides/how-to-implement-handler.html 10 | 11 | ### How to use it in handler chain 12 | In chassis.yaml add your handler name in chain configuration. 13 | As sidecar and API gateway, mesher's chain has different meanings. 14 | 15 | For example, running as mesher-sidecar, service A call another service B, 16 | outgoing chain of service A processes all the service A requests before remote call, 17 | incoming chain of service B processes all the requests from service A, before access to service B API. 18 | 19 | In summary, outgoing chain works when a service attempt to call other services, 20 | incoming chain works when other services call this service. 21 | 22 | ```yaml 23 | handler: 24 | chain: 25 | Consumer: 26 | # if a service call other service, it go through this chain, loadbalance and transport is must 27 | outgoing: router, bizkeeper-consumer, loadbalance, transport 28 | Provider: 29 | incoming: ratelimiter-provider 30 | ``` 31 | 32 | Running as API gateway, 33 | incoming chain processes all the requests from the external network, 34 | outgoing chain processes all the the requests between API gateway and back-end services. 35 | 36 | ```yaml 37 | handler: 38 | chain: 39 | Consumer: 40 | #loadbalance and transport is must 41 | outgoing: router, bizkeeper-consumer, loadbalance, transport 42 | Provider: 43 | incoming: ratelimiter-provider 44 | ``` -------------------------------------------------------------------------------- /proxy/pkg/egress/egress_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 egress_test 19 | 20 | import ( 21 | "fmt" 22 | mesherconfig "github.com/apache/servicecomb-mesher/proxy/config" 23 | "github.com/apache/servicecomb-mesher/proxy/pkg/egress" 24 | "gopkg.in/yaml.v2" 25 | "testing" 26 | ) 27 | 28 | func TestValidateEgressRule(t *testing.T) { 29 | var yamlContent = `--- 30 | egress: 31 | infra: cse # pilot or cse 32 | address: http://istio-pilot.istio-system:15010 33 | egressRule: 34 | google-ext: 35 | - hosts: 36 | - "www.google.com" 37 | - "*.yahoo.com" 38 | ports: 39 | - port: 80 40 | protocol: HTTP 41 | facebook-ext: 42 | - hosts: 43 | - "www.facebook.com" 44 | ports: 45 | - port: 80 46 | protocol: HTTP` 47 | 48 | ss := mesherconfig.EgressConfig{} 49 | err := yaml.Unmarshal([]byte(yamlContent), &ss) 50 | if err != nil { 51 | fmt.Println("unmarshal failed") 52 | } 53 | 54 | bool, err := egress.ValidateEgressRule(ss.Destinations) 55 | if bool == false { 56 | t.Errorf("Expected true but got false") 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /cmd/mesher/mesher.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 | _ "net/http/pprof" 22 | 23 | _ "github.com/apache/servicecomb-mesher/proxy/resolver/authority" 24 | 25 | _ "github.com/apache/servicecomb-mesher/proxy/handler" 26 | //protocols 27 | _ "github.com/apache/servicecomb-mesher/proxy/protocol/dubbo/client/chassis" 28 | _ "github.com/apache/servicecomb-mesher/proxy/protocol/dubbo/server" 29 | _ "github.com/apache/servicecomb-mesher/proxy/protocol/dubbo/simpleRegistry" 30 | _ "github.com/apache/servicecomb-mesher/proxy/protocol/grpc" 31 | _ "github.com/apache/servicecomb-mesher/proxy/protocol/http" 32 | //ingress rule fetcher 33 | _ "github.com/apache/servicecomb-mesher/proxy/ingress/servicecomb" 34 | "github.com/apache/servicecomb-mesher/proxy/server" 35 | 36 | _ "github.com/apache/servicecomb-mesher/proxy/pkg/egress/archaius" 37 | 38 | _ "github.com/apache/servicecomb-mesher/proxy/handler/oauth2" 39 | 40 | //middle wares 41 | _ "github.com/go-chassis/go-chassis/v2/middleware/circuit" 42 | _ "github.com/go-chassis/go-chassis/v2/middleware/ratelimiter" 43 | ) 44 | 45 | func main() { 46 | server.Run() 47 | } 48 | -------------------------------------------------------------------------------- /docker/edge/mesher.yaml: -------------------------------------------------------------------------------- 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 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | ## Router rules and fault injection rules are moved to router.yaml 17 | #plugin: 18 | # destinationResolver: 19 | # http: host # how to turn host to destination name. default to service name, 20 | 21 | admin: #admin API 22 | goRuntimeMetrics : true # enable metrics 23 | enable: true 24 | 25 | ## enable pprof to profile mesher runtime 26 | #pprof: 27 | # enable: false 28 | 29 | #mesher: 30 | # ingress: 31 | # type: servicecomb 32 | # rule: 33 | # http: | 34 | # - host: example.com 35 | # limit: 30 36 | # apiPath: /some/api 37 | # service: 38 | # name: example 39 | # redirectPath: /another/api 40 | # port: 41 | # name: http-legacy 42 | # value: 8080 43 | # - apiPath: /sayerror/api 44 | # service: 45 | # name: Server 46 | # redirectPath: /sayerror 47 | # port: 48 | # name: http 49 | # value: 8080 50 | # - apiPath: /some/api 51 | # service: 52 | # name: Server 53 | # port: 54 | # name: http 55 | # value: 8080 -------------------------------------------------------------------------------- /proxy/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 | //Constants for default app and version 21 | const ( 22 | DefaultApp = "default" 23 | DefaultVersion = "0.0.1" 24 | ) 25 | 26 | //Constants for buildtag app and version 27 | const ( 28 | BuildInTagApp = "app" 29 | BuildInTagVersion = "version" 30 | ) 31 | 32 | //ComponentName is contant for component name 33 | const ComponentName = "mesher" 34 | 35 | //RoleSidecar is constant for side car mode 36 | const RoleSidecar = "sidecar" 37 | 38 | //RoleEdge run as a edge service, or ingress in k8s 39 | const RoleEdge = "edge" 40 | 41 | //RolePerHost is constant for side car mode 42 | const RolePerHost = "per-host" 43 | 44 | //Constants for env specific addr and service ports 45 | const ( 46 | //EnvSpecificAddr Deprecated 47 | EnvSpecificAddr = "SPECIFIC_ADDR" 48 | EnvServicePorts = "SERVICE_PORTS" 49 | ) 50 | 51 | //HTTPProtocol is constant for protocol 52 | const HTTPProtocol = "http" 53 | 54 | //Constants for provider and consumer handlers 55 | const ( 56 | ChainConsumerOutgoing = "outgoing" 57 | ChainProviderIncoming = "incoming" 58 | ChainConsumerEgress = "egress" 59 | ) 60 | 61 | //ConsumerEgress constant for egress 62 | const ConsumerEgress = "ConsumerEgress" 63 | -------------------------------------------------------------------------------- /proxy/protocol/dubbo/utils/thrmgr_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 util 19 | 20 | import ( 21 | "github.com/stretchr/testify/assert" 22 | "testing" 23 | "time" 24 | ) 25 | 26 | func TestNewThreadGroupWait(t *testing.T) { 27 | count := 0 28 | var done chan struct{} 29 | go func(done chan struct{}) { 30 | var tgw *ThreadGroupWait 31 | tgw = NewThreadGroupWait() 32 | tgw.Add(1) 33 | go func(tgw *ThreadGroupWait) { 34 | defer tgw.Done() 35 | count++ 36 | }(tgw) 37 | 38 | tgw.Wait() 39 | close(done) 40 | }(done) 41 | 42 | select { 43 | case <-time.After(time.Second * 5): 44 | case <-done: 45 | } 46 | assert.Equal(t, 1, count) 47 | 48 | // case done count < 0 49 | tgw := NewThreadGroupWait() 50 | tgw.Done() 51 | tgw.Done() 52 | } 53 | 54 | type Task struct { 55 | } 56 | 57 | func (t *Task) Svc(interface{}) interface{} { 58 | return nil 59 | } 60 | 61 | func TestThrmgr(t *testing.T) { 62 | nr := NewRoutineManager() 63 | var done chan struct{} 64 | go func(done chan struct{}) { 65 | nr.Wait() 66 | close(done) 67 | }(done) 68 | 69 | time.AfterFunc(time.Second*2, func() { 70 | nr.Done() 71 | }) 72 | 73 | select { 74 | case <-time.After(time.Second * 5): 75 | case <-done: 76 | } 77 | 78 | nr.Spawn(new(Task), "swap", "routinename") 79 | 80 | } 81 | -------------------------------------------------------------------------------- /proxy/config/struct_ingress_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 | "github.com/apache/servicecomb-mesher/proxy/config" 22 | "github.com/ghodss/yaml" 23 | "github.com/stretchr/testify/assert" 24 | "testing" 25 | ) 26 | 27 | func TestNewRules(t *testing.T) { 28 | b := []byte(` 29 | mesher: 30 | ingress: 31 | type: servicecomb 32 | rule: 33 | http: | 34 | - host: example.com 35 | limit: 30 36 | apiPath: /some/api 37 | service: 38 | name: example 39 | tags: 40 | version: 1.0.0 41 | redirectPath: /another/api 42 | port: 43 | name: http-legacy 44 | value: 8080 45 | - host: foo.com 46 | apiPath: /some/api 47 | service: 48 | name: foo 49 | tags: 50 | version: 1.0.0 51 | redirectPath: /another/api 52 | port: 53 | name: http 54 | value: 8080 55 | `) 56 | c := &config.MesherConfig{} 57 | err := yaml.Unmarshal(b, c) 58 | assert.NoError(t, err) 59 | rules, err := config.NewRules(c.Mesher.Ingress.Rule["http"]) 60 | assert.NoError(t, err) 61 | assert.Equal(t, 2, rules.Len()) 62 | v := rules.Value() 63 | assert.Equal(t, "example", v[0].Service.Name) 64 | } 65 | --------------------------------------------------------------------------------