@cryptotaxi247 / kubo / commits / 8eb95faf5

moved http to server/http and implemented serve http subcommand

verokarhu committed Aug 7, 2014 at 19:32 UTC 8eb95faf504de93ab3ef98891342bd205adf46f8
4 files changed +18 -9
README.md
+1 -1
@@ -43,7 +43,7 @@ Tool commands:
43 Advanced Commands:
44
45 mount Mount an ipfs read-only mountpoint.
46 - serve Serve an http gateway into ipfs.
46 + serve Serve an interface to ipfs.
47
48 Use "ipfs help <command>" for more information about a command.
49 ```
cmd/ipfs/ipfs.go
+1 -1
@@ -35,7 +35,7 @@ Tool commands:
35 Advanced Commands:
36
37 mount Mount an ipfs read-only mountpoint.
38 - serve Serve an http gateway into ipfs.
38 + serve Serve an interface to ipfs.
39
40 Use "ipfs help <command>" for more information about a command.
41 `,
cmd/ipfs/serve.go
+16 -7
@@ -5,23 +5,32 @@ import (
5 "fmt"
6 "github.com/gonuts/flag"
7 "github.com/jbenet/commander"
8 - h "github.com/jbenet/go-ipfs/http"
8 + h "github.com/jbenet/go-ipfs/server/http"
9 )
10
11 var cmdIpfsServe = &commander.Command{
12 UsageLine: "serve",
13 + Short: "Serve an interface to ipfs",
14 + Subcommands: []*commander.Command{
15 + cmdIpfsServeHttp,
16 + },
17 + Flag: *flag.NewFlagSet("ipfs-serve", flag.ExitOnError),
18 +}
19 +
20 +var cmdIpfsServeHttp = &commander.Command{
21 + UsageLine: "http",
22 Short: "Serve an HTTP API",
14 - Long: `ipfs serve - Serve an http gateway into ipfs.`,
15 - Run: serveCmd,
16 - Flag: *flag.NewFlagSet("ipfs-serve", flag.ExitOnError),
23 + Long: `ipfs serve http - Serve an http gateway into ipfs.`,
24 + Run: serveHttpCmd,
25 + Flag: *flag.NewFlagSet("ipfs-serve-http", flag.ExitOnError),
26 }
27
28 func init() {
20 - cmdIpfsServe.Flag.Uint("port", 8080, "Port number")
21 - cmdIpfsServe.Flag.String("hostname", "localhost", "Hostname")
29 + cmdIpfsServeHttp.Flag.Uint("port", 8080, "Port number")
30 + cmdIpfsServeHttp.Flag.String("hostname", "localhost", "Hostname")
31 }
32
24 -func serveCmd(c *commander.Command, _ []string) error {
33 +func serveHttpCmd(c *commander.Command, _ []string) error {
34 port := c.Flag.Lookup("port").Value.Get().(uint)
35 if port < 1 || port > 65535 {
36 return errors.New("invalid port number")
server/http/http.go renamed