1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-30 07:46:41 -04:00
v2fly/proxy/vmess/outbound/command.go

24 lines
737 B
Go
Raw Normal View History

package outbound
import (
v2net "github.com/v2ray/v2ray-core/common/net"
2016-02-27 10:41:21 -05:00
"github.com/v2ray/v2ray-core/common/protocol"
)
2016-02-27 10:41:21 -05:00
func (this *VMessOutboundHandler) handleSwitchAccount(cmd *protocol.CommandSwitchAccount) {
2016-05-07 14:26:29 -04:00
user := protocol.NewUser(protocol.NewID(cmd.ID), cmd.Level, cmd.AlterIds.Value(), "")
dest := v2net.TCPDestination(cmd.Host, cmd.Port)
this.receiverManager.AddDetour(NewReceiver(dest, user), cmd.ValidMin)
}
2016-02-27 10:41:21 -05:00
func (this *VMessOutboundHandler) handleCommand(dest v2net.Destination, cmd protocol.ResponseCommand) {
switch typedCommand := cmd.(type) {
2016-02-27 10:41:21 -05:00
case *protocol.CommandSwitchAccount:
2016-01-21 11:22:56 -05:00
if typedCommand.Host == nil {
typedCommand.Host = dest.Address()
}
this.handleSwitchAccount(typedCommand)
default:
}
}