代码拉取完成,页面将自动刷新
package serverConfig
import (
"github.com/Peakchen/xcommon/Config"
"fmt"
"path/filepath"
"strconv"
)
/*
export from ExternalGWConfig.json by tool.
*/
type TExternalgwconfigBase struct {
Id int32 `json:"id"`
Listenaddr string `json:"ListenAddr"`
Pprofaddr string `json:"PProfAddr"`
Name string
}
type TExternalgwconfigConfig struct {
data *TExternalgwconfigBase
}
type tArrExternalgwconfig []*TExternalgwconfigBase
var (
GExternalgwconfigConfig *TExternalgwconfigConfig = &TExternalgwconfigConfig{}
cstExternalDef = "ExternalGateway"
)
func init() {
//loadExternalgwConfig()
}
func loadExternalgwConfig() {
var (
ExternalGWpath string
)
if len(SvrPath) == 0 {
ExternalGWpath = getserverpath()
}
ExternalGWpath = filepath.Join(SvrPath, "ExternalGWConfig.json")
Config.ParseJson2Cache(GExternalgwconfigConfig, &tArrExternalgwconfig{}, ExternalGWpath)
}
func (this *TExternalgwconfigConfig) ComfireAct(data interface{}) (errlist []string) {
cfg := data.(*tArrExternalgwconfig)
errlist = []string{}
for _, item := range *cfg {
if len(item.Listenaddr) == 0 {
errlist = append(errlist, fmt.Sprintf("ExternalGWConfig listeraddr invalid, id: %v.", item.Id))
}
if len(item.Pprofaddr) == 0 {
errlist = append(errlist, fmt.Sprintf("ExternalGWConfig Pprofaddr invalid, id: %v.", item.Id))
}
}
return
}
func (this *TExternalgwconfigConfig) DataRWAct(data interface{}) (errlist []string) {
cfg := data.(*tArrExternalgwconfig)
this.data = &TExternalgwconfigBase{}
for _, item := range *cfg {
item.Name = cstExternalDef + "_" + strconv.Itoa(int(item.Id))
this.data = item
break
}
return
}
func (this *TExternalgwconfigConfig) Get() *TExternalgwconfigBase {
return this.data
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。