mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2024-11-16 11:42:43 +08:00
fix: socks5 serialize error #376
This commit is contained in:
parent
a61685ce01
commit
cd7d9fc4f5
|
@ -165,7 +165,7 @@ func (m *Metadata) SourceDetail() string {
|
||||||
|
|
||||||
func (m *Metadata) AddrType() int {
|
func (m *Metadata) AddrType() int {
|
||||||
switch true {
|
switch true {
|
||||||
case m.Host != "" || m.SniffHost != "" || !m.DstIP.IsValid():
|
case m.Host != "" || !m.DstIP.IsValid():
|
||||||
return socks5.AtypDomainName
|
return socks5.AtypDomainName
|
||||||
case m.DstIP.Is4():
|
case m.DstIP.Is4():
|
||||||
return socks5.AtypIPv4
|
return socks5.AtypIPv4
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
_ "github.com/Dreamacro/clash/component/geodata/standard"
|
_ "github.com/Dreamacro/clash/component/geodata/standard"
|
||||||
C "github.com/Dreamacro/clash/constant"
|
C "github.com/Dreamacro/clash/constant"
|
||||||
"github.com/Dreamacro/clash/log"
|
"github.com/Dreamacro/clash/log"
|
||||||
"github.com/Dreamacro/clash/transport/socks5"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type GEOSITE struct {
|
type GEOSITE struct {
|
||||||
|
@ -25,11 +24,10 @@ func (gs *GEOSITE) RuleType() C.RuleType {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) {
|
func (gs *GEOSITE) Match(metadata *C.Metadata) (bool, string) {
|
||||||
if metadata.AddrType() != socks5.AtypDomainName {
|
domain := metadata.RuleHost()
|
||||||
|
if len(domain) == 0 {
|
||||||
return false, ""
|
return false, ""
|
||||||
}
|
}
|
||||||
|
|
||||||
domain := metadata.RuleHost()
|
|
||||||
return gs.matcher.ApplyDomain(domain), gs.adapter
|
return gs.matcher.ApplyDomain(domain), gs.adapter
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user