Merge branch 'dev' of https://github.com/Dreamacro/clash into Alpha

This commit is contained in:
wwqgtxx
2022-11-28 20:04:56 +08:00
15 changed files with 447 additions and 338 deletions

View File

@ -24,8 +24,7 @@ const (
VMESS
REDIR
TPROXY
TCPTUN
UDPTUN
TUNNEL
TUN
TUIC
INNER
@ -66,10 +65,8 @@ func (t Type) String() string {
return "Redir"
case TPROXY:
return "TProxy"
case TCPTUN:
return "TcpTun"
case UDPTUN:
return "UdpTun"
case TUNNEL:
return "Tunnel"
case TUN:
return "Tun"
case TUIC:
@ -100,10 +97,8 @@ func ParseType(t string) (*Type, error) {
res = REDIR
case "TPROXY":
res = TPROXY
case "TCPTUN":
res = TCPTUN
case "UDPTUN":
res = UDPTUN
case "TUNNEL":
res = TUNNEL
case "TUN":
res = TUN
case "TUIC":
@ -122,20 +117,21 @@ func (t Type) MarshalJSON() ([]byte, error) {
// Metadata is used to store connection address
type Metadata struct {
NetWork NetWork `json:"network"`
Type Type `json:"type"`
SrcIP netip.Addr `json:"sourceIP"`
DstIP netip.Addr `json:"destinationIP"`
SrcPort string `json:"sourcePort"`
DstPort string `json:"destinationPort"`
InIP netip.Addr `json:"inboundIP"`
InPort string `json:"inboundPort"`
Host string `json:"host"`
DNSMode DNSMode `json:"dnsMode"`
Uid *uint32 `json:"uid"`
Process string `json:"process"`
ProcessPath string `json:"processPath"`
RemoteDst string `json:"remoteDestination"`
NetWork NetWork `json:"network"`
Type Type `json:"type"`
SrcIP netip.Addr `json:"sourceIP"`
DstIP netip.Addr `json:"destinationIP"`
SrcPort string `json:"sourcePort"`
DstPort string `json:"destinationPort"`
InIP netip.Addr `json:"inboundIP"`
InPort string `json:"inboundPort"`
Host string `json:"host"`
DNSMode DNSMode `json:"dnsMode"`
Uid *uint32 `json:"uid"`
Process string `json:"process"`
ProcessPath string `json:"processPath"`
SpecialProxy string `json:"specialProxy"`
RemoteDst string `json:"remoteDestination"`
}
func (m *Metadata) RemoteAddress() string {