dns: change cache to lrucache

This commit is contained in:
nadoo committed 2020-10-08 18:48:23 +08:00
1 parent 8495f16a76
commit 6d64ee4c0e
11 files changed
+146 -90

No files matched your search

+4 -3
View File
@@ -54,11 +54,12 @@ func NewTLS(s string, d proxy.Dialer, p proxy.Proxy) (*TLS, error) {
}
if t.serverName == "" {
host, port, _ := net.SplitHostPort(t.addr)
if port == "" {
idx := strings.LastIndex(t.addr, ":")
if idx == -1 {
idx = len(t.addr)
t.addr = net.JoinHostPort(t.addr, "443")
}
t.serverName = host
t.serverName = t.addr[:idx]
}
return t, nil