strategy: experimental latency based high availability mode supported

This commit is contained in:
nadoo committed 2018-08-14 19:33:18 +08:00
1 parent f4eab4d1b2
commit e82ea75cba
8 files changed
+173 -71

No files matched your search

+12 -3
View File
@@ -30,17 +30,23 @@ import (
const VERSION = "0.6.7"
func main() {
// read configs
confInit()
// setup a log func
log.F = func(f string, v ...interface{}) {
if conf.Verbose {
stdlog.Printf(f, v...)
}
}
// global rule dialer
dialer := rule.NewDialer(conf.rules, strategy.NewDialer(conf.Forward, &conf.StrategyConfig))
ipsetM, _ := ipset.NewIPSetManager(conf.IPSet, conf.rules)
// DNS Server
// ipset manager
ipsetM, _ := ipset.NewManager(conf.IPSet, conf.rules)
// check and setup dns server
if conf.DNS != "" {
d, err := dns.NewServer(conf.DNS, dialer, &conf.DNSConfig)
if err != nil {
@@ -62,9 +68,12 @@ func main() {
d.AddHandler(ipsetM.AddDomainIP)
}
go d.ListenAndServe()
d.Start()
}
// enable checkers
dialer.Check()
// Proxy Servers
for _, listen := range conf.Listen {
local, err := proxy.ServerFromURL(listen, dialer)