Comments (13)
Hi,
从测试结果来看,可以定位为环境问题,两种可能:
- OSX Go的问题,在验证HTTPS证书时找的CA证书不对
- 环境CA证书有问题
对于OSX环境的这个错误,我只看到go源码的这个文件出现,如果想排查可以根据源码看看哪里有问题:https://github.com/golang/go/blob/release-branch.go1.9/src/crypto/x509/verify.go#L405
如果无法解决,也可以先用Insecure方式绕过,等部署到其他环境时再去掉。
from go-binance.
Hi @rafw ,
Could you give more info about this issue? the code snippet, output, etc.
from go-binance.
package main
import (
"github.com/adshao/go-binance"
"fmt"
"context"
)
func main() {
client := binance.NewClient("", "")
trades, err := client.NewAggTradesService().
Symbol("LTCBTC").StartTime(1508673256594).EndTime(1508673256595).
Do(context.Background())
if err != nil {
fmt.Println(err)
return
}
for _, t := range trades {
fmt.Println(t)
}
}
from go-binance.
Almost the same as your sample code. I removed access key and secret key in the demo.
Output:
Get https://www.binance.com/api/v1/aggTrades?endTime=1508673256595&startTime=1508673256594&symbol=LTCBTC: x509: certificate signed by unknown authority
from go-binance.
seems like a certificate issue on your server, can you try to update your ca bundle? if you are using CentOS, try this: sudo yum reinstall ca-certificates
I guess it is casued by the changing of binance ssl certificate recently.
from go-binance.
哎呀妈呀,我用的是macOs 10.11,同样的代码放在ubuntu上就对了。同样这个mac上,用chrome\firefox访问也能正确返回数据,连验证都不需要,直接输入https://www.binance.com/api/v1/aggTrades?symbol=NEOBTC
就行了。
https://support.globalsign.com/customer/portal/articles/1353318-view-and-or-delete-crl-ocsp-cache
按此方法删除证书缓存是没有作用的。
tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } client.HTTPClient.Transport = tr
这个方法可以绕过验证,但绕过安全验证不是好办法
golang/go#16589
andygrunwald/go-jira#52
https://github.com/hashicorp/go-rootcerts
这几个帖子感觉比较接近真相,但是不知道这个库怎么用于binance的https api。
究竟咋回事呢?老闹心了。
from go-binance.
请问你的Go版本是什么?根据你提供的几个链接,升级到Go1.9是否还存在这个问题?
from go-binance.
从1.7升级到1.9,还是一样的,按外国论坛的说法是因为mac 10.10、10.11导致的,升级操作系统可以解决。但是我不敢升级,现在升级是要到10.13.1了,不是稳定版
from go-binance.
我在OSX 10.12上没有遇到这个问题,看样子是跟本地环境有关。有几个方法可以确认是否是OSX上Go的问题:
- 本地执行
curl https://www.binance.com/api/v1/aggTrades?endTime=1508673256595&startTime=1508673256594&symbol=LTCBTC
是否正常 - 本地使用Go访问其他https站点,或者使用另外的go binance SDK访问看看是否有同样的问题
from go-binance.
1、使用其他go binance库也有同样的报错
2、使用go的官方http库访问“https://www.binance.com/” 也有同样的报错
3、使用go的官方http库访问“https://www.baidu.com/” 一切正常
4、curl https://www.binance.com/api/v1/aggTrades?symbol=LTCBTC 一切正常
from go-binance.
嗯,等过段时间10.13稳定版出了,我升级后再试。程序最终也是linux、windows下跑,我更担心是mac不安全导致的。
from go-binance.
ok,如果解决了,麻烦告知解决办法。谢谢。
from go-binance.
升级到最新版本10.13.1,问题解决了 🆗
from go-binance.
Related Issues (20)
- how to get permission? HOT 2
- Crypto Box? HOT 1
- <APIError> code=-1106, msg=Parameter 'reduceonly' sent when not required. HOT 1
- how to keep listenKey alive? HOT 1
- when listenKey expired get error:json: cannot unmarshal string into Go struct field WsUserDataEvent.E of type int64 HOT 2
- can not get balance
- unexpected end of JSON input
- is threre subToMaster or masterToSub method?
- is there demo code to use subtoSub?
- something wrong happened when I get account asset? HOT 3
- [feat] support biance non-global HOT 2
- Support Query Margin Available Inventory
- Please do a new release HOT 10
- How to get x-mbx-used-weight-1m? HOT 2
- binance.WebsocketTimeout = time.Second * 5 Not working !
- Support for ed25519 secret/signing
- [error] msg=Invalid API-key, IP, or permissions for action. HOT 1
- [info] how to increase precision
- [Question] Trade service for delivery (futures coin) to fetch recent trades
- [issue] WsBLVTKlineServe is not returning anything
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-binance.