-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 595 Bytes
/
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
package main
import (
"github.com/bkolad/gTorrent/db"
i "github.com/bkolad/gTorrent/init"
log "github.com/bkolad/gTorrent/logger"
)
func main() {
db, err := db.InitDB()
if err != nil {
panic(err)
}
log.Info("Starting gTorrent..")
conf := i.NewConf()
initState := i.NewInitState()
log.Debug("Local peer ID: " + conf.PeerID)
galaxy, err := newGalaxy(db, initState, conf)
if err != nil {
panic(err)
}
err = galaxy.saveTorrent()
if err != nil {
panic(err)
}
go func() {
galaxy.retrievePeersFromTracker()
}()
go func() {
galaxy.connectToPeers()
}()
select {}
}