mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: sniffer npe
This commit is contained in:
parent
0658ecadd3
commit
7c23fa2bd4
@ -124,7 +124,7 @@ type Sniffer struct {
|
||||
Enable bool
|
||||
Force bool
|
||||
Sniffers []C.SnifferType
|
||||
Reverses trie.DomainTrie[struct{}]
|
||||
Reverses *trie.DomainTrie[struct{}]
|
||||
}
|
||||
|
||||
// Experimental config
|
||||
@ -928,6 +928,7 @@ func parseSniffer(snifferRaw SnifferRaw) (*Sniffer, error) {
|
||||
sniffer.Sniffers = append(sniffer.Sniffers, st)
|
||||
}
|
||||
|
||||
sniffer.Reverses = trie.New[struct{}]()
|
||||
for _, domain := range snifferRaw.Reverse {
|
||||
err := sniffer.Reverses.Insert(domain, struct{}{})
|
||||
if err != nil {
|
||||
|
@ -222,7 +222,7 @@ func updateTun(tun *config.Tun, dns *config.DNS) {
|
||||
|
||||
func updateSniffer(sniffer *config.Sniffer) {
|
||||
if sniffer.Enable {
|
||||
dispatcher, err := SNI.NewSnifferDispatcher(sniffer.Sniffers, sniffer.Force, &sniffer.Reverses)
|
||||
dispatcher, err := SNI.NewSnifferDispatcher(sniffer.Sniffers, sniffer.Force, sniffer.Reverses)
|
||||
if err != nil {
|
||||
log.Warnln("initial sniffer failed, err:%v", err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user