mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-03-04 21:07:30 +00:00
chore: add loopback detect for direct outbound
This commit is contained in:
@@ -148,8 +148,8 @@ type Metadata struct {
|
||||
SpecialRules string `json:"specialRules"`
|
||||
RemoteDst string `json:"remoteDestination"`
|
||||
|
||||
RawSrcAddr net.Addr `json:"-"`
|
||||
RawDstAddr net.Addr `json:"-"`
|
||||
RawSrcAddr net.Addr `json:"-"`
|
||||
RawDstAddr net.Addr `json:"-"`
|
||||
// Only domain rule
|
||||
SniffHost string `json:"sniffHost"`
|
||||
}
|
||||
@@ -162,6 +162,10 @@ func (m *Metadata) SourceAddress() string {
|
||||
return net.JoinHostPort(m.SrcIP.String(), strconv.FormatUint(uint64(m.SrcPort), 10))
|
||||
}
|
||||
|
||||
func (m *Metadata) SourceAddrPort() netip.AddrPort {
|
||||
return netip.AddrPortFrom(m.SrcIP.Unmap(), m.SrcPort)
|
||||
}
|
||||
|
||||
func (m *Metadata) SourceDetail() string {
|
||||
if m.Type == INNER {
|
||||
return fmt.Sprintf("%s", MihomoName)
|
||||
|
||||
Reference in New Issue
Block a user