Example #1
0
func main() {
	var err error

	if len(os.Args) < 2 {
		fmt.Printf("usage: janus-echotest </path/to/config>\n")
		return
	}

	if _, err := toml.DecodeFile(os.Args[1], &config); err != nil {
		fmt.Printf("toml.Decode: %s\n", err)
		return
	}

	output, err = template.ParseFiles(config.Html)
	if err != nil {
		fmt.Printf("template.ParseFiles: %s\n", err)
		return
	}

	gateway, err = janus.Connect(config.Path)
	if err != nil {
		fmt.Printf("Connect: %s\n")
		return
	}

	http.HandleFunc("/", EchoTest)
	http.ListenAndServe(fmt.Sprintf(":%d", config.Port), nil)
}
Example #2
0
func main() {
	if len(os.Args) < 2 {
		fmt.Printf("usage: janus-echotest </path/to/socket>\n")
		return
	}

	gateway, err := janus.Connect(os.Args[1])
	if err != nil {
		fmt.Printf("Connect: %s\n")
		return
	}

	info, err := gateway.Info()
	if err != nil {
		fmt.Printf("Info: %s\n", err)
		return
	}

	infoStr, _ := json.MarshalIndent(info, "", "\t")
	fmt.Printf("%s\n", string(infoStr))
	gateway.Close()
}