示例#1
0
文件: main.go 项目: blackmady/socks
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)
		}()
	}
}
示例#2
0
文件: main.go 项目: 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)
		}()
	}
}