gofmt
This commit was moved from ipfs/go-ipfs-http-client@65cd935e13a2ea05befbc69d72d64a89056952ea
Łukasz Magiera committed
Feb 19, 2019 at 23:28 UTC
f6a3a4fb2d715ffc0394408287b23eae0d322631
6 files changed
+30
-31
client/httpapi/api.go
+3
-3
@@ -136,9 +136,9 @@ func (api *HttpApi) WithOptions(opts ...caopts.ApiOption) (iface.CoreAPI, error)
136
137
func (api *HttpApi) request(command string, args ...string) *RequestBuilder {
138
return &RequestBuilder{
139
- command: command,
140
- args: args,
141
- shell: api,
139
+ command: command,
140
+ args: args,
141
+ shell: api,
142
}
143
}
144
client/httpapi/pin.go
+2
-2
@@ -132,9 +132,9 @@ func (api *PinAPI) Verify(ctx context.Context) (<-chan iface.PinStatus, error) {
132
for {
133
var out struct {
134
Cid string
135
- Ok bool
135
+ Ok bool
136
137
- BadNodes []struct{
137
+ BadNodes []struct {
138
Cid string
139
Err string
140
}
client/httpapi/request.go
+11
-11
@@ -7,12 +7,12 @@ import (
7
)
8
9
type Request struct {
10
- ApiBase string
11
- Command string
12
- Args []string
13
- Opts map[string]string
14
- Body io.Reader
15
- Headers map[string]string
10
+ ApiBase string
11
+ Command string
12
+ Args []string
13
+ Opts map[string]string
14
+ Body io.Reader
15
+ Headers map[string]string
16
}
17
18
func NewRequest(ctx context.Context, url, command string, args ...string) *Request {
@@ -25,10 +25,10 @@ func NewRequest(ctx context.Context, url, command string, args ...string) *Reque
25
"stream-channels": "true",
26
}
27
return &Request{
28
- ApiBase: url + "/api/v0",
29
- Command: command,
30
- Args: args,
31
- Opts: opts,
32
- Headers: make(map[string]string),
28
+ ApiBase: url + "/api/v0",
29
+ Command: command,
30
+ Args: args,
31
+ Opts: opts,
32
+ Headers: make(map[string]string),
33
}
34
}
client/httpapi/requestbuilder.go
+5
-5
@@ -14,11 +14,11 @@ import (
14
15
// RequestBuilder is an IPFS commands request builder.
16
type RequestBuilder struct {
17
- command string
18
- args []string
19
- opts map[string]string
20
- headers map[string]string
21
- body io.Reader
17
+ command string
18
+ args []string
19
+ opts map[string]string
20
+ headers map[string]string
21
+ body io.Reader
22
23
shell *HttpApi
24
}
client/httpapi/response.go
-1
@@ -119,7 +119,6 @@ func (r *Request) Send(c *http.Client) (*Response, error) {
119
return nil, err
120
}
121
122
-
122
contentType, _, err := mime.ParseMediaType(resp.Header.Get("Content-Type"))
123
if err != nil {
124
return nil, err
client/httpapi/swarm.go
+9
-9
@@ -33,10 +33,10 @@ func (api *SwarmAPI) Disconnect(ctx context.Context, addr multiaddr.Multiaddr) e
33
}
34
35
type connInfo struct {
36
- addr multiaddr.Multiaddr
37
- peer peer.ID
36
+ addr multiaddr.Multiaddr
37
+ peer peer.ID
38
latency time.Duration
39
- muxer string
39
+ muxer string
40
direction inet.Direction
41
streams []protocol.ID
42
}
@@ -63,11 +63,11 @@ func (c *connInfo) Streams() ([]protocol.ID, error) {
63
64
func (api *SwarmAPI) Peers(ctx context.Context) ([]iface.ConnectionInfo, error) {
65
var resp struct {
66
- Peers []struct{
67
- Addr string
68
- Peer string
66
+ Peers []struct {
67
+ Addr string
68
+ Peer string
69
Latency time.Duration
70
- Muxer string
70
+ Muxer string
71
Direction inet.Direction
72
Streams []struct {
73
Protocol string
@@ -86,8 +86,8 @@ func (api *SwarmAPI) Peers(ctx context.Context) ([]iface.ConnectionInfo, error)
86
res := make([]iface.ConnectionInfo, len(resp.Peers))
87
for i, conn := range resp.Peers {
88
out := &connInfo{
89
- latency: conn.Latency,
90
- muxer: conn.Muxer,
89
+ latency: conn.Latency,
90
+ muxer: conn.Muxer,
91
direction: conn.Direction,
92
}
93