(+)add project files

This commit is contained in:
Fan Yang 2014-08-14 14:15:52 +08:00
parent 0f0349ee14
commit 8797f2a330
11 changed files with 539 additions and 0 deletions

3
conf/app.conf Normal file
View File

@ -0,0 +1,3 @@
appname = ifconfig
httpport = 8080
runmode = pro

249
controllers/default.go Normal file
View File

@ -0,0 +1,249 @@
package controllers
import (
"bytes"
"github.com/astaxie/beego"
"strings"
)
type MainController struct {
beego.Controller
}
func (this *MainController) GetForwarded() {
if len(this.Ctx.Request.Header["X-Forwarded-For"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["X-Forwarded-For"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetHost() {
this.Data["Value"] = this.Ctx.Request.Host
this.TplNames = "value.tpl"
}
func (this *MainController) GetIP() {
this.Data["Value"] = this.Ctx.Input.IP()
this.TplNames = "value.tpl"
}
func (this *MainController) GetPort() {
remote_addr := []byte(this.Ctx.Request.RemoteAddr)
pos := bytes.IndexByte(remote_addr, ':')
this.Data["Value"] = string(remote_addr[pos+1:])
this.TplNames = "value.tpl"
}
func (this *MainController) GetVia() {
if len(this.Ctx.Request.Header["Via"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Via"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetMime() {
if len(this.Ctx.Request.Header["Accept"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Accept"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetLang() {
if len(this.Ctx.Request.Header["Accept-Language"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Accept-Language"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetCharset() {
if len(this.Ctx.Request.Header["Charset"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Charset"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetEncoding() {
if len(this.Ctx.Request.Header["Accept-Encoding"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Accept-Encoding"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetUserAgent() {
this.Data["Value"] = this.Ctx.Request.UserAgent()
this.TplNames = "value.tpl"
}
func (this *MainController) GetConnection() {
if len(this.Ctx.Request.Header["Connection"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["Connection"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetKeepAlive() {
if len(this.Ctx.Request.Header["KeepAlive"]) > 0 {
this.Data["Value"] = this.Ctx.Request.Header["KeepAlive"][0]
}
this.TplNames = "value.tpl"
}
func (this *MainController) GetAll() {
this.Data["Email"] = "missdeer@dfordsoft.com"
this.Data["UserAgent"] = this.Ctx.Request.UserAgent()
this.Data["Host"] = this.Ctx.Request.Host
this.Data["IP"] = this.Ctx.Input.IP()
remote_addr := []byte(this.Ctx.Request.RemoteAddr)
pos := bytes.IndexByte(remote_addr, ':')
this.Data["Port"] = string(remote_addr[pos+1:])
this.Data["Method"] = this.Ctx.Request.Method
if len(this.Ctx.Request.Header["Accept-Encoding"]) > 0 {
this.Data["Encoding"] = this.Ctx.Request.Header["Accept-Encoding"][0]
}
if len(this.Ctx.Request.Header["Accept"]) > 0 {
this.Data["Mime"] = this.Ctx.Request.Header["Accept"][0]
}
if len(this.Ctx.Request.Header["Connection"]) > 0 {
this.Data["Connection"] = this.Ctx.Request.Header["Connection"][0]
}
if len(this.Ctx.Request.Header["Via"]) > 0 {
this.Data["Via"] = this.Ctx.Request.Header["Via"][0]
}
if len(this.Ctx.Request.Header["Charset"]) > 0 {
this.Data["Charset"] = this.Ctx.Request.Header["Charset"][0]
}
if len(this.Ctx.Request.Header["KeepAlive"]) > 0 {
this.Data["Keepalive"] = this.Ctx.Request.Header["KeepAlive"][0]
}
if len(this.Ctx.Request.Header["X-Forwarded-For"]) > 0 {
this.Data["Forwarded"] = this.Ctx.Request.Header["X-Forwarded-For"][0]
}
if len(this.Ctx.Request.Header["Accept-Language"]) > 0 {
this.Data["Lang"] = this.Ctx.Request.Header["Accept-Language"][0]
}
this.Data["Referer"] = this.Ctx.Input.Refer()
this.TplNames = "all.tpl"
}
func (this *MainController) GetAllXML() {
thisData := make(map[string]interface{})
thisData["Email"] = "missdeer@dfordsoft.com"
thisData["UserAgent"] = this.Ctx.Request.UserAgent()
thisData["Host"] = this.Ctx.Request.Host
thisData["IP"] = this.Ctx.Input.IP()
remote_addr := []byte(this.Ctx.Request.RemoteAddr)
pos := bytes.IndexByte(remote_addr, ':')
thisData["Port"] = string(remote_addr[pos+1:])
thisData["Method"] = this.Ctx.Request.Method
if len(this.Ctx.Request.Header["Accept-Encoding"]) > 0 {
thisData["Encoding"] = this.Ctx.Request.Header["Accept-Encoding"][0]
}
if len(this.Ctx.Request.Header["Accept"]) > 0 {
thisData["Mime"] = this.Ctx.Request.Header["Accept"][0]
}
if len(this.Ctx.Request.Header["Connection"]) > 0 {
thisData["Connection"] = this.Ctx.Request.Header["Connection"][0]
}
if len(this.Ctx.Request.Header["Via"]) > 0 {
thisData["Via"] = this.Ctx.Request.Header["Via"][0]
}
if len(this.Ctx.Request.Header["Charset"]) > 0 {
thisData["Charset"] = this.Ctx.Request.Header["Charset"][0]
}
if len(this.Ctx.Request.Header["KeepAlive"]) > 0 {
thisData["Keepalive"] = this.Ctx.Request.Header["KeepAlive"][0]
}
if len(this.Ctx.Request.Header["X-Forwarded-For"]) > 0 {
thisData["Forwarded"] = this.Ctx.Request.Header["X-Forwarded-For"][0]
}
if len(this.Ctx.Request.Header["Accept-Language"]) > 0 {
thisData["Lang"] = this.Ctx.Request.Header["Accept-Language"][0]
}
thisData["Referer"] = this.Ctx.Input.Refer()
this.Data["xml"] = thisData
this.ServeXml()
}
func (this *MainController) GetAllJSON() {
thisData := make(map[string]interface{})
thisData["Email"] = "missdeer@dfordsoft.com"
thisData["UserAgent"] = this.Ctx.Request.UserAgent()
thisData["Host"] = this.Ctx.Request.Host
thisData["IP"] = this.Ctx.Input.IP()
remote_addr := []byte(this.Ctx.Request.RemoteAddr)
pos := bytes.IndexByte(remote_addr, ':')
thisData["Port"] = string(remote_addr[pos+1:])
thisData["Method"] = this.Ctx.Request.Method
if len(this.Ctx.Request.Header["Accept-Encoding"]) > 0 {
thisData["Encoding"] = this.Ctx.Request.Header["Accept-Encoding"][0]
}
if len(this.Ctx.Request.Header["Accept"]) > 0 {
thisData["Mime"] = this.Ctx.Request.Header["Accept"][0]
}
if len(this.Ctx.Request.Header["Connection"]) > 0 {
thisData["Connection"] = this.Ctx.Request.Header["Connection"][0]
}
if len(this.Ctx.Request.Header["Via"]) > 0 {
thisData["Via"] = this.Ctx.Request.Header["Via"][0]
}
if len(this.Ctx.Request.Header["Charset"]) > 0 {
thisData["Charset"] = this.Ctx.Request.Header["Charset"][0]
}
if len(this.Ctx.Request.Header["KeepAlive"]) > 0 {
thisData["Keepalive"] = this.Ctx.Request.Header["KeepAlive"][0]
}
if len(this.Ctx.Request.Header["X-Forwarded-For"]) > 0 {
thisData["Forwarded"] = this.Ctx.Request.Header["X-Forwarded-For"][0]
}
if len(this.Ctx.Request.Header["Accept-Language"]) > 0 {
thisData["Lang"] = this.Ctx.Request.Header["Accept-Language"][0]
}
thisData["Referer"] = this.Ctx.Input.Refer()
this.Data["json"] = thisData
this.ServeJson()
}
func (this *MainController) Get() {
this.Data["Email"] = "missdeer@dfordsoft.com"
this.Data["UserAgent"] = this.Ctx.Request.UserAgent()
this.Data["Host"] = this.Ctx.Request.Host
this.Data["IP"] = this.Ctx.Input.IP()
remote_addr := []byte(this.Ctx.Request.RemoteAddr)
pos := bytes.IndexByte(remote_addr, ':')
this.Data["Port"] = string(remote_addr[pos+1:])
this.Data["Method"] = this.Ctx.Request.Method
if len(this.Ctx.Request.Header["Accept-Encoding"]) > 0 {
this.Data["Encoding"] = this.Ctx.Request.Header["Accept-Encoding"][0]
}
if len(this.Ctx.Request.Header["Accept"]) > 0 {
this.Data["Mime"] = this.Ctx.Request.Header["Accept"][0]
}
if len(this.Ctx.Request.Header["Connection"]) > 0 {
this.Data["Connection"] = this.Ctx.Request.Header["Connection"][0]
}
if len(this.Ctx.Request.Header["Via"]) > 0 {
this.Data["Via"] = this.Ctx.Request.Header["Via"][0]
}
if len(this.Ctx.Request.Header["Charset"]) > 0 {
this.Data["Charset"] = this.Ctx.Request.Header["Charset"][0]
}
if len(this.Ctx.Request.Header["KeepAlive"]) > 0 {
this.Data["Keepalive"] = this.Ctx.Request.Header["KeepAlive"][0]
}
if len(this.Ctx.Request.Header["X-Forwarded-For"]) > 0 {
this.Data["Forwarded"] = this.Ctx.Request.Header["X-Forwarded-For"][0]
}
if len(this.Ctx.Request.Header["Accept-Language"]) > 0 {
this.Data["Lang"] = this.Ctx.Request.Header["Accept-Language"][0]
}
this.Data["Referer"] = this.Ctx.Input.Refer()
if strings.Contains(this.Ctx.Request.UserAgent(), "curl") {
this.TplNames = "iponly.tpl"
} else {
this.TplNames = "index.tpl"
}
}

20
main.go Normal file
View File

@ -0,0 +1,20 @@
package main
import (
"github.com/astaxie/beego"
_ "github.com/missdeer/ifconfig/routers"
"os"
)
const (
HostVar = "VCAP_APP_HOST"
PortVar = "VCAP_APP_PORT"
)
func main() {
var port string
if port = os.Getenv(PortVar); port == "" {
port = "8080"
}
beego.Run(":" + port)
}

25
routers/router.go Normal file
View File

@ -0,0 +1,25 @@
package routers
import (
"github.com/astaxie/beego"
"github.com/missdeer/ifconfig/controllers"
)
func init() {
beego.Router("/", &controllers.MainController{}, "get:Get")
beego.Router("/ip", &controllers.MainController{}, "get:GetIP")
beego.Router("/host", &controllers.MainController{}, "get:GetHost")
beego.Router("/ua", &controllers.MainController{}, "get:GetUserAgent")
beego.Router("/port", &controllers.MainController{}, "get:GetPort")
beego.Router("/keepalive", &controllers.MainController{}, "get:GetKeepAlive")
beego.Router("/lang", &controllers.MainController{}, "get:GetLang")
beego.Router("/connection", &controllers.MainController{}, "get:GetConnection")
beego.Router("/encoding", &controllers.MainController{}, "get:GetEncoding")
beego.Router("/via", &controllers.MainController{}, "get:GetVia")
beego.Router("/mime", &controllers.MainController{}, "get:GetMime")
beego.Router("/charset", &controllers.MainController{}, "get:GetCharset")
beego.Router("/forwarded", &controllers.MainController{}, "get:GetForwarded")
beego.Router("/all", &controllers.MainController{}, "get:GetAll")
beego.Router("/all.xml", &controllers.MainController{}, "get:GetAllXML")
beego.Router("/all.json", &controllers.MainController{}, "get:GetAllJSON")
}

37
tests/default_test.go Normal file
View File

@ -0,0 +1,37 @@
package test
import (
_ "github.com/missdeer/ifconfig/routers"
"net/http"
"net/http/httptest"
"path/filepath"
"runtime"
"testing"
"github.com/astaxie/beego"
. "github.com/smartystreets/goconvey/convey"
)
func init() {
_, file, _, _ := runtime.Caller(1)
apppath, _ := filepath.Abs(filepath.Dir(filepath.Join(file, ".."+string(filepath.Separator))))
beego.TestBeegoInit(apppath)
}
// TestMain is a sample to run an endpoint test
func TestMain(t *testing.T) {
r, _ := http.NewRequest("GET", "/", nil)
w := httptest.NewRecorder()
beego.BeeApp.Handlers.ServeHTTP(w, r)
beego.Trace("testing", "TestMain", "Code[%d]\n%s", w.Code, w.Body.String())
Convey("Subject: Test Station Endpoint\n", t, func() {
Convey("Status Code Should Be 200", func() {
So(w.Code, ShouldEqual, 200)
})
Convey("The Result Should Not Be Empty", func() {
So(w.Body.Len(), ShouldBeGreaterThan, 0)
})
})
}

12
views/all.tpl Normal file
View File

@ -0,0 +1,12 @@
ip_addr: {{.IP}}
remote_host: {{.Host}}
user_agent: {{.UserAgent}}
port: {{.Port}}
lang: {{.Lang}}
connection: {{.Connection}}
keep_alive: {{.Keepalive}}
encoding: {{.Encoding}}
mime: {{.Mime}}
charset: {{.Charset}}
via: {{.Via}}
forwarded: {{.Forwarded}}

14
views/alljson.tpl Normal file
View File

@ -0,0 +1,14 @@
{
"connection": "{{.Connection}}",
"ip_addr": "{{.IP}}",
"lang": "{{.Lang}}",
"remote_host": "{{.Host}}",
"user_agent": "{{.UserAgent}}",
"charset": "{{.Charset}}",
"port": "{{.Port}}",
"via": "{{.Via}}",
"forwarded": "{{.Forwarded}}",
"mime": "{{.Mime}}",
"keep_alive": "{{.Keepalive}}",
"encoding": "{{.Encoding}}"
}

16
views/allxml.tpl Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
&lt;info&gt;
&lt;charset&gt;{{.Charset}}&lt;/charset&gt;
&lt;connection&gt;{{.Connection}}&lt;/connection&gt;
&lt;encoding&gt;{{.Encoding}}&lt;/encoding&gt;
&lt;forwarded&gt;{{.Forwarded}}&lt;/forwarded&gt;
&lt;ip_addr&gt;{{.IP}}&lt;/ip_addr&gt;
&lt;keep_alive&gt;{{.Keepalive}}&lt;/keep_alive&gt;
&lt;lang&gt;{{.Lang}}&lt;/lang&gt;
&lt;mime&gt;{{.Mime}}&lt;/mime&gt;
&lt;port&gt;{{.Port}}&lt;/port&gt;
&lt;remote_host&gt;{{.Host}}&lt;/remote_host&gt;
&lt;user_agent&gt;{{.UserAgent}}&lt;/user_agent&gt;
&lt;via&gt;{{.Via}}&lt;/via&gt;
&lt;/info&gt;

161
views/index.tpl Normal file
View File

@ -0,0 +1,161 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang ="en">
<head>
<meta http-equiv="content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="content-style-type" content="text/css" />
<meta http-equiv="content-script-type" content="text/javascript" />
<meta http-equiv="content-language" content="en" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<meta name="description" content="Get my IP Address" />
<meta name="keywords" content="ip address ifconfig" />
<meta name="author" content="{{.Author}}" />
<link rel="shortcut icon" href="favicon.ico" />
<link rev="made" href="mailto: {{.Email}}" />
<title>What Is My IP Address? - Yet Another ifconfig</title>
<style type="text/css">
* {margin:0; padding:0;font-style:normal;font-weight:normal;font-family:Arial,sans-serif;font-size:13px;color:#333;}
body{}
#container{background:white;width:750px;margin:10px auto;margin-bottom:10px;border:solid 1px #888;}
#header{height:50px;padding:15px 0 10px 10px;}
#header table{width:100%;}
h1 a{font-size:20px;margin:10px;letter-spacing:1px;text-decoration:none;color:#555;}
#ads{height:20px;margin-bottom:15px;text-align:right;background:#777;padding-top:4px;border-left:solid 1px #888;border-right:solid 1px #888;}
#info_area{float:left;margin-left:11px;}
#info_table{border-collapse:collapse;margin:0 auto;line-height:20px;width:728px;table-layout:fixed;}
#info_table tr{height:30px;}
#info_table td{border: solid 1px #888;padding: 0px 10px;}
.info_table_label{width:100px;}
#table_ads{width:260px;text-align:center;}
#middle{height:110px;clear:both;text-align:center;padding-top:20px;}
#cli_wrap{margin:0 10px;}
h2{height:30px;line-height:30px;font-size:18px;margin:0 5px;padding-left:5px;}
#cli_table{border:solid 1px #888;border-collapse:collapse;width:728px;margin:0 auto;line-height:20px;table-layout:fixed;}
#cli_table tr{height:30px;}
#cli_table td{border-bottom: solid 1px #888;padding-top:3px;padding-bottom:3px;overflow:hidden;}
.cli_command{width:190px;padding-left:10px;}
.cli_arrow{width:40px;text-align:center;}
#footer{background:#777;height:20px;line-height:20px;color:#ddd;text-align:center;margin-top:15px;border-top:none;}
#ip_address{font-size:1.9em;}
#ip_address_cell{padding:5px;height:50px;}
#plungins{height:20px;float:right;}
.plungin{float:right;}
#button_twitter{width:100px;}
#button_plusone{width:70px;}
#button_facebook{width:100px;}
</style>
</head>
<body>
<div id="container" class="clearfix">
<div id="header">
<table>
<tr>
<td>
<h1><a href="http://ifconfig.jd-app.com">What Is My IP Address? - Yet Another ifconfig</a></h1>
</td>
<td></td>
</tr>
<tr>
<td></td>
<td>
</td>
</tr>
</table>
</div>
<div id="ads">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3435940217424489";
google_ad_slot = "9166587836";
google_ad_width = 728;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div id="info_area">
<h2>Your Connection</h2>
<table id="info_table" summary="info">
<tr>
<td class="info_table_label">IP Address</td>
<td id="ip_address_cell"><strong id="ip_address">{{.IP}}</strong></td>
<td rowspan="8" id="table_ads">
<script type="text/javascript"><!--
google_ad_client = "ca-ca-pub-3435940217424489";
google_ad_slot = "9166587836";
google_ad_width = 250;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
<tr><td class="info_table_label">Remote Host</td><td>{{.Host}}</td></tr>
<tr><td class="info_table_label">User Agent</td><td>{{.UserAgent}}</td></tr>
<tr><td class="info_table_label">Port</td><td>{{.Port}}</td></tr>
<tr><td class="info_table_label">Language</td><td>{{.Lang}}</td></tr>
<tr><td class="info_table_label">Referer</td><td>{{.Referer}}</td></tr>
<tr><td class="info_table_label">Connection</td><td>{{.Connection}}</td></tr>
<tr><td class="info_table_label">KeepAlive</td><td>{{.Keepalive}}</td></tr>
<tr><td class="info_table_label">Method</td><td colspan="2">{{.Method}}</td></tr>
<tr><td class="info_table_label">Encoding</td><td colspan="2">{{.Encoding}}</td></tr>
<tr><td class="info_table_label">MIME Type</td><td colspan="2">{{.Mime}}</td></tr>
<tr><td class="info_table_label">Charset</td><td colspan="2">{{.Charset}}</td></tr>
<tr><td class="info_table_label">Via</td><td colspan="2">{{.Via}}</td></tr>
<tr><td class="info_table_label">X-Forwarded-For</td><td colspan="2">{{.Forwarded}}</td></tr>
</table>
</div>
<div id="middle">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-3435940217424489";
google_ad_slot = "9166587836";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>
<div id="cli_wrap">
<h2>Command Line Interface</h2>
<table id="cli_table" summary="cli">
<tr><td class="cli_command">$ curl ifconfig.jd-app.com</td><td class="cli_arrow">&rArr;</td><td>{{.IP}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/ip</td><td class="cli_arrow">&rArr;</td><td>{{.IP}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/host</td><td class="cli_arrow">&rArr;</td><td>{{.Host}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/ua</td><td class="cli_arrow">&rArr;</td><td>{{.UserAgent}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/port</td><td class="cli_arrow">&rArr;</td><td>{{.Port}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/lang</td><td class="cli_arrow">&rArr;</td><td>{{.Lang}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/keepalive</td><td class="cli_arrow">&rArr;</td><td>{{.Keepalive}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/connection</td><td class="cli_arrow">&rArr;</td><td>{{.Connection}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/encoding</td><td class="cli_arrow">&rArr;</td><td>{{.Encoding}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/mime</td><td class="cli_arrow">&rArr;</td><td>{{.Mime}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/charset</td><td class="cli_arrow">&rArr;</td><td>{{.Charset}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/via</td><td class="cli_arrow">&rArr;</td><td>{{.Via}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/forwarded</td><td class="cli_arrow">&rArr;</td><td>{{.Forwarded}}</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/all</td><td class="cli_arrow">&rArr;</td><td>ip_addr: {{.IP}}<br />remote_host: {{.Host}} <br />user_agent: {{.UserAgent}}<br />port: {{.Port}}<br />lang: {{.Lang}}<br />connection: {{.Connection}}<br />keep_alive: {{.Keepalive}}<br />encoding: {{.Encoding}}<br />mime: {{.Mime}}<br />charset: {{.Charset}}<br />via: {{.Via}}<br />forwarded: {{.Forwarded}}<br /></td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/all.xml</td><td class="cli_arrow">&rArr;</td><td>&lt;info&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;charset&gt;{{.Charset}}&lt;/charset&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;connection&gt;{{.Connection}}&lt;/connection&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;encoding&gt;{{.Encoding}}&lt;/encoding&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;forwarded&gt;{{.Forwarded}}&lt;/forwarded&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;ip_addr&gt;{{.IP}}&lt;/ip_addr&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;keep_alive&gt;{{.Keepalive}}&lt;/keep_alive&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;lang&gt;{{.Lang}}&lt;/lang&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;mime&gt;{{.Mime}}&lt;/mime&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;port&gt;{{.Port}}&lt;/port&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;remote_host&gt;{{.Host}}&lt;/remote_host&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;user_agent&gt;{{.UserAgent}}&lt;/user_agent&gt;<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;via&gt;{{.Via}}&lt;/via&gt;<br />
&lt;/info&gt;<br />
</td></tr>
<tr><td class="cli_command">$ curl ifconfig.jd-app.com/all.json</td><td class="cli_arrow">&rArr;</td><td>{"connection":"{{.Connection}}","ip_addr":"{{.IP}}","lang":"{{.Lang}}","remote_host":"{{.Host}}","user_agent":"{{.UserAgent}}","charset":"{{.Charset}}","port":"{{.Port}}","via":"{{.Via}}","forwarded":"{{.Forwarded}}","mime":"{{.Mime}}","keep_alive":"{{.Keepalive}}","encoding":"{{.Encoding}}"}</td></tr>
</table>
</div>
<div id="footer">&copy; 2014 <a href="http://minidump.info">minidump.info</a></div>
</div>
<!--
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-10827147-6");
pageTracker._trackPageview();
} catch(err) {}</script>
-->
</body>
</html>

1
views/iponly.tpl Normal file
View File

@ -0,0 +1 @@
{{.IP}}

1
views/value.tpl Normal file
View File

@ -0,0 +1 @@
{{.Value}}