Esempio n. 1
0
func main() {
	kiss.SetCipher(kicrypt.AS_aes256_ofb)
	INFO("Kirisurf started! CPU count: %d", runtime.NumCPU())
	runtime.GOMAXPROCS(runtime.NumCPU())
	go run_monitor_loop()
	go run_diagnostic_loop()
	dirclient.DIRADDR = MasterConfig.General.DirectoryURL
	dirclient.RefreshDirectory()
	if MasterConfig.General.Role == "server" {
		NewSCServer(MasterConfig.General.ORAddr)
		prt, _ := strconv.Atoi(
			strings.Split(MasterConfig.General.ORAddr, ":")[1])
		dirclient.RunRelay(prt, MasterKeyHash,
			MasterConfig.General.IsExit)
		for {
			time.Sleep(time.Second)
		}
	} else if MasterConfig.General.Role == "client" {
		run_client_loop()
	}
	INFO("Kirisurf exited")
}
Esempio n. 2
0
func enfreshen_scb() {
	var wg sync.WaitGroup
	wg.Add(7)
	ctr := 0.0
	for i := 0; i < 7; i++ {
		i := i
		go func() {
			INFO("Building initial subcircuit #%d...", i)
		retry:
			thing, err := build_subcircuit()
			if err != nil {
				WARNING("Building of initial subcircuit #%d encountered trouble (%s), retrying...", i, err.Error())
				dirclient.RefreshDirectory()
				goto retry
			}
			INFO("Building of initial subcircuit %d done, pushing into buffer...", i)
			ctx_buffer <- make_e2e_client_ctx(thing.wire)
			ctr = ctr + 0.1
			set_gui_progress(ctr)
			wg.Done()
		}()
	}
	wg.Wait()
}