mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-02-22 07:55:21 -05:00
handle switch account command in vmess out
This commit is contained in:
@@ -7,6 +7,7 @@ type Destination interface {
|
||||
Port() Port
|
||||
String() string // String representation of the destination
|
||||
NetAddr() string
|
||||
Equals(Destination) bool
|
||||
|
||||
IsTCP() bool // True if destination is reachable via TCP
|
||||
IsUDP() bool // True if destination is reachable via UDP
|
||||
@@ -55,6 +56,13 @@ func (dest *tcpDestination) Port() Port {
|
||||
return dest.port
|
||||
}
|
||||
|
||||
func (dest *tcpDestination) Equals(another Destination) bool {
|
||||
if !another.IsTCP() {
|
||||
return false
|
||||
}
|
||||
return dest.Port() == another.Port() && dest.Address().Equals(another.Address())
|
||||
}
|
||||
|
||||
type udpDestination struct {
|
||||
address Address
|
||||
port Port
|
||||
@@ -87,3 +95,10 @@ func (dest *udpDestination) IsUDP() bool {
|
||||
func (dest *udpDestination) Port() Port {
|
||||
return dest.port
|
||||
}
|
||||
|
||||
func (dest *udpDestination) Equals(another Destination) bool {
|
||||
if !another.IsUDP() {
|
||||
return false
|
||||
}
|
||||
return dest.Port() == another.Port() && dest.Address().Equals(another.Address())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user