make tun config compatible with premium

This commit is contained in:
Clash-Mini
2022-01-05 00:33:42 +08:00
parent 14917c8af1
commit 9475799615
11 changed files with 180 additions and 121 deletions

View File

@ -2,6 +2,7 @@ package constant
import (
"encoding/json"
"fmt"
"net"
"strconv"
)
@ -89,6 +90,14 @@ func (m *Metadata) SourceAddress() string {
return net.JoinHostPort(m.SrcIP.String(), m.SrcPort)
}
func (m *Metadata) SourceDetail() string {
if m.Process != "" {
return fmt.Sprintf("%s(%s)", m.SourceAddress(), m.Process)
} else {
return fmt.Sprintf("%s", m.SourceAddress())
}
}
func (m *Metadata) Resolved() bool {
return m.DstIP != nil
}