-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.go
68 lines (61 loc) · 1.52 KB
/
start.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"log"
"os"
"os/signal"
"github.com/AaronGoldman/ccfs/interfaces/crawler"
//"github.com/AaronGoldman/ccfs/interfaces/fuse"
"github.com/AaronGoldman/ccfs/interfaces/web"
"github.com/AaronGoldman/ccfs/objects"
"github.com/AaronGoldman/ccfs/services"
"github.com/AaronGoldman/ccfs/services/appsscript"
"github.com/AaronGoldman/ccfs/services/directhttp"
//"github.com/AaronGoldman/ccfs/services/googledrive"
"github.com/AaronGoldman/ccfs/services/kademliadht"
"github.com/AaronGoldman/ccfs/services/localfile"
"github.com/AaronGoldman/ccfs/services/multicast"
"github.com/AaronGoldman/ccfs/services/timeout"
)
func start() {
go func() { //defining, calling and throwing to a different thread
ch := make(chan os.Signal, 1) //ch is the name of the channel.
signal.Notify(ch, os.Interrupt, os.Kill)
sig := <-ch
log.Printf("Got signal: %s", sig)
log.Printf("Stopping...")
stopAll()
}()
//This Block registers the services for the object module to use
objects.RegisterGeterPoster(
services.GetPublicKeyForHkid,
services.GetPrivateKeyForHkid,
services.PostKey,
services.PostBlob,
)
Flags, Command := parseFlags()
go localfile.Start()
go timeout.Start()
if *Flags.serve {
web.Start()
crawler.Start()
}
//if *Flags.mount {
// fuse.Start()
//}
if *Flags.dht {
kademliadht.Start()
}
if *Flags.apps {
appsscript.Start()
}
//if *Flags.drive {
// googledrive.Start()
//}
if *Flags.direct {
directhttp.Start()
}
if *Flags.lan {
multicast.Start()
}
addCurators(Command)
}