Esempio n. 1
0
func main() {
	glog.SetLogDirs(".")
	glog.SetLogToStderr(true)

	routers.Init()
	beego.Run()
}
Esempio n. 2
0
func main() {
	glog.SetLogDirs(".")
	glog.SetLogToStderr(true)
	conf := controllers.Gconf
	beego.Get("/federation", func(ctx *context.Context) {
		federation(ctx, conf)
	})

	beego.Get("/ripple.txt", func(ctx *context.Context) {
		f, err := os.Open("ripple.txt")
		if err != nil {
			glog.Fatal(err)
		}
		io.Copy(ctx.ResponseWriter, f)
		f.Close()
	})

	beego.Get("/quote", func(ctx *context.Context) {
		u := "http://" + conf.Host + "/api/quote?" + ctx.Request.URL.RawQuery
		glog.Infoln(u)
		r, err := http.Get(u)
		if err != nil {
			glog.Errorln(err)
			return
		}
		io.Copy(ctx.ResponseWriter, r.Body)
		r.Body.Close()
	})

	beego.Run()
}
Esempio n. 3
0
File: main.go Progetto: wangch/tx
func main() {
	flag.Parse()
	glog.SetLogToStderr(true)
	if *server == "" {
		usage()
		return
	}
	if *sender == "" || len(*sender) != 34 || (*sender)[0] != 'i' {
		usage()
		return
	}
	if *secret == "" || len(*secret) != 29 || (*secret)[0] != 's' {
		usage()
		return
	}
	if *recipient == "" || len(*recipient) != 34 || (*recipient)[0] != 'i' {
		usage()
		return
	}
	if *amount <= 0 {
		glog.Errorln(*amount, "发送金额必须>0")
		return
	}

	ws, err := websockets.NewRemote(*server)
	if err != nil {
		glog.Fatal(err)
	}

	issuer := "iN8sGowQCg1qptWcJG1WyTmymKX7y9cpmr"
	err = payment(ws, *secret, *sender, issuer, *recipient, *currency, "", *amount)
	if err != nil {
		glog.Fatal(err)
	}
}