mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-25 14:36:35 +08:00
服务支持自定义访客IP地址获取方式
This commit is contained in:
@@ -408,6 +408,16 @@ func (this *HTTPWebDAO) ComposeWebConfig(tx *dbs.Tx, webId int64, cacheMap maps.
|
||||
config.WebP = webpConfig
|
||||
}
|
||||
|
||||
// RemoteAddr
|
||||
if IsNotNull(web.RemoteAddr) {
|
||||
var remoteAddrConfig = &serverconfigs.HTTPRemoteAddrConfig{}
|
||||
err = json.Unmarshal([]byte(web.RemoteAddr), remoteAddrConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
config.RemoteAddr = remoteAddrConfig
|
||||
}
|
||||
|
||||
cacheMap[cacheKey] = config
|
||||
|
||||
return config, nil
|
||||
@@ -477,6 +487,21 @@ func (this *HTTPWebDAO) UpdateWebWebP(tx *dbs.Tx, webId int64, webpConfig []byte
|
||||
return this.NotifyUpdate(tx, webId)
|
||||
}
|
||||
|
||||
// UpdateWebRemoteAddr 修改RemoteAddr配置
|
||||
func (this *HTTPWebDAO) UpdateWebRemoteAddr(tx *dbs.Tx, webId int64, remoteAddrConfig []byte) error {
|
||||
if webId <= 0 {
|
||||
return errors.New("invalid webId")
|
||||
}
|
||||
var op = NewHTTPWebOperator()
|
||||
op.Id = webId
|
||||
op.RemoteAddr = remoteAddrConfig
|
||||
err := this.Save(tx, op)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return this.NotifyUpdate(tx, webId)
|
||||
}
|
||||
|
||||
// UpdateWebCharset 修改字符编码
|
||||
func (this *HTTPWebDAO) UpdateWebCharset(tx *dbs.Tx, webId int64, charsetJSON []byte) error {
|
||||
if webId <= 0 {
|
||||
|
||||
Reference in New Issue
Block a user