mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
strategy: experimental latency based high availability mode supported
This commit is contained in:
1 parent
f4eab4d1b2
commit
e82ea75cba
8 files changed
+173
-71
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user