From 4ea3422e5fd7e39ef00bb99c23026c9a149bb9d2 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Thu, 21 Apr 2022 18:56:33 +0800 Subject: [PATCH] [fix] logic --- adapter/outbound/vless.go | 8 ++++---- constant/metadata.go | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/adapter/outbound/vless.go b/adapter/outbound/vless.go index 4bb6c484..d8e8e18f 100644 --- a/adapter/outbound/vless.go +++ b/adapter/outbound/vless.go @@ -257,18 +257,18 @@ func parseVlessAddr(metadata *C.Metadata) *vless.DstAddr { var addr []byte switch metadata.AddrType { case C.AtypIPv4: - addrType = byte(vless.AtypIPv4) + addrType = vless.AtypIPv4 addr = make([]byte, net.IPv4len) copy(addr[:], metadata.DstIP.AsSlice()) case C.AtypIPv6: - addrType = byte(vless.AtypIPv6) + addrType = vless.AtypIPv6 addr = make([]byte, net.IPv6len) copy(addr[:], metadata.DstIP.AsSlice()) case C.AtypDomainName: - addrType = byte(vless.AtypDomainName) + addrType = vless.AtypDomainName addr = make([]byte, len(metadata.Host)+1) addr[0] = byte(len(metadata.Host)) - copy(addr[1:], []byte(metadata.Host)) + copy(addr[1:], metadata.Host) } port, _ := strconv.ParseUint(metadata.DstPort, 10, 16) diff --git a/constant/metadata.go b/constant/metadata.go index ec7c0bde..b716a6e2 100644 --- a/constant/metadata.go +++ b/constant/metadata.go @@ -85,7 +85,6 @@ type Metadata struct { DNSMode DNSMode `json:"dnsMode"` Process string `json:"process"` ProcessPath string `json:"processPath"` - UserAgent string `json:"userAgent"` } func (m *Metadata) RemoteAddress() string { @@ -101,13 +100,13 @@ func (m *Metadata) SourceAddress() string { } func (m *Metadata) SourceDetail() string { + if m.Type == INNER { + return fmt.Sprintf("[%s]", ClashName) + } + if m.Process != "" { return fmt.Sprintf("%s(%s)", m.SourceAddress(), m.Process) } else { - if m.Type == INNER { - return fmt.Sprintf("[Clash]") - } - return fmt.Sprintf("%s", m.SourceAddress()) } }