func (c Context) Host() (string, error) {
	host, _, err := net.SplitHostPort(c.Req.Host)
	if err != nil {
		if !strings.Contains(c.Req.Host, ":") {
			return c.Req.Host, nil
		}
		return "", err
	}
	return host, nil
}
Host returns the hostname portion of the Host header
from the HTTP request.
package httpserver
import (
	"bytes"
	"crypto/rand"
	"fmt"
	"io/ioutil"
	"log"
	mathrand "math/rand"
	"net"
	"net/http"
	"net/url"
	"path"
	"strconv"
	"strings"
	"sync"
	"text/template"
	"time"
	"os"
	"github.com/tmpim/certmagic"
	"github.com/russross/blackfriday"
	"github.com/tmpim/casket/caskettls"
)
type Context struct {
	Root http.FileSystem
	Req  *http.Request
	URL  *url.URL
	Args []interface{}  
	responseHeader http.Header
}
func NewContextWithHeader(rh http.Header) Context {
	return Context{
		responseHeader: rh,
	}
}
func (c Context) Include(filename string, args ...interface{}) (string, error) {
	c.Args = args
	return ContextInclude(filename, c, c.Root)
}
func (c Context) Now(format string) string {
	return time.Now().Format(format)
}
func (c Context) NowDate() time.Time {
	return time.Now()
}
func (c Context) Cookie(name string) string {
	cookies := c.Req.Cookies()
	for _, cookie := range cookies {
		if cookie.Name == name {
			return cookie.Value
		}
	}
	return ""
}
func (c Context) Header(name string) string {
	return c.Req.Header.Get(name)
}
func (c Context) Hostname() string {
	ip := c.IP()
	hostnameList, err := net.LookupAddr(ip)
	if err != nil || len(hostnameList) == 0 {
		return c.Req.RemoteAddr
	}
	return hostnameList[0]
}
func (c Context) Env() map[string]string {
	osEnv := os.Environ()
	envVars := make(map[string]string, len(osEnv))
	for _, env := range osEnv {
		data := strings.SplitN(env, "=", 2)
		if len(data) == 2 && len(data[0]) > 0 {
			envVars[data[0]] = data[1]
		}
	}
	return envVars
}
func (c Context) IP() string {
	ip, _, err := net.SplitHostPort(c.Req.RemoteAddr)
	if err != nil {
		return c.Req.RemoteAddr
	}
	return ip
}
var networkInterfacesFn = net.InterfaceAddrs
func (c Context) ServerIP() string {
	addrs, err := networkInterfacesFn()
	if err != nil {
		return ""
	}
	for _, address := range addrs {
		if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
			if ipnet.IP.To4() != nil || ipnet.IP.To16() != nil {
				return ipnet.IP.String()
			}
		}
	}
	return ""
}
func (c Context) URI() string {
	return c.Req.RequestURI
}