SpoofDPI/config/config.go

38 lines
506 B
Go
Raw Normal View History

2022-01-03 07:24:39 +00:00
package config
2021-12-29 17:08:30 +00:00
import (
"sync"
2022-01-03 15:13:42 +00:00
"runtime"
2021-12-29 17:08:30 +00:00
)
type Config struct {
2022-01-03 16:54:36 +00:00
Port string
2021-12-29 17:08:30 +00:00
DNS string
2022-01-03 15:13:42 +00:00
OS string
2021-12-29 17:08:30 +00:00
Debug bool
}
var config *Config
var once sync.Once
var err error
2022-01-03 16:54:36 +00:00
func InitConfig(port string, dns string, debug bool) error {
2021-12-29 17:08:30 +00:00
err = nil
once.Do(func() {
config = &Config{
2022-01-03 16:54:36 +00:00
Port : port,
2021-12-29 17:08:30 +00:00
DNS : dns,
2022-01-03 15:13:42 +00:00
OS : runtime.GOOS,
2021-12-29 17:08:30 +00:00
Debug : debug,
}
})
return err
}
2022-01-03 07:24:39 +00:00
func GetConfig() (*Config) {
2021-12-29 17:08:30 +00:00
return config
}