Example #1
0
// RunClientProxy creates a new client at the given address.
func RunClientProxy(listenAddr string) error {

	defaultClient = client.NewClient(listenAddr)

	go func() {
		var err error
		if err = defaultClient.ListenAndServe(); err != nil {
			// Error is not exported: https://golang.org/src/net/net.go#L284
			if !strings.Contains(err.Error(), "use of closed network connection") {
				panic(err.Error())
			}
		}
	}()
	return nil
}
Example #2
0
// RunClientProxy creates a new client at the given address.
func RunClientProxy(listenAddr, appName string) error {
	defaultClient = client.NewClient(listenAddr, appName)
	defaultClient.ServeHTTP()
	return nil
}