1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package adslib
- import (
- "github.com/BurntSushi/toml"
- "sync"
- )
- type SvrConf struct {
- HostIos string `toml:"Host_Ios"`
- HostAndroid string `toml:"Host_Android"`
- Host string `toml:"Host"`
- HostScript string `toml:"Host_script"`
- HostMiao string `toml:"Host_miao"`
- IPReqSource []string `toml:"ip_req_source"`
- BlackReqSource []string `toml:"black_req_source"`
- DpTest string `toml:"dp_test"`
- FreqControlNum int `toml:"freq_control_num"`
- FlowPercent map[string]map[string]FlogControlItem `toml:"flow_percent"`
- FlowPercent1 map[string]map[string]FlogControlItem `toml:"flow_percent_1"`
- AdsActions map[string][]string `toml:"Ads_Actions"`
- AdsDuration map[string]int `toml:"Ads_Duration"`
- ActionWeight ActionWeight `toml:"action_weight"`
- CombinationActions map[string][]CombinationActionsConf `toml:"combination_actions"`
- SecretKey string `toml:"secret_key"`
- Ip2RegionFile string `toml:"ip2region_file"`
- LogPath string `toml:"log_path"`
- RedisHost string `toml:"redis_host"`
- RedisPassword string `toml:"redis_password"`
- LogLevel string `toml:"log_level"`
- }
- type FlogControlItem struct {
- Percent int `toml:"percent"`
- Duration int `toml:"duration"`
- }
- type ActionWeight struct {
- VIEW int `toml:"VIEW"`
- VIDEOTIMER int `toml:"VIDEO_TIMER"`
- CLICK int `toml:"CLICK"`
- CLOSE int `toml:"CLOSE"`
- VIDEOFINISH int `toml:"VIDEO_FINISH"`
- }
- type CombinationActionsConf struct {
- PercentBegin int `toml:"percent_begin"`
- PercentEnd int `toml:"percent_end"`
- GroupValue []string `toml:"group_value"`
- LastAction string `toml:"last_action"`
- }
- var svrConf SvrConf
- var once sync.Once
- func GetConf() *SvrConf {
- once.Do(func() {
- _, err := toml.DecodeFile("../conf/config.toml", &svrConf)
- if err != nil {
- panic(err)
- }
- })
- return &svrConf
- }
|