-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
51 lines (44 loc) · 1.06 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"os"
"github.com/wadeAlexC/ipbw/crawler"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{
Name: "Interplanetary Black Widow",
HelpName: "ipbw",
Usage: "crawls ur ipfs/filecoin nodes",
EnableBashCompletion: true,
UseShortOptionHandling: true,
Flags: []cli.Flag{
&cli.UintFlag{
Name: "duration",
Aliases: []string{"d"},
Value: 0,
Usage: "Specify the `NUM_MINUTES` to run the crawler, or 0 for endless mode.",
},
&cli.StringFlag{
Name: "network",
Aliases: []string{"n"},
Value: "ipfs",
Usage: "Specify the `NETWORK` on which to run the crawler (filecoin / ipfs)",
},
},
Action: func(cctx *cli.Context) error {
dht, err := crawler.NewDHT(
cctx.Uint("duration"),
cctx.String("network"),
)
if err != nil {
return fmt.Errorf("error creating crawler: %v", err)
}
dht.Start()
return nil
},
}
if err := app.Run(os.Args); err != nil {
panic(err) // burn it all to the ground
}
}