Example #1
0
func runHTTPProxyServer(conf Config, router socks.Router) {
	if conf.HTTPProxyAddr != "" {
		listener, err := net.Listen("tcp", conf.HTTPProxyAddr)
		if err != nil {
			return
		}
		go func() {
			defer listener.Close()
			httpProxy := socks.NewHTTPProxy(router)
			http.Serve(listener, httpProxy)
		}()
	}
}
Example #2
0
File: main.go Project: mycopy/socks
func runHTTPProxyServer(conf Proxy, router socks.Dialer) {
	if conf.HTTP != "" {
		listener, err := net.Listen("tcp", conf.HTTP)
		if err != nil {
			ErrLog.Println("net.Listen at ", conf.HTTP, " failed, err:", err)
			return
		}
		go func() {
			defer listener.Close()
			httpProxy := socks.NewHTTPProxy(router)
			http.Serve(listener, httpProxy)
		}()
	}
}