Don't crash if socks config file doesn't exist

socks-filter
Bruce Leidl 8 years ago
parent a860eeffa0
commit dfd0812cfc

@ -187,13 +187,6 @@ func getSocksChainConfig(config *SocksJsonConfig) *socksChainConfig {
}
func main() {
// XXX should this really be hardcoded?
// or should i add a CLI to specify config file location?
config, err := loadConfiguration("/etc/fw-daemon-socks.json")
if err != nil {
panic(err)
}
socksConfig := getSocksChainConfig(config)
logBackend := setupLoggerBackend()
log.SetBackend(logBackend)
@ -232,8 +225,16 @@ func main() {
*/
wg := sync.WaitGroup{}
config, err := loadConfiguration("/etc/fw-daemon-socks.json")
if err != nil && !os.IsNotExist(err) {
panic(err)
}
if config != nil {
socksConfig := getSocksChainConfig(config)
chain := NewSocksChain(socksConfig, &wg, fw)
chain.start()
}
fw.runFilter()

Loading…
Cancel
Save