general: fixed a bug which leads to panic when the specified interface not exists

This commit is contained in:
nadoo committed 2021-07-02 01:06:11 +08:00
1 parent 72e57ab6e3
commit 7f85f664e3
11 files changed
+27 -39

No files matched your search

+2 -1
View File
@@ -44,7 +44,8 @@ func NewProxy(mainForwarders []string, mainStrategy *Strategy, rules []*Config)
if len(mainForwarders) > 0 {
direct := NewFwdrGroup("", nil, mainStrategy)
for _, f := range rd.main.fwdrs {
host, _, _ := net.SplitHostPort(f.addr)
addr := strings.Split(f.addr, ",")[0]
host, _, _ := net.SplitHostPort(addr)
if ip := net.ParseIP(host); ip == nil {
rd.domainMap.Store(strings.ToLower(host), direct)
}