Exemplo n.º 1
0
Arquivo: http.go Projeto: napsy/lab
func init() {
	lab.LoadConf()
	if !(*useHttp || *useHttps) {
		return
	}
	conf := htmod.Config{
		Https: *useHttps,
		Addr:  *htaddr,
	}
	if conf.Https {
		conf.KeyFile = *keyFile
		conf.CertFile = *certFile
		conf.CAFile = *cacertFile
		log.Printf("starting https://%s/\n", conf.Addr)
	} else {
		log.Printf("starting http://%s/\n", conf.Addr)
	}
	lab.Register("htmod", htmod.New(conf))
}
Exemplo n.º 2
0
Arquivo: main.go Projeto: napsy/lab
func main() {
	lab.LoadConf()
	roots := build.Default.SrcDirs()
	lab.Register("roots", roots)
	lab.Register("gosrc", gosrc.New())
	golab := &golab{roots: roots}
	golab.ws = ws.New(ws.Config{
		CapHint: 8000,
		Watcher: ws.NewInotify,
		Filter:  golab,
		Handler: golab,
	})
	defer golab.ws.Close()
	lab.Register("ws", golab.ws)
	lab.Register("golab", golab)
	lab.Start()
	c := make(chan os.Signal)
	signal.Notify(c, os.Interrupt, os.Kill)
	<-c
}