feature: Adds more commands and adds an example.

This commit is contained in:
greysoh 2024-12-01 22:07:10 -05:00
parent 0d0f16174b
commit 3cb9526716
Signed by: imterah
GPG key ID: 8FA7DD57BA6CEA37
9 changed files with 352 additions and 41 deletions

View file

@ -156,8 +156,8 @@ func Marshal(commandType string, command interface{}) ([]byte, error) {
removeConnectionBytes[6+len(ipBytes)] = protocol
return removeConnectionBytes, nil
case "getAllConnections":
allConnectionsCommand, ok := command.(*GetAllConnections)
case "connectionsResponse":
allConnectionsCommand, ok := command.(*ConnectionsResponse)
if !ok {
return nil, fmt.Errorf("failed to typecast")
@ -247,9 +247,9 @@ func Marshal(commandType string, command interface{}) ([]byte, error) {
var checkMethod uint8
if checkParametersCommand.InReplyTo == "checkClientParameters" {
if checkParametersCommand.InResponseTo == "checkClientParameters" {
checkMethod = CheckClientParametersID
} else if checkParametersCommand.InReplyTo == "checkServerParameters" {
} else if checkParametersCommand.InResponseTo == "checkServerParameters" {
checkMethod = CheckServerParametersID
} else {
return nil, fmt.Errorf("invalid mode recieved (must be either checkClientParameters or checkServerParameters)")