Skip to content

Commit

Permalink
【go语言sdk】【v1.0.1】- 新增海外节点
Browse files Browse the repository at this point in the history
新增海外节点
  • Loading branch information
fengyunlong committed Jan 25, 2024
1 parent 2a0661d commit 9dc26f6
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ SDK 中各接口调用方式基本相同,接入方式统一,并提供了一
* 在您的项目中添加module依赖,只需在 go.mod 文件中添加以下依赖项即可。

```
require github.com/yidun/yidun-golang-sdk v1.0.0
require github.com/yidun/yidun-golang-sdk v1.0.1
```

> 注意: 这里的版本号只是举例,您可以在 git 仓库 上找到最新的版本。
Expand Down Expand Up @@ -78,6 +78,16 @@ SDK 中各接口调用方式基本相同,接入方式统一,并提供了一
clientProfile.BreakerConfig.SetStatWindowMillis(10000)
crawlerSubmitClient := crawler.NewCrawlerClient(clientProfile)
```
* 海外节点配置

```
credential := auth.NewCredentials("accessKeyId", "accessKeySecret")
clientProfile := client.NewClientProfile(credential)
// 以访问新加坡节点为例,支持的 region 列表请咨询您的商务经理
clientProfile.SetRegionCode("sg-singapore")
livevideosolution.NewLiveVideoSolutionClient(clientProfile)
```

* 重试配置

```
Expand Down
12 changes: 10 additions & 2 deletions yidun/core/client/default_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,18 @@ func (c *DefaultClient) DoExecute(request types.BaseRequest, data interface{}) e
return paramErr
}
if request.GetProtocol() == "" {
request.SetProtocol(http.DEFAULT_PROTOCOL)
if c.defaultProtocol != "" {
request.SetProtocol(c.defaultProtocol)
} else {
request.SetProtocol(http.DEFAULT_PROTOCOL)
}
}
if request.GetRegionCode() == "" {
request.SetRegionCode(http.DEFAULT_REGION_CODE)
if c.defaultRegionCode != "" {
request.SetRegionCode(c.defaultRegionCode)
} else {
request.SetRegionCode(http.DEFAULT_REGION_CODE)
}
}
// 获取需要签名的参数
request.SetCustomParams(request.GetBusinessCustomSignParams())
Expand Down
16 changes: 14 additions & 2 deletions yidun/core/endpoint/endpoint_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,25 @@ var (
"sg-singapore": [
"as-image-sg.dun.163yun.com",
"as-image-sg.dun.163.com"
]
],
"us-virginia": [
"as-image-virginia.dun.163.com",
"as-image-virginia.dun.163yun.com"
]
},
"imageCommon": {
"cn-hangzhou": [
"as.dun.163.com",
"as.dun.163yun.com"
]
],
"sg-singapore": [
"as-image-sg.dun.163.com",
"as-image-sg.dun.163yun.com"
],
"us-virginia": [
"as-image-virginia.dun.163.com",
"as-image-virginia.dun.163yun.com"
]
},
"text-check": {
"cn-hangzhou": [
Expand Down

0 comments on commit 9dc26f6

Please sign in to comment.