Ejemplo n.º 1
0
func main() {
	flag.Parse()

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}

	contactdb := domain.NewContactDB()
	if err := contactdb.Create(); err != nil {
		log.Fatalf("Error creating contact table: %s", err.Error())
	}

	if *contact_id != "" {
		c, err := contactdb.Lookup(*contact_id)
		if err != nil {
			log.Fatalf("Error looking up contact: %s", err.Error())
		}
		RedecodeContact(contactdb, c)

	} else if *satellite_id != "" {
		contacts, err := contactdb.SearchBySatelliteId(
			*satellite_id, 1000)
		if err != nil {
			log.Fatalf("Error looking up contacts: %s", err.Error())
		}
		for _, c := range contacts {
			RedecodeContact(contactdb, c)
		}

	} else {
		log.Fatalf("Missing option")
	}
}
Ejemplo n.º 2
0
func main() {
	flag.Parse()

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}
	contactdb := domain.NewContactDB()
	stationdb := domain.NewStationDB()

	queue := make(IQProcessingQueue)
	go ProcessIQQueue(queue, contactdb)
	go listenAndServeUploader(contactdb, queue)
	go garbageCollectLoop(*stream_tmp_dir, *gc_threshold_mb, time.Minute)

	AddPacketHttpHandlers(http.DefaultServeMux, contactdb, stationdb)

	log.Printf("Starting streamer server")
	err = http.ListenAndServeTLS(
		*tls_port, *cert_file, *private_key_file, nil)
	if err != nil {
		log.Fatalf("Error starting server: %s", err.Error())
		return
	}
}
Ejemplo n.º 3
0
func main() {
	flag.Parse()
	log.Printf("Starting multiplexer.")

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}
	stationdb := domain.NewStationDB()
	c := mux.NewCoordinator(stationdb)

	go mux.ListenAndServe(c, *cert_file, *private_key_file, *external_port)

	rpc.Register(c)
	rpc.HandleHTTP()
	http.ListenAndServe(*rpc_port, nil)
}
Ejemplo n.º 4
0
func main() {
	flag.Parse()

	mux, err := rpc.DialHTTP("tcp", *mux_address)
	if err != nil {
		log.Fatalf("Mux dial error: %s", err.Error())
	}

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}
	stationdb := domain.NewStationDB()
	contactdb := domain.NewContactDB()

	scheduler.ScheduleForever(stationdb, contactdb, mux)
}
Ejemplo n.º 5
0
func main() {
	flag.Parse()

	mux, err := rpc.DialHTTP("tcp", *mux_address)
	if err != nil {
		log.Fatalf("Mux dial error: %s", err.Error())
	}

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}

	userdb := domain.NewUserDB()
	stationdb := domain.NewStationDB()
	contactdb := domain.NewContactDB()
	commentdb := domain.NewCommentDB()

	s := NewSessions()

	AddLoginHttpHandlers(s, userdb)
	AddStationHttpHandlers(
		http.DefaultServeMux, s, stationdb, mux, userdb, contactdb)
	AddConsoleHttpHandlers(http.DefaultServeMux,
		s, stationdb, contactdb, mux)
	AddHomeHttpHandlers(http.DefaultServeMux, s, stationdb, mux)
	AddSatelliteHttpHandlers(http.DefaultServeMux, s,
		contactdb, userdb, stationdb, commentdb)
	AddRankingHttpHandlers(http.DefaultServeMux, s,
		contactdb, userdb)
	AddCommentsHttpHandlers(http.DefaultServeMux, s, commentdb)
	AddContactsHttpHandlers(http.DefaultServeMux, s, contactdb, stationdb)
	AddUserHttpHandlers(http.DefaultServeMux, s,
		stationdb, userdb, contactdb)

	log.Printf("fe started.")

	err = http.ListenAndServe(*port, nil)
	if err != nil {
		log.Printf("ListenAndServe error: %s", err.Error())
	}
}
Ejemplo n.º 6
0
func main() {
	flag.Parse()
	if len(flag.Args()) == 0 {
		log.Fatalf("Missing command.")
	}

	domain, err := db.NewDomain(*db_prefix)
	if err != nil {
		log.Fatalf("Database error: %s", err.Error())
	}

	cmd := flag.Args()[0]
	if cmd == "restore" {
		restore(domain)
	} else if cmd == "lookup" {
		lookup(domain)
	} else if cmd == "store" {
		store(domain)
	} else {
		log.Fatalf("Unknown command: %s", cmd)
	}
}