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

+5 -3
View File
@@ -9,6 +9,7 @@ import (
"encoding/hex"
"net"
"net/url"
"strings"
"github.com/nadoo/glider/log"
"github.com/nadoo/glider/pool"
@@ -50,11 +51,12 @@ func NewTrojan(s string, d proxy.Dialer, p proxy.Proxy) (*Trojan, 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]
}
// pass