File tree Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Expand file tree Collapse file tree 4 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ package cache
12
12
13
13
import (
14
14
"container/list"
15
- "fmt "
15
+ "strings "
16
16
"sync"
17
17
"time"
18
18
@@ -185,7 +185,11 @@ func (c *Cache) GetFastTable(key string) *FastMap {
185
185
186
186
// Key creates a hash key from a question section.
187
187
func Key (q dns.Question ) string {
188
- return fmt .Sprintf ("%s %d" , q .Name , q .Qtype )
188
+ var key strings.Builder
189
+ key .WriteString (q .Name )
190
+ Qtype := []byte {byte (q .Qtype ), byte (q .Qtype >> 8 )}
191
+ key .Write (Qtype )
192
+ return key .String ()
189
193
}
190
194
191
195
// Hit returns a dns message from the cache. If the message's TTL is expired nil
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ func (worker *CacheManager) Handle() {
61
61
if ! ok {
62
62
break
63
63
} else {
64
- log .Info (worker .TaskSum )
64
+ log .Info ("Now timer task: " , worker .TaskSum )
65
65
worker .TaskSum --
66
66
}
67
67
}
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"container/list"
11
11
"reflect"
12
12
"strings"
13
+ "time"
13
14
14
15
"github.com/import-yuefeng/smartDNS/core/cache"
15
16
"github.com/import-yuefeng/smartDNS/core/outbound/clients"
@@ -92,6 +93,7 @@ func (data *Pinger) Detect() (fastTable *list.List) {
92
93
log .Error (err )
93
94
return
94
95
}
96
+ pinger .Timeout = time .Second * 10
95
97
pinger .Count = 1
96
98
pinger .Run ()
97
99
stat := pinger .Statistics ()
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ github.com/miekg/dns v1.1.15 h1:CSSIDtllwGLMoA6zjdKnaE6Tx6eVUxQ29LUgGetiDCI=
6
6
github.com/miekg/dns v1.1.15 /go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg =
7
7
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 /go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA =
8
8
github.com/pmezard/go-difflib v1.0.0 /go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4 =
9
+ github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ =
9
10
github.com/robfig/cron v1.2.0 /go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k =
10
11
github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4 =
11
12
github.com/sirupsen/logrus v1.4.2 /go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE =
You can’t perform that action at this time.
0 commit comments