Remote Proxy - For Http Injector
clientConn.Write([]byte("HTTP/1.1 200 Connection Established\r\n\r\n"))
func main() { flag.Parse() http.HandleFunc("/", handle) log.Printf("Remote proxy listening on %s", *listenAddr) log.Fatal(http.ListenAndServe(*listenAddr, nil)) } Build: remote proxy for http injector
func handleInjectorTunnel(w http.ResponseWriter, r *http.Request) { dest, err := extractDestination(r) if err != nil { http.Error(w, "Missing destination", http.StatusBadRequest) return } clientConn
// Bidirectional copy go func() { io.Copy(destConn, clientConn) }() io.Copy(clientConn, destConn) } handle) log.Printf("Remote proxy listening on %s"
clientConn.Write([]byte("HTTP/1.1 200 OK\r\n\r\n"))
destConn, err := net.Dial("tcp", dest) if err != nil { log.Printf("Failed to connect to %s: %v", dest, err) http.Error(w, err.Error(), http.StatusBadGateway) return } defer destConn.Close()
