package ipjogli

import (
	"fmt"
	"net/http"
)

func init() {
	http.HandleFunc("/", handler)
}

func handler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintf(w, r.RemoteAddr+"\n")
}

package ipjogli

import (
	"fmt"
	"net"
	"net/http"
)

func init() {
	http.HandleFunc("/", handler)
}

func handler(w http.ResponseWriter, r *http.Request) {
	addr, _, err := net.SplitHostPort(r.RemoteAddr)
	if err != nil {
		w.WriteHeader(http.StatusInternalServerError)
		return
	}
	fmt.Fprintf(w, addr+"\n")
}

Split IP and port from RemoteAddr
Split IP and port from RemoteAddr

Request.RemoteAddr should be an IP:port. GAE must be doing some magic to
only provide the IP to the app instance as it never contained the port.

This adds it in anyway so that local (non-GAE) apps return the correct
thing.
