strategy: moved to a separate package

This commit is contained in:
nadoo committed 2018-08-11 11:46:10 +08:00
1 parent 0da05ecedd
commit e3888a6bd3
5 files changed
+17 -19

No files matched your search

+3 -9
View File
@@ -9,6 +9,7 @@ import (
"github.com/nadoo/glider/common/log"
"github.com/nadoo/glider/dns"
"github.com/nadoo/glider/proxy"
"github.com/nadoo/glider/strategy"
_ "github.com/nadoo/glider/proxy/http"
_ "github.com/nadoo/glider/proxy/mixed"
@@ -27,21 +28,14 @@ import (
const VERSION = "0.6.7"
func main() {
// Config
confInit()
// Log
log.F = func(f string, v ...interface{}) {
if conf.Verbose {
stdlog.Printf(f, v...)
}
}
// Forwarder
dialer := NewRuleDialer(conf.rules, StrategyDialer(conf.Forward, &conf.StrategyConfig))
// IPSet manager
dialer := NewRuleDialer(conf.rules, strategy.NewDialer(conf.Forward, &conf.StrategyConfig))
ipsetM, _ := NewIPSetManager(conf.IPSet, conf.rules)
// DNS Server
@@ -79,7 +73,7 @@ func main() {
go d.ListenAndServe()
}
// Servers
// Proxy Servers
for _, listen := range conf.Listen {
local, err := proxy.ServerFromURL(listen, proxy.NewForwarder(dialer))
if err != nil {