Go - JSON-RPC - “太多冒号” [英] Go - JSON-RPC - "too many colons"

查看:216
本文介绍了Go - JSON-RPC - “太多冒号”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试为比特币调用 HTTP JSON-RPC服务器使用Go(不在GAE),但我得到的错误

I'm trying to call a HTTP JSON-RPC server for Bitcoin using Go (not on GAE), but I get error of

dial tcp http://user:pass@127.0.0.1:8332: too many colons in address



or

dial ip http://user:pass@127.0.0.1:8332: lookup http://user:pass@127.0.0.1:8332: no such host

我试过各种网络配置,但无法完成任何事情。当我在浏览器中输入地址时,我收到了服务器的响应:

I tried various network configurations, but couldn't get anything going. When I just typed the address into the browser, I got a response from the server:

{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

这对于一个空的调用看起来是一个正确的响应。

Which looks like a proper response for an empty call.

如何在Go中正确调用HTTP JSON-RPC服务器?

How do I correctly call that HTTP JSON-RPC server in Go?

推荐答案

在主机周围使用如下括号:

Use brackets around the host like this:

[user:pass@127.0.0.1]:8332

参考:

http:/ /golang.org/src/pkg/net/ipsock.go?s=2247:2304#L68

这篇关于Go - JSON-RPC - “太多冒号”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆