func (input *BeegoInput) IP() string {
	ips := input.Proxy()
	if len(ips) > 0 && ips[0] != "" {
		rip := strings.Split(ips[0], ":")
		return rip[0]
	}
	ip := strings.Split(input.Context.Request.RemoteAddr, ":")
	if len(ip) > 0 {
		if ip[0] != "[" {
			return ip[0]
		}
	}
	return "127.0.0.1"
}
IP returns request client ip.
if in proxy, return first proxy id.
if error, return 127.0.0.1.
package context
import (
	"bytes"
	"errors"
	"io"
	"io/ioutil"
	"net/url"
	"reflect"
	"regexp"
	"strconv"
	"strings"
	"github.com/astaxie/beego/session"
)
var (
	acceptsHTMLRegex = regexp.MustCompile(`(text/html|application/xhtml\+xml)(?:,|$)`)
	acceptsXMLRegex  = regexp.MustCompile(`(application/xml|text/xml)(?:,|$)`)
	acceptsJSONRegex = regexp.MustCompile(`(application/json)(?:,|$)`)
	maxParam         = 50
)
type BeegoInput struct {
	Context       *Context
	CruSession    session.Store
	pnames        []string
	pvalues       []string
	data          map[interface{}]interface{}  
	RequestBody   []byte
	RunMethod     string
	RunController reflect.Type
}
func NewInput() *BeegoInput {
	return &BeegoInput{
		pnames:  make([]string, 0, maxParam),
		pvalues: make([]string, 0, maxParam),
		data:    make(map[interface{}]interface{}),
	}
}
func (input *BeegoInput) Reset(ctx *Context) {
	input.Context = ctx
	input.CruSession = nil
	input.pnames = input.pnames[:0]
	input.pvalues = input.pvalues[:0]
	input.data = nil
	input.RequestBody = []byte{}
}
func (input *BeegoInput) Protocol() string {
	return input.Context.Request.Proto
}
func (input *BeegoInput) URI() string {
	return input.Context.Request.RequestURI
}
func (input *BeegoInput) URL() string {
	return input.Context.Request.URL.Path
}
func (input *BeegoInput) Site() string {
	return input.Scheme() + "://" + input.Domain()
}
func (input *BeegoInput) Scheme() string {
	if scheme := input.Header("X-Forwarded-Proto"); scheme != "" {
		return scheme
	}
	if input.Context.Request.URL.Scheme != "" {
		return input.Context.Request.URL.Scheme
	}
	if input.Context.Request.TLS == nil {
		return "http"
	}
	return "https"
}
func (input *BeegoInput) Domain() string {
	return input.Host()
}
func (input *BeegoInput) Host() string {
	if input.Context.Request.Host != "" {
		hostParts := strings.Split(input.Context.Request.Host, ":")
		if len(hostParts) > 0 {
			return hostParts[0]
		}
		return input.Context.Request.Host
	}
	return "localhost"
}
func (input *BeegoInput) Method() string {
	return input.Context.Request.Method
}
func (input *BeegoInput) Is(method string) bool {
	return input.Method() == method
}
func (input *BeegoInput) IsGet() bool {
	return input.Is("GET")
}
func (input *BeegoInput) IsPost() bool {
	return input.Is("POST")
}
func (input *BeegoInput) IsHead() bool {
	return input.Is("HEAD")
}
func (input *BeegoInput) IsOptions() bool {
	return input.Is("OPTIONS")
}
func (input *BeegoInput) IsPut() bool {
	return input.Is("PUT")
}
func (input *BeegoInput) IsDelete() bool {
	return input.Is("DELETE")
}
func (input *BeegoInput) IsPatch() bool {
	return input.Is("PATCH")
}
func (input *BeegoInput) IsAjax() bool {
	return input.Header("X-Requested-With") == "XMLHttpRequest"
}
func (input *BeegoInput) IsSecure() bool {
	return input.Scheme() == "https"
}
func (input *BeegoInput) IsWebsocket() bool {
	return input.Header("Upgrade") == "websocket"
}
func (input *BeegoInput) IsUpload() bool {
	return strings.Contains(input.Header("Content-Type"), "multipart/form-data")
}
func (input *BeegoInput) AcceptsHTML() bool {
	return acceptsHTMLRegex.MatchString(input.Header("Accept"))
}
func (input *BeegoInput) AcceptsXML() bool {
	return acceptsXMLRegex.MatchString(input.Header("Accept"))
}
func (input *BeegoInput) AcceptsJSON() bool {
	return acceptsJSONRegex.MatchString(input.Header("Accept"))
}