1
0
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:
v2ray
2016-01-20 17:31:43 +01:00
parent b0adb24003
commit baaef1dad5
12 changed files with 253 additions and 52 deletions

View File

@@ -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())
}