20 lines
339 B
Go
20 lines
339 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
"net/http"
|
|
"net/http/httputil"
|
|
"net/url"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
url, err := url.Parse(fmt.Sprintf("http://%s", os.Getenv("DESTINATION_ADDR")))
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
proxy := httputil.NewSingleHostReverseProxy(url)
|
|
log.Fatal(http.ListenAndServe(os.Getenv("SOURCE_ADDR"), proxy))
|
|
}
|