Last active
August 29, 2015 14:17
-
-
Save michaljemala/a5cdfd0f3ca47b76f092 to your computer and use it in GitHub Desktop.
A sample Go app demonstrating the 150.214.47.153:35443 is not accessible on PWS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"log" | |
"net" | |
"net/http" | |
"os" | |
) | |
func main() { | |
http.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { | |
conn, err := net.Dial("tcp", "150.214.47.153:35443") | |
if err != nil { | |
http.Error(w, err.Error(), 500) | |
return | |
} | |
defer conn.Close() | |
fmt.Fprintf(w, "OK") | |
}) | |
var port string | |
if port = os.Getenv("PORT"); port == "" { | |
port = "8080" | |
} | |
log.Printf("Listening at port %v\n", port) | |
if err := http.ListenAndServe(":"+port, nil); err != nil { | |
log.Fatal(err) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment