// ListenAndServe listens on proxy.Address and then calls Serve to handle
// requests on incoming connections.
ListenAndServe listens on proxy.Address and then calls Serve to handle
requests on incoming connections.
// ListenAndServe listens on proxy . Address and then calls Serve to handle // requests on incoming connections .
func (p *TCPProxy) ListenAndServe() {
	log.Debugf("Handling tcp connection on %s", p.Address)
	ln, err := net.Listen("tcp", p.Address)
	if err != nil {
		log.Fatalf("Error while listening tcp connection on %s: %v", p.Address, err)
		return
	}
	for {
		conn, err := ln.Accept()
		if err != nil {
			log.Errorf("Error while accepting connection from %v: %v", conn.RemoteAddr(), err)
			return
		}
		go p.ServeTCP(conn)
	}
}
func ( p * TCPProxy ) ListenAndServe ( ) { log . Debugf ( " " , p . Address ) ln , err := net . Listen ( " " , p . Address ) if err != nil { log . Fatalf ( " " , p . Address , err ) return } for { conn , err := ln . Accept ( ) if err != nil { log . Errorf ( " " , conn . RemoteAddr ( ) , err ) return } go p . ServeTCP ( conn ) } }
ListenAndServe listens on proxy.Address and then calls Serve to handle
requests on incoming connections.
ListenAndServe listens on proxy . Address and then calls Serve to handle requests on incoming connections .