You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/proxy/vmess/command/response.go

19 lines
344 B

package command
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
}