예제 #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
}
예제 #2
0
파일: main.go 프로젝트: shizhh/lantern
// RunClientProxy creates a new client at the given address.
func RunClientProxy(listenAddr, appName string) error {
	defaultClient = client.NewClient(listenAddr, appName)
	defaultClient.ServeHTTP()
	return nil
}