Skip to content

Commit

Permalink
Merge pull request #2 from dubbogo/develop
Browse files Browse the repository at this point in the history
new request

Former-commit-id: d08f7c7 [formerly 22cdd82]
Former-commit-id: d08f7c7
Former-commit-id: 873c9ce
  • Loading branch information
xianlezheng authored Nov 14, 2020
2 parents 1836657 + e7151aa commit ce0748f
Show file tree
Hide file tree
Showing 88 changed files with 4,524 additions and 493 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ jobs:
/tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
- name: Go Test
run: GO111MODULE=on && go mod vendor && go test ./... -bench . -race -v -coverprofile=coverage.txt
run: |
chmod u+x before_ut.sh && ./before_ut.sh
go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic
# chmod +x integrate_test.sh && ./integrate_test.sh

- name: Coverage
run: bash <(curl -s https://codecov.io/bash)
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
./dubbo-go-proxy
/logs
/.idea
/.vscode
/.vscode
pkg/registry/zookeeper-4unittest/contrib/fatjar
10 changes: 9 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ install: true

script:
- go fmt ./... && [[ -z `git status -s` ]]
- sh before_validate_license.sh
- chmod u+x /tmp/tools/license/license-header-checker
- /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]]
# unit-test
- echo 'start unit-test'
- chmod u+x before_ut.sh && ./before_ut.sh
- go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic

after_success:
- bash <(curl -s https://codecov.io/bash)

notifications:
webhooks: https://oapi.dingtalk.com/robot/send?access_token=e6b085c90561a7543cc5fde89e9c8108100460c15e955c0604fea180a500a0ad
webhooks: https://oapi.dingtalk.com/robot/send?access_token=e6b085c90561a7543cc5fde89e9c8108100460c15e955c0604fea180a500a0ad
25 changes: 25 additions & 0 deletions before_ut.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

zkJarName="zookeeper-3.4.9-fatjar.jar"
remoteJarUrl="https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/${zkJarName}"
zkJarPath="pkg/registry/zookeeper-4unittest/contrib/fatjar"
zkJar="${zkJarPath}/${zkJarName}"

if [ ! -f "${zkJar}" ]; then
mkdir -p ${zkJarPath}
wget -P "${zkJarPath}" ${remoteJarUrl}
fi
12 changes: 11 additions & 1 deletion cmd/proxy/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ var (
EnvVar: "DUBBOGO_PROXY_CONFIG",
Value: "configs/conf.yaml",
},
cli.StringFlag{
Name: "api-config, a",
Usage: "Load api configuration from `FILE`",
EnvVar: "DUBBOGO_PROXY_API_CONFIG",
Value: "configs/api_config.yaml",
},
cli.StringFlag{
Name: "log-config, lc",
Usage: "Load log configuration from `FILE`",
Expand All @@ -73,15 +79,19 @@ var (
},
Action: func(c *cli.Context) error {
configPath := c.String("config")
apiConfigPath := c.String("api-config")
flagLogLevel := c.String("log-level")
logConfPath := c.String("log-config")

bootstrap := config.Load(configPath)
if logLevel, ok := flagToLogLevel[flagLogLevel]; ok {
logger.SetLoggerLevel(logLevel)
}

logger.InitLog(logConfPath)
if _, err := config.LoadAPIConfigFromFile(apiConfigPath); err != nil {
logger.Errorf("load api config error:%+v", err)
return err
}

limitCpus := c.Int("limit-cpus")
if limitCpus <= 0 {
Expand Down
8 changes: 8 additions & 0 deletions cmd/proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,15 @@ import (
)

import (
_ "github.com/apache/dubbo-go/metadata/service/inmemory"
"github.com/urfave/cli"
_ "net/http/pprof"
)

import (
_ "github.com/dubbogo/dubbo-go-proxy/pkg/filter/recovery"
_ "github.com/dubbogo/dubbo-go-proxy/pkg/filter/remote"
_ "github.com/dubbogo/dubbo-go-proxy/pkg/filter/timeout"
)

// Version proxy version
Expand Down
23 changes: 5 additions & 18 deletions configs/api_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,22 @@ resources:
- filter0
methods:
- httpVerb: GET
filters:
- filterA
- filterB
onAir: true
inboundRequest:
requestType: http
headers:
- name: auth
required: true
queryStrings:
- name: id
required: false
- name: type
required: false
requestBody:
- definitionName: modelDefinition
integrationRequest:
requestType: dubbo
mappingParams:
- name: queryStrings.id
mapTo: 1
applicationName: BDTService
group: test
version: 1.0.0
interface: com.ikurento.user.UserProvider
Method: GetUser
paramTypes:
- java.lang.String
ClusterName: test_dubbo
applicationName: "BDTService"
interface: "com.ikurento.user.UserProvider"
method: "GetUser"
clusterName: "test_dubbo"

definitions:
- name: modelDefinition
schema: >-
Expand Down
57 changes: 0 additions & 57 deletions configs/client.yml

This file was deleted.

35 changes: 33 additions & 2 deletions configs/conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,24 @@ static_resources:
allow_origin:
- "*"
enabled: true
authority_config:
authority_rules:
- strategy: "Blacklist"
limit: "IP"
items:
- "127.0.0.1"
- strategy: "Whitelist"
limit: "App"
items:
- "test_dubbo"
http_filters:
- name: dgp.filters.http.authority_filter
config:
- name: dgp.filters.http.api
config:
- name: dgp.filters.http.router
config:
- name: dgp.filters.http_transfer_dubbo
- name: dgp.filters.remote_call
config:
server_name: "test_http_dubbo"
generate_request_id: false
Expand All @@ -44,6 +56,25 @@ static_resources:
write_timeout: 5s
clusters:
- name: "test_dubbo"
type: "EDS"
lb_policy: "RoundRobin"
connect_timeout: "5s"
request_timeout: "10s"
registries:
"zookeeper":
timeout: "3s"
address: "127.0.0.1:2182"
username: ""
password: ""
"consul":
timeout: "3s"
address: "127.0.0.1:8500"
shutdown_config:
timeout: "60s"
step_timeout: "10s"
reject_policy: "immediacy"
pprofConf:
enable: true
address:
socket_address:
address: "0.0.0.0"
port: 6060
Loading

0 comments on commit ce0748f

Please sign in to comment.