summaryrefslogtreecommitdiff
path: root/ip.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2015-04-03 15:13:03 +0200
committerDimitri Sokolyuk <demon@dim13.org>2015-04-03 15:13:03 +0200
commit4a2cc6a11228bd233fdc46ef67ced6098e916147 (patch)
tree16f2aaf40c9f4cb0c300a8c2b99527c7b8183ce1 /ip.go
parentc5d00702d260a6cd91a18ce1cc0872f2eb583e15 (diff)
kiss
Diffstat (limited to 'ip.go')
-rw-r--r--ip.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/ip.go b/ip.go
index 7a4679f..d3cd599 100644
--- a/ip.go
+++ b/ip.go
@@ -7,12 +7,13 @@ import (
)
func init() {
- http.HandleFunc("/ip",
- func(w http.ResponseWriter, r *http.Request) {
- ra := r.RemoteAddr
- if n := strings.Index(ra, ":"); n >= 0 {
- ra = ra[:n]
- }
- io.WriteString(w, ra)
- })
+ http.HandleFunc("/ip", ip)
+}
+
+func ip(w http.ResponseWriter, r *http.Request) {
+ ra := r.RemoteAddr
+ if n := strings.Index(ra, ":"); n >= 0 {
+ ra = ra[:n]
+ }
+ io.WriteString(w, ra)
}