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

+3
View File
@@ -36,6 +36,9 @@ func NewDirect(intface string, dialTimeout, relayTimeout time.Duration) (*Direct
return nil, errors.New(err.Error() + ": " + intface)
}
d.iface = iface
if ips := d.IFaceIPs(); len(ips) > 0 {
d.ip = ips[0]
}
}
}