Example #1
0
//initialize logger.
func init() {
	logging = log.New(os.Stdout, "",
		log.Ldate|log.Ltime|log.Lshortfile)

	logging.Println("registering MetaDisk service...")

	s2 := commons.Service{}
	s2.Name = "MetaDisk"
	s2.Desc = `You can upload your data to the Storj network with a simple drag and drop.`
	s2.ImageURL = "http://storj.io/img/metadisk.png"
	commons.RegisterService(&s2)
	commons.RegisterHandler("/", &s2, Asset, nil)

	http.HandleFunc("/MetaDisk/api/upload", upload)
	http.HandleFunc("/MetaDisk/api/download/", download)
	http.HandleFunc("/MetaDisk/accounts/token/new/", tokenNew)
	http.HandleFunc("/MetaDisk/api/find/", find)
	http.HandleFunc("/MetaDisk/api/status/", status)
	http.HandleFunc("/MetaDisk/accounts/token/balance/", balance)

	//only for test
	telehashh, err := storjtelehash.NewStorjTelehashTest(0)
	if err == nil {
		telehash = telehashh
	}

}
Example #2
0
//initialize logger.
func init() {
	logging = log.New(os.Stdout, "",
		log.Ldate|log.Ltime|log.Lshortfile)

	logging.Println("registering DriveShare service...")
	s := commons.Service{}
	s.Name = "DriveShare"
	s.Desc = `
	Earn money for being a part of the Storj network 
	by lending unused internet bandwidth and hard disk space on your computer.`
	s.ImageURL = "http://storj.io/img/driveshare.png"
	commons.RegisterService(&s)

	commons.Telehash.AddChannel("farming", newUploadHandler)
	commons.Telehash.AddChannel("heartbeat", newHeartbeatHandler)
	commons.Telehash.AddChannel("retrieving", newRetrieveHandler)

	loc, err := commons.Telehash.GetMyLocation()
	if err != nil {
		logging.Println(err.Error())
		return
	}
	logging.Println("DriveShare location:", loc)
	commons.RegisterHandler("/", &s, Asset, nil)

	http.HandleFunc("/DriveShare/jqueryFileTree", fileTree)
}