增加访问ip打印等功能
This commit is contained in:
parent
0f29b3304e
commit
6eca18b374
@ -1,7 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="b2aca021-ff30-4cbf-8dc9-8cdd4f4c39dc" name="Default Changelist" comment="" />
|
<list default="true" id="b2aca021-ff30-4cbf-8dc9-8cdd4f4c39dc" name="Default Changelist" comment="">
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/application.go" beforeDir="false" afterPath="$PROJECT_DIR$/application.go" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/example/config/config.json" beforeDir="false" afterPath="$PROJECT_DIR$/example/config/config.json" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/var.go" beforeDir="false" afterPath="$PROJECT_DIR$/var.go" afterDir="false" />
|
||||||
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -29,6 +34,11 @@
|
|||||||
<property name="go.sdk.automatically.set" value="true" />
|
<property name="go.sdk.automatically.set" value="true" />
|
||||||
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
|
<property name="go.tried.to.enable.integration.vgo.integrator" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
<component name="RecentsManager">
|
||||||
|
<key name="MoveFile.RECENT_KEYS">
|
||||||
|
<recent name="D:\gopath\src\code.hoteas.com\hoteas\hotime\tools" />
|
||||||
|
</key>
|
||||||
|
</component>
|
||||||
<component name="RunDashboard">
|
<component name="RunDashboard">
|
||||||
<option name="ruleStates">
|
<option name="ruleStates">
|
||||||
<list>
|
<list>
|
||||||
@ -69,6 +79,8 @@
|
|||||||
<updated>1573372557346</updated>
|
<updated>1573372557346</updated>
|
||||||
<workItem from="1573372558521" duration="18000" />
|
<workItem from="1573372558521" duration="18000" />
|
||||||
<workItem from="1573372583551" duration="5522000" />
|
<workItem from="1573372583551" duration="5522000" />
|
||||||
|
<workItem from="1582172338195" duration="5196000" />
|
||||||
|
<workItem from="1582181939594" duration="289000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="清理">
|
<task id="LOCAL-00001" summary="清理">
|
||||||
<created>1573372845218</created>
|
<created>1573372845218</created>
|
||||||
@ -112,7 +124,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1573380045254</updated>
|
<updated>1573380045254</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="7" />
|
<task id="LOCAL-00007" summary="增加跨域配置,以及增加配置说明">
|
||||||
|
<created>1582179656809</created>
|
||||||
|
<option name="number" value="00007" />
|
||||||
|
<option name="presentableId" value="LOCAL-00007" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1582179656809</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="8" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
@ -135,6 +154,7 @@
|
|||||||
<MESSAGE value="清理" />
|
<MESSAGE value="清理" />
|
||||||
<MESSAGE value="自动设置数据库" />
|
<MESSAGE value="自动设置数据库" />
|
||||||
<MESSAGE value="数据库缓存" />
|
<MESSAGE value="数据库缓存" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="数据库缓存" />
|
<MESSAGE value="增加跨域配置,以及增加配置说明" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="增加跨域配置,以及增加配置说明" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -14,6 +14,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Application struct {
|
type Application struct {
|
||||||
@ -330,6 +331,11 @@ func (this *Application) handler(w http.ResponseWriter, req *http.Request) {
|
|||||||
|
|
||||||
//跨域设置
|
//跨域设置
|
||||||
CrossDomain(&context)
|
CrossDomain(&context)
|
||||||
|
//是否展示日志
|
||||||
|
if this.Config.GetInt("connectLogShow") != 0 {
|
||||||
|
log.Println(context.HandlerStr + time.Now().Format(" 2006-01-02 15:04 ") + Substr(context.Req.RemoteAddr, 0, strings.Index(context.Req.RemoteAddr, ":")))
|
||||||
|
}
|
||||||
|
|
||||||
//访问拦截true继续false暂停
|
//访问拦截true继续false暂停
|
||||||
connectListenerLen := len(this.connectListener)
|
connectListenerLen := len(this.connectListener)
|
||||||
if connectListenerLen != 0 {
|
if connectListenerLen != 0 {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{
|
{
|
||||||
"cacheLongTime": 2592000,
|
"cacheLongTime": 2592000,
|
||||||
"cacheShortTime": 7200,
|
"cacheShortTime": 7200,
|
||||||
|
"crossDomain": "",
|
||||||
"dbCached": 0,
|
"dbCached": 0,
|
||||||
"dbHost": "127.0.0.1",
|
"dbHost": "127.0.0.1",
|
||||||
"dbName": "test",
|
"dbName": "test",
|
||||||
@ -12,16 +13,19 @@
|
|||||||
"index.html",
|
"index.html",
|
||||||
"index.htm"
|
"index.htm"
|
||||||
],
|
],
|
||||||
"error": {},
|
"error": {
|
||||||
"logLevel": 0,
|
"1": "内部系统异常",
|
||||||
|
"2": "访问权限异常",
|
||||||
|
"3": "请求参数异常",
|
||||||
|
"4": "数据处理异常",
|
||||||
|
"5": "数据结果异常"
|
||||||
|
},
|
||||||
|
"logLevel": 1,
|
||||||
"modeRouterStrict": false,
|
"modeRouterStrict": false,
|
||||||
"port": "8080",
|
"port": "8080",
|
||||||
"redisHost": "192.168.6.254:6379",
|
|
||||||
"redisPort": "6379",
|
|
||||||
"redisPwd": "9rusdfjk482fjdfo2e023",
|
|
||||||
"sessionName": "HOTIME",
|
"sessionName": "HOTIME",
|
||||||
"tlsCert": "",
|
"tlsCert": "",
|
||||||
"tlsKey": "",
|
"tlsKey": "",
|
||||||
"tlsPort": "0",
|
"tlsPort": "0",
|
||||||
"tpt": "example/tpt"
|
"tpt": "tpt"
|
||||||
}
|
}
|
8
var.go
8
var.go
@ -6,10 +6,9 @@ var App = map[string]*Application{} //整个项目
|
|||||||
//var Db = HoTimeDB{} //数据库实例
|
//var Db = HoTimeDB{} //数据库实例
|
||||||
|
|
||||||
var Config = Map{
|
var Config = Map{
|
||||||
"debug": 1, //debug 0关闭1开启
|
"debug": 1, //debug 0关闭1开启
|
||||||
"logLevel": LOG_NIL,
|
"logLevel": LOG_NIL,
|
||||||
"dbHost": "127.0.0.1",
|
"dbHost": "127.0.0.1",
|
||||||
//"dbHost":"localhost",
|
|
||||||
"dbName": "test",
|
"dbName": "test",
|
||||||
"dbUser": "root",
|
"dbUser": "root",
|
||||||
"dbPwd": "root",
|
"dbPwd": "root",
|
||||||
@ -62,6 +61,7 @@ var ConfigNote = Map{
|
|||||||
"defFile": "默认访问文件,默认访问index.html或者index.htm文件",
|
"defFile": "默认访问文件,默认访问index.html或者index.htm文件",
|
||||||
"crossDomain": "跨域设置,空字符串为不开启,*为开启所有网站允许跨域,http://www.baidu.com为指定域允许跨域", //是否开启跨域
|
"crossDomain": "跨域设置,空字符串为不开启,*为开启所有网站允许跨域,http://www.baidu.com为指定域允许跨域", //是否开启跨域
|
||||||
"modeRouterStrict": "路由严格模式false,为大小写忽略必须匹配,true必须大小写匹配", //路由严格模式/a/b/c
|
"modeRouterStrict": "路由严格模式false,为大小写忽略必须匹配,true必须大小写匹配", //路由严格模式/a/b/c
|
||||||
|
"connectLogShow": "web访问链接、访问ip、访问时间打印,0为关闭其他数字开启此功能",
|
||||||
"sessionName": "设置session的cookie名默认HOTIME",
|
"sessionName": "设置session的cookie名默认HOTIME",
|
||||||
"port": "web服务开启Http端口,0为不启用http服务",
|
"port": "web服务开启Http端口,0为不启用http服务",
|
||||||
"tlsPort": "web服务https端口,0为不启用https服务",
|
"tlsPort": "web服务https端口,0为不启用https服务",
|
||||||
|
Loading…
Reference in New Issue
Block a user