1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 18:17:52 -05:00
v2fly/proxy/vmess/command/response.go

19 lines
344 B
Go
Raw Normal View History

2015-12-11 09:56:10 -05:00
package command
2015-12-12 07:11:49 -05:00
var (
cmdCache = make(map[byte]CommandCreator)
)
func RegisterResponseCommand(id byte, cmdFactory CommandCreator) error {
cmdCache[id] = cmdFactory
return nil
}
func CreateResponseCommand(id byte) (Command, error) {
creator, found := cmdCache[id]
if !found {
return nil, ErrorNoSuchCommand
}
return creator(), nil
}