mirror of
https://github.com/nadoo/glider.git
synced 2026-11-19 07:09:42 +08:00
dns: change cache to lrucache
This commit is contained in:
1 parent
8495f16a76
commit
6d64ee4c0e
11 files changed
+146
-90
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user