Chore: the default sniffing is changed to a standard port, and the sniffing result is only used for this connection.

This commit is contained in:
gVisor bot 2022-08-21 08:43:57 +08:00
parent af5e00b6ff
commit be49fcfd12
2 changed files with 3 additions and 4 deletions

View file

@ -12,7 +12,6 @@ import (
CN "github.com/Dreamacro/clash/common/net" CN "github.com/Dreamacro/clash/common/net"
"github.com/Dreamacro/clash/common/utils" "github.com/Dreamacro/clash/common/utils"
"github.com/Dreamacro/clash/component/resolver"
C "github.com/Dreamacro/clash/constant" C "github.com/Dreamacro/clash/constant"
"github.com/Dreamacro/clash/log" "github.com/Dreamacro/clash/log"
) )
@ -84,8 +83,7 @@ func (sd *SnifferDispatcher) replaceDomain(metadata *C.Metadata, host string) {
metadata.AddrType = C.AtypDomainName metadata.AddrType = C.AtypDomainName
metadata.Host = host metadata.Host = host
metadata.DNSMode = C.DNSMapping metadata.DNSMode = C.DNSNormal
resolver.InsertHostByIP(metadata.DstIP, host)
} }
func (sd *SnifferDispatcher) Enable() bool { func (sd *SnifferDispatcher) Enable() bool {

View file

@ -977,7 +977,8 @@ func parseSniffer(snifferRaw RawSniffer) (*Sniffer, error) {
var ports []utils.Range[uint16] var ports []utils.Range[uint16]
if len(snifferRaw.Ports) == 0 { if len(snifferRaw.Ports) == 0 {
ports = append(ports, *utils.NewRange[uint16](0, 65535)) ports = append(ports, *utils.NewRange[uint16](80, 80))
ports = append(ports, *utils.NewRange[uint16](443, 443))
} else { } else {
for _, portRange := range snifferRaw.Ports { for _, portRange := range snifferRaw.Ports {
portRaws := strings.Split(portRange, "-") portRaws := strings.Split(portRange, "-")