gofmt-d and golint-d
Siraj Ravel committed
Sep 10, 2014 at 13:31 UTC
80dc4b35314128707b7aebd435441004d2411fb5
2 files changed
+7
-8
daemon/daemon.go
+3
-3
@@ -2,7 +2,6 @@ package daemon
2
3
import (
4
"encoding/json"
5
- "errors"
5
"fmt"
6
"io"
7
"net"
@@ -13,14 +12,15 @@ import (
12
u "github.com/jbenet/go-ipfs/util"
13
)
14
16
-var ErrInvalidCommand = errors.New("invalid command")
17
-
15
+//DaemonListener listens to an initialized IPFS node and can send it commands instead of
16
+//starting up a new set of connections
17
type DaemonListener struct {
18
node *core.IpfsNode
19
list net.Listener
20
closed bool
21
}
22
23
+//Command accepts user input and can be sent to the running IPFS node
24
type Command struct {
25
Command string
26
Args []string
daemon/daemon_client.go
+4
-5
@@ -5,15 +5,14 @@ import (
5
"io"
6
"net"
7
"os"
8
- "time"
8
+ "time"
9
)
10
11
-
12
-//connects to the address on the network with a timeout and encodes the connection into JSON
11
+//SendCommand connects to the address on the network with a timeout and encodes the connection into JSON
12
func SendCommand(command *Command, server string) error {
14
-
13
+
14
conn, err := net.DialTimeout("tcp", server, time.Millisecond*300)
16
-
15
+
16
if err != nil {
17
return err
18
}