Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
48bd73c5
Commit
48bd73c5
authored
Oct 27, 2014
by
Matt Bell
Committed by
Juan Batiz-Benet
Nov 04, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands/http: Made client load RPC host from config
parent
20f86c01
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
commands/http/client.go
commands/http/client.go
+14
-2
No files found.
commands/http/client.go
View file @
48bd73c5
...
...
@@ -6,14 +6,26 @@ import (
"net/http"
"strings"
ma
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr"
manet
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multiaddr/net"
cmds
"github.com/jbenet/go-ipfs/commands"
)
const
ApiPath
=
"/api/v0"
func
Send
(
req
cmds
.
Request
)
(
cmds
.
Response
,
error
)
{
// TODO: load RPC host from config
url
:=
"http://localhost:8080"
+
ApiPath
addr
,
err
:=
ma
.
NewMultiaddr
(
req
.
Context
()
.
Config
.
Addresses
.
API
)
if
err
!=
nil
{
return
nil
,
err
}
_
,
host
,
err
:=
manet
.
DialArgs
(
addr
)
if
err
!=
nil
{
return
nil
,
err
}
url
:=
"http://"
+
host
+
ApiPath
url
+=
"/"
+
strings
.
Join
(
req
.
Path
(),
"/"
)
// TODO: support other encodings once we have multicodec to decode response
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment